Skip to content

Commit

Permalink
simplify config
Browse files Browse the repository at this point in the history
  • Loading branch information
bugsounet committed Apr 6, 2024
1 parent f25f161 commit c32e69a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 117 deletions.
89 changes: 2 additions & 87 deletions MMM-MeteoFrance.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
background-repeat: no-repeat;
background-position: center;
background-size: cover;
animation: BackgroundFadeIn 2s;
animation: BackgroundFadeIn 3s;
}

@keyframes BackgroundFadeIn {
Expand Down Expand Up @@ -125,8 +125,7 @@
}

/* Inline icons */
.MMM-MeteoFrance .inline-icon,
.MMM-MeteoFrance .wrapper.tiled .forecast-container .forecast-item .inline-icon {
.MMM-MeteoFrance .inline-icon {
display: inline-block;
width: 24px;
height: 24px;
Expand Down Expand Up @@ -341,91 +340,8 @@
}


/* Forecast Header */

.MMM-MeteoFrance .module-header.forecast-header {
margin-top: 20px;
margin-bottom: 0;
}

/* ------------ Forecast ------------ */

/* Tiled Layout */

.MMM-MeteoFrance .wrapper.tiled .forecast-container {
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: flex-start;
align-content: flex-start;
align-items: flex-start;
margin-bottom: 0 30px;
border-top: solid 1px #222;
}

.MMM-MeteoFrance .wrapper.with-forecast-header.tiled .forecast-container {
border-top: none;
}

.MMM-MeteoFrance .wrapper.tiled .forecast-container .forecast-item {
flex-grow: 1;
flex-shrink: 1;
min-width: 100px;
padding: 10px 5px 10px 5px;
border-bottom: solid 1px #222;
}


.MMM-MeteoFrance .wrapper.tiled .forecast-container * {
text-align: center;
}

.MMM-MeteoFrance .wrapper.tiled .forecast-container .forecast-item .time,
.MMM-MeteoFrance .wrapper.tiled .forecast-container .forecast-item .forecast-icon-container,
.MMM-MeteoFrance .wrapper.tiled .forecast-container .forecast-item .forecast-icon-arrow-container,
.MMM-MeteoFrance .wrapper.tiled .forecast-container .forecast-item .forecast-icon,
.MMM-MeteoFrance .wrapper.tiled .forecast-container .forecast-item .temperature,
.MMM-MeteoFrance .wrapper.tiled .forecast-container .forecast-item .temperature-container,
.MMM-MeteoFrance .wrapper.tiled .forecast-container .forecast-item .precipitation-container,
.MMM-MeteoFrance .wrapper.tiled .forecast-container .forecast-item .wind-container,
.MMM-MeteoFrance .wrapper.tiled .forecast-container .forecast-item .day-name {
display: block;
margin: auto;
}

.MMM-MeteoFrance .wrapper.tiled .forecast-container .forecast-item .forecast-icon {
width: 70px;
height: 70px;
margin: 4px auto;
}

.MMM-MeteoFrance .wrapper.tiled .forecast-container .forecast-item .time,
.MMM-MeteoFrance .wrapper.tiled .forecast-container .forecast-item .day-name {
font-size: 17px;
text-transform: uppercase;
}


.MMM-MeteoFrance .wrapper.tiled .forecast-container .forecast-item .wind-speed {
display: inline-block;
white-space: nowrap;
}

.MMM-MeteoFrance .wrapper.tiled .forecast-container .forecast-item .temperature,
.MMM-MeteoFrance .wrapper.tiled .forecast-container .forecast-item .temperature-container {
font-size: 22px;
padding: 4px 0;
}


.MMM-MeteoFrance .wrapper.tiled .forecast-container .forecast-item .precipitation-container,
.MMM-MeteoFrance .wrapper.tiled .forecast-container .forecast-item .wind-container {
font-size: 17px;
line-height: 1.5;
}

/* ------------ Table Layout ------------ */

.MMM-MeteoFrance .wrapper.table .forecast-container {
display: table;
border-collapse: collapse;
Expand All @@ -442,7 +358,6 @@
border-top: solid 1px #222;
}

.MMM-MeteoFrance .wrapper.with-forecast-header.table .forecast-container > div:first-child,
.MMM-MeteoFrance .wrapper.table .forecast-container .header-row {
border-top: none;
}
Expand Down
10 changes: 1 addition & 9 deletions MMM-MeteoFrance.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ Module.register("MMM-MeteoFrance", {
DailyForecast: true,
Precipitation: true,
Wind: true,
InlineIcons: true,
Feels: true,
SunCondition: true,
Humidity: true,
Expand All @@ -38,9 +37,7 @@ Module.register("MMM-MeteoFrance", {
personalize: {
hourlyForecastInterval: 3,
maxHourliesToShow: 3,
maxDailiesToShow: 3,
forecastLayout: "table",
forecastHeaderText: ""
maxDailiesToShow: 3
}
},

Expand Down Expand Up @@ -82,11 +79,6 @@ Module.register("MMM-MeteoFrance", {
error: this.error ? true: false,
config: this.config,
forecast: this.formattedWeatherData,
inlineIcons : {
rain: this.file("resources/i-rain.svg"),
wind: this.file("resources/i-wind.svg"),
uv: this.file("resources/uv.png")
},
update: this.weatherData && this.weatherData.update ? this.weatherData.update : this.translate("LOADING")
};
},
Expand Down
23 changes: 3 additions & 20 deletions MMM-MeteoFrance.njk
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="wrapper {{ config.personalize.forecastLayout }} {% if config.display.InlineIcons %}inline-icons{% endif %} {% if config.personalize.forecastHeaderText %}with-forecast-header{% endif %}">
<div class="wrapper table">

{% if loading or error %}
<div class="current-conditions-wrapper">
Expand Down Expand Up @@ -63,9 +63,7 @@
<div class="Precip-wind-contener">
{% if config.display.Precipitation %}
<span class="precipitation-container">
{% if (config.display.InlineIcons) %}
<span class="wi wi-raindrop"></span>
{% endif %}
{% if forecast.currently.precipitation.accumulation %}
<span class="pop">{{ forecast.currently.precipitation.accumulation }}</span>
{% endif %}
Expand All @@ -74,9 +72,7 @@

{% if config.display.Wind %}
<span class="wind-container">
{% if (config.display.InlineIcons) %}
<span class="wi wi-strong-wind"></span>
{% endif %}
<span class="wi wi-strong-wind"></span>
<span class="wind-speed">{{ forecast.currently.wind.windSpeed }}</span>
{% if forecast.currently.wind.windIcon %}
<img class="inline-icon {{ forecast.currently.wind.Beaufort }}" src="{{ forecast.currently.wind.windIcon }}" />
Expand All @@ -100,16 +96,11 @@
</div>
{% endif %}

{# -------------- Forecast Title -------------- #}
{% if not (config.personalize.forecastHeaderText == "") and (config.display.HourlyForecast or config.display.DailyForecast) %}
<header class="module-header forecast-header">{{ config.personalize.forecastHeaderText | safe }}</header>
{% endif %}

{# -------------- Forecast -------------- #}
{% if config.display.HourlyForecast or config.display.DailyForecast %}
<div class="forecast-container">

{% if config.display.ForecastTableColumnHeaderIcons and config.personalize.forecastLayout == "table" %}
{% if config.display.ForecastTableColumnHeaderIcons%}
<div class="header-row">
<span class="date-time-header">&nbsp;</span>
<span class="weather-icon-header">&nbsp;</span>
Expand Down Expand Up @@ -139,10 +130,6 @@

{% if config.display.Wind %}
<span class="wind-container">
{% if (config.display.InlineIcons and config.personalize.forecastLayout == "tiled" ) %}
<img class="inline-icon" src="{{ inlineIcons.wind }}" />
{% endif %}

<span class="wind-speed">{{ h.wind.windSpeed }}</span>
</span>
<span class="forecast-icon-arrow-container">
Expand Down Expand Up @@ -172,10 +159,6 @@

{% if config.display.Wind %}
<span class="wind-container">
{% if (config.display.InlineIcons and config.personalize.forecastLayout == "tiled" ) %}
<img class="inline-icon" src="{{ inlineIcons.wind }}" />
{% endif %}

<span class="wind-speed">{{ d.wind.windSpeed }}</span>
</span>
<span class="forecast-icon-arrow-container">
Expand Down
2 changes: 1 addition & 1 deletion node_helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ module.exports = NodeHelper.create({
break;

default:
console.error(`[METEOFRANCE] Unkown icon: ${name}, Thanks to inform developer!`)
console.error(`[METEOFRANCE] Unkown icon: ${name}, Thanks to inform developer!`);
background = "soleil_nuage";
break;
}
Expand Down

0 comments on commit c32e69a

Please sign in to comment.