ublo-lib 1.21.6 → 1.21.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/lbm/components/lumiplan/lumiplan.d.ts.map +1 -1
- package/es/lbm/components/lumiplan/lumiplan.js +3 -1
- package/es/lbm/components/lumiplan/lumiplan.module.css +2 -2
- package/es/lbm/components/lumiplan/opening.d.ts +1 -0
- package/es/lbm/components/lumiplan/opening.d.ts.map +1 -1
- package/es/lbm/components/lumiplan/opening.js +4 -4
- package/es/lbm/components/lumiplan/opening.module.css +21 -26
- package/es/lbm/components/lumiplan/pois.js +2 -2
- package/es/lbm/components/lumiplan/resort-selector.module.css +3 -3
- package/es/lbm/components/lumiplan/weather/snow-data.js +1 -1
- package/es/lbm/components/lumiplan/weather/weather-days.d.ts +7 -0
- package/es/lbm/components/lumiplan/weather/weather-days.d.ts.map +1 -0
- package/es/lbm/components/lumiplan/weather/weather-days.js +54 -0
- package/es/lbm/components/lumiplan/weather/weather-days.module.css +66 -0
- package/es/lbm/components/lumiplan/weather/weather-zones.d.ts +6 -0
- package/es/lbm/components/lumiplan/weather/weather-zones.d.ts.map +1 -0
- package/es/lbm/components/lumiplan/weather/weather-zones.js +48 -0
- package/es/lbm/components/lumiplan/weather/weather-zones.module.css +79 -0
- package/es/lbm/components/lumiplan/weather/weather.d.ts.map +1 -1
- package/es/lbm/components/lumiplan/weather/weather.js +4 -41
- package/es/lbm/components/lumiplan/weather/weather.module.css +2 -70
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lumiplan.d.ts","sourceRoot":"","sources":["../../../../src/lbm/components/lumiplan/lumiplan.tsx"],"names":[],"mappings":"AAkBA,MAAM,CAAC,OAAO,UAAU,QAAQ,
|
|
1
|
+
{"version":3,"file":"lumiplan.d.ts","sourceRoot":"","sources":["../../../../src/lbm/components/lumiplan/lumiplan.tsx"],"names":[],"mappings":"AAkBA,MAAM,CAAC,OAAO,UAAU,QAAQ,4CAyI/B"}
|
|
@@ -28,6 +28,8 @@ export default function Lumiplan() {
|
|
|
28
28
|
const isOpeningsInView = useInView(openingsRef, IN_VIEW_CONFIG);
|
|
29
29
|
const isPoisInView = useInView(poisRef, IN_VIEW_CONFIG);
|
|
30
30
|
const [currentResortId, setCurrentResortId] = React.useState(lumiplanResorts[0].id);
|
|
31
|
+
const currentResort = lumiplanResorts.find((resort) => resort.id === currentResortId);
|
|
32
|
+
const showOpening = Boolean(currentResort.showOpening);
|
|
31
33
|
const [resortOpening, setResortOpening] = React.useState();
|
|
32
34
|
const [weather, setWeather] = React.useState();
|
|
33
35
|
const [resortAccess, setResortAccess] = React.useState();
|
|
@@ -114,5 +116,5 @@ export default function Lumiplan() {
|
|
|
114
116
|
fetchData();
|
|
115
117
|
}
|
|
116
118
|
}, [currentResortId, isPoisInView]);
|
|
117
|
-
return (_jsxs("div", { className: css.lumiplan, children: [_jsx(ResortSelector, { resorts: lumiplanResorts, currentResortId: currentResortId, setCurrentResortId: setCurrentResortId }), _jsx(TodaysTips, { ref: todaysTipsRef, resortOpening: resortOpening }), _jsx(Weather, { ref: weatherRef, weather: weather }), _jsx(RoadCondition, { ref: roadConditionRef, resortAccess: resortAccess }), _jsx(Domain, { ref: domainRef, domain: domain }), _jsx(Pois, { ref: poisRef, pois: pois }), _jsx(Opening, { ref: openingsRef, resortOpening: resortOpening })] }));
|
|
119
|
+
return (_jsxs("div", { className: css.lumiplan, children: [_jsx(ResortSelector, { resorts: lumiplanResorts, currentResortId: currentResortId, setCurrentResortId: setCurrentResortId }), _jsx(TodaysTips, { ref: todaysTipsRef, resortOpening: resortOpening }), _jsx(Weather, { ref: weatherRef, weather: weather }), _jsx(RoadCondition, { ref: roadConditionRef, resortAccess: resortAccess }), _jsx(Domain, { ref: domainRef, domain: domain }), _jsx(Pois, { ref: poisRef, pois: pois }), showOpening && (_jsx(Opening, { ref: openingsRef, resortOpening: resortOpening, showOpening: currentResort.showOpening }))] }));
|
|
118
120
|
}
|
|
@@ -2,6 +2,7 @@ import * as React from "react";
|
|
|
2
2
|
import type { ResortOpening } from "./types";
|
|
3
3
|
type Props = {
|
|
4
4
|
resortOpening?: ResortOpening | null;
|
|
5
|
+
showOpening?: string[];
|
|
5
6
|
};
|
|
6
7
|
declare const Opening: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLDivElement>>;
|
|
7
8
|
export default Opening;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"opening.d.ts","sourceRoot":"","sources":["../../../../src/lbm/components/lumiplan/opening.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAQ/B,OAAO,KAAK,EAAE,aAAa,EAAO,MAAM,SAAS,CAAC;AAGlD,KAAK,KAAK,GAAG;IACX,aAAa,CAAC,EAAE,aAAa,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"opening.d.ts","sourceRoot":"","sources":["../../../../src/lbm/components/lumiplan/opening.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAQ/B,OAAO,KAAK,EAAE,aAAa,EAAO,MAAM,SAAS,CAAC;AAGlD,KAAK,KAAK,GAAG;IACX,aAAa,CAAC,EAAE,aAAa,GAAG,IAAI,CAAC;IACrC,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AAEF,QAAA,MAAM,OAAO,8EAsEZ,CAAC;AAqCF,eAAe,OAAO,CAAC"}
|
|
@@ -8,7 +8,7 @@ import NightIcon from "./icons/night";
|
|
|
8
8
|
import DawnIcon from "./icons/dawn";
|
|
9
9
|
import T, { t } from "./i18n/translations";
|
|
10
10
|
import css from "./opening.module.css";
|
|
11
|
-
const Opening = React.forwardRef(({ resortOpening }, ref) => {
|
|
11
|
+
const Opening = React.forwardRef(({ resortOpening, showOpening }, ref) => {
|
|
12
12
|
const { lang } = useUbloContext();
|
|
13
13
|
if (resortOpening === undefined) {
|
|
14
14
|
return (_jsx("div", { ref: ref, className: css.loader, "data-tags": t(lang, "opening.navigation-title"), children: _jsx(Loader, { variant: "overlay" }) }));
|
|
@@ -21,15 +21,15 @@ const Opening = React.forwardRef(({ resortOpening }, ref) => {
|
|
|
21
21
|
const dayIndex = new Date().getDay() - 1;
|
|
22
22
|
const orderedDays = reorganizeDays(dawnSkiingDays, dayIndex);
|
|
23
23
|
const orderedNights = reorganizeDays(nightSkiingDays, dayIndex);
|
|
24
|
-
return (_jsx("div", { ref: ref, className: css.opening, "data-tags": t(lang, "opening.navigation-title"), children: _jsx("div", { className: css.tableOuter, children: _jsxs("table", { className: css.table, children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", {
|
|
24
|
+
return (_jsx("div", { ref: ref, className: css.opening, "data-tags": t(lang, "opening.navigation-title"), children: _jsx("div", { className: css.tableOuter, children: _jsxs("table", { className: css.table, children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", {}), orderedDays.map((day, i) => {
|
|
25
25
|
const dayNumber = new Date();
|
|
26
26
|
dayNumber.setDate(dayNumber.getDate() + i);
|
|
27
27
|
return (_jsx("th", { className: css.heading, children: _jsxs("div", { className: css.headingInner, children: [_jsx(T, { id: `opening.days.${day.dayType}` }), " ", dayNumber.getDate()] }) }, day.dayType));
|
|
28
|
-
})] }) }), _jsxs("tbody", { children: [_jsx("tr", { children: _jsx(Rows, { kind: "dawn", rows: orderedDays }) }), _jsx("tr", { children: _jsx(Rows, { kind: "night", rows: orderedNights }) })] })] }) }) }));
|
|
28
|
+
})] }) }), _jsxs("tbody", { children: [showOpening?.includes("dawn") && (_jsx("tr", { children: _jsx(Rows, { kind: "dawn", rows: orderedDays }) })), showOpening?.includes("night") && (_jsx("tr", { children: _jsx(Rows, { kind: "night", rows: orderedNights }) }))] })] }) }) }));
|
|
29
29
|
});
|
|
30
30
|
function Rows({ kind, rows }) {
|
|
31
31
|
const Icon = kind === "dawn" ? DawnIcon : NightIcon;
|
|
32
|
-
return (_jsxs(_Fragment, { children: [_jsx("td", { className: css.
|
|
32
|
+
return (_jsxs(_Fragment, { children: [_jsx("td", { className: css.heading, children: _jsxs("span", { className: css.headingInner, children: [_jsx(Icon, {}), _jsx(T, { id: `opening.${kind}` })] }) }), rows.map(({ dayType, open }) => {
|
|
33
33
|
const code = open ? "opening.available" : "opening.unavailable";
|
|
34
34
|
const classes = classNames(css.cell, {
|
|
35
35
|
[css.cellAvailable]: open,
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
width: 100%;
|
|
4
4
|
max-width: 1200px;
|
|
5
5
|
height: 300px;
|
|
6
|
-
margin:
|
|
6
|
+
margin: 40px auto;
|
|
7
7
|
border-radius: var(--radius-200);
|
|
8
8
|
overflow: hidden;
|
|
9
9
|
}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
display: flex;
|
|
15
15
|
flex-direction: column;
|
|
16
16
|
gap: 40px;
|
|
17
|
-
margin:
|
|
17
|
+
margin: 40px auto;
|
|
18
18
|
padding: 0 10px;
|
|
19
19
|
}
|
|
20
20
|
|
|
@@ -29,6 +29,17 @@
|
|
|
29
29
|
padding: 20px;
|
|
30
30
|
border: 2px solid hsl(var(--primary));
|
|
31
31
|
border-radius: calc(var(--radius-400) * 2);
|
|
32
|
+
background-image: linear-gradient(to right, white, white),
|
|
33
|
+
linear-gradient(to right, white, white),
|
|
34
|
+
linear-gradient(to right, rgba(0, 0, 0, 0.25), rgba(255, 255, 255, 0)),
|
|
35
|
+
linear-gradient(to left, rgba(0, 0, 0, 0.25), rgba(255, 255, 255, 0));
|
|
36
|
+
background-position: left center, right center, left center, right center;
|
|
37
|
+
background-repeat: no-repeat;
|
|
38
|
+
background-color: white;
|
|
39
|
+
background-size: 40px 100%, 40px 100%, 20px 100%, 20px 100%;
|
|
40
|
+
|
|
41
|
+
background-attachment: local, local, scroll, scroll;
|
|
42
|
+
|
|
32
43
|
overflow: auto;
|
|
33
44
|
}
|
|
34
45
|
|
|
@@ -61,7 +72,6 @@
|
|
|
61
72
|
line-height: 1;
|
|
62
73
|
white-space: nowrap;
|
|
63
74
|
min-width: 60px;
|
|
64
|
-
margin-top: 25px;
|
|
65
75
|
}
|
|
66
76
|
|
|
67
77
|
@media (min-width: 580px) {
|
|
@@ -71,29 +81,21 @@
|
|
|
71
81
|
}
|
|
72
82
|
|
|
73
83
|
.headingInner {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
84
|
+
height: 18px;
|
|
85
|
+
display: flex;
|
|
86
|
+
align-items: flex-end;
|
|
87
|
+
justify-content: center;
|
|
88
|
+
text-align: center;
|
|
89
|
+
gap: 10px;
|
|
90
|
+
margin: 20px 0;
|
|
78
91
|
background-color: hsla(var(--secondary), 10%);
|
|
79
92
|
white-space: nowrap;
|
|
80
93
|
}
|
|
81
94
|
|
|
82
|
-
.headingInnerText {
|
|
83
|
-
display: none;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
@media (min-width: 580px) {
|
|
87
|
-
.headingInnerText {
|
|
88
|
-
display: inline-block;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
95
|
.headingInner > svg {
|
|
93
96
|
min-width: 30px;
|
|
94
97
|
width: 30px;
|
|
95
98
|
height: 30px;
|
|
96
|
-
margin-right: 6%;
|
|
97
99
|
}
|
|
98
100
|
|
|
99
101
|
.table td {
|
|
@@ -119,20 +121,13 @@
|
|
|
119
121
|
}
|
|
120
122
|
|
|
121
123
|
.cellInner {
|
|
122
|
-
|
|
123
|
-
padding: 0 10px;
|
|
124
|
+
padding: 20px 10px;
|
|
124
125
|
display: flex;
|
|
125
126
|
align-items: center;
|
|
126
127
|
justify-content: center;
|
|
127
128
|
text-align: center;
|
|
128
129
|
}
|
|
129
130
|
|
|
130
|
-
@media (min-width: 580px) {
|
|
131
|
-
.cellInner {
|
|
132
|
-
margin-top: 40px;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
131
|
.cellAvailable {
|
|
137
132
|
color: hsl(var(--secondary));
|
|
138
133
|
}
|
|
@@ -106,7 +106,7 @@ const Pois = React.forwardRef(({ pois }, ref) => {
|
|
|
106
106
|
const trailLevelLabel = hasTrailLevel
|
|
107
107
|
? `(${t(lang, `pois.trailLevels.${trailLevel}`)})`
|
|
108
108
|
: null;
|
|
109
|
-
const specialTrail = Object.keys(SPECIAL_TRAILS).find((key) => name
|
|
109
|
+
const specialTrail = Object.keys(SPECIAL_TRAILS).find((key) => name?.includes(key));
|
|
110
110
|
const message = messagePoi?.data?.find(({ language }) => {
|
|
111
111
|
const _lang = lang === "fr" ? "fr_FR" : "en_US";
|
|
112
112
|
return language === _lang;
|
|
@@ -117,7 +117,7 @@ const Pois = React.forwardRef(({ pois }, ref) => {
|
|
|
117
117
|
[css[trailLevel]]: hasTrailLevel,
|
|
118
118
|
});
|
|
119
119
|
let status = "OPEN";
|
|
120
|
-
if (openingStatus
|
|
120
|
+
if (openingStatus?.includes("DELAYED")) {
|
|
121
121
|
status = "DELAYED";
|
|
122
122
|
}
|
|
123
123
|
else {
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
justify-content: center;
|
|
4
4
|
flex-wrap: wrap;
|
|
5
5
|
gap: 20px;
|
|
6
|
-
margin-bottom:
|
|
6
|
+
margin-bottom: 10px;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
button.button {
|
|
10
|
-
--ds-button-padding:
|
|
11
|
-
--ds-button-font-size:
|
|
10
|
+
--ds-button-padding: 14px;
|
|
11
|
+
--ds-button-font-size: 19px;
|
|
12
12
|
--ds-button-foreground: hsl(var(--primary));
|
|
13
13
|
--ds-button-font-weight: 400;
|
|
14
14
|
--ds-button-background: transparent;
|
|
@@ -4,5 +4,5 @@ import SnowCover from "../icons/snow-cover";
|
|
|
4
4
|
import css from "./snow-data.module.css";
|
|
5
5
|
export default function SnowData({ data, expanded }) {
|
|
6
6
|
const { snowQuality, snowTotalDepth, freshSnowFallDepth12H, freshSnowFallDepth24H, freshSnowFallDepth48H, freshSnowFallDepth72H, } = data;
|
|
7
|
-
return (_jsxs("div", { className: css.snow, children: [_jsx(SnowCover, { className: css.snowIcon }), _jsxs("div", { className: css.snowInfo, children: [_jsxs("div", { className: css.snowState, children: [_jsx(T, { id: "snow.snow-quality.title" }), " ", snowQuality && snowQuality !== "UNDEF" && (_jsxs(_Fragment, { children: [": ", _jsx(T, { id: `snow.snow-quality.states.${snowQuality}` })] }))] }), _jsxs("div", { className: css.snowDepth, children: [snowTotalDepth?.value || 0, _jsx(T, { id: snowTotalDepth?.unit || "CENTIMETER" })] }), expanded && (_jsxs("div", { className: css.expanded, children: [freshSnowFallDepth12H && (_jsxs("div", { className: css.snowFall, children: [_jsx(T, { id: "snow.fresh-snow-fall" }), " 12h :", " ", freshSnowFallDepth12H.value, _jsx(T, { id: freshSnowFallDepth12H.unit })] })), freshSnowFallDepth24H && (_jsxs("div", { className: css.snowFall, children: [_jsx(T, { id: "snow.fresh-snow-fall" }), " 24h :", " ", freshSnowFallDepth24H.value, _jsx(T, { id: freshSnowFallDepth24H.unit })] })), freshSnowFallDepth48H && (_jsxs("div", { className: css.snowFall, children: [_jsx(T, { id: "snow.fresh-snow-fall" }), " 48h :", " ", freshSnowFallDepth48H.value, _jsx(T, { id: freshSnowFallDepth48H.unit })] })), freshSnowFallDepth72H && (_jsxs("div", { className: css.snowFall, children: [_jsx(T, { id: "snow.fresh-snow-fall" }), " 72h :", " ", freshSnowFallDepth72H.value, _jsx(T, { id: freshSnowFallDepth72H.unit })] }))] }))] })] }));
|
|
7
|
+
return (_jsxs("div", { className: css.snow, children: [_jsx(SnowCover, { className: css.snowIcon }), _jsxs("div", { className: css.snowInfo, children: [_jsxs("div", { className: css.snowState, children: [_jsx(T, { id: "snow.snow-quality.title" }), " ", snowQuality && snowQuality !== "UNDEF" && (_jsxs(_Fragment, { children: [": ", _jsx(T, { id: `snow.snow-quality.states.${snowQuality}` })] }))] }), _jsxs("div", { className: css.snowDepth, children: [snowTotalDepth?.value || 0, _jsx(T, { id: snowTotalDepth?.unit || "CENTIMETER" })] }), expanded && (_jsxs("div", { className: css.expanded, children: [freshSnowFallDepth12H?.value && (_jsxs("div", { className: css.snowFall, children: [_jsx(T, { id: "snow.fresh-snow-fall" }), " 12h :", " ", freshSnowFallDepth12H.value, _jsx(T, { id: freshSnowFallDepth12H.unit })] })), freshSnowFallDepth24H?.value && (_jsxs("div", { className: css.snowFall, children: [_jsx(T, { id: "snow.fresh-snow-fall" }), " 24h :", " ", freshSnowFallDepth24H.value, _jsx(T, { id: freshSnowFallDepth24H.unit })] })), freshSnowFallDepth48H?.value && (_jsxs("div", { className: css.snowFall, children: [_jsx(T, { id: "snow.fresh-snow-fall" }), " 48h :", " ", freshSnowFallDepth48H.value, _jsx(T, { id: freshSnowFallDepth48H.unit })] })), freshSnowFallDepth72H?.value && (_jsxs("div", { className: css.snowFall, children: [_jsx(T, { id: "snow.fresh-snow-fall" }), " 72h :", " ", freshSnowFallDepth72H.value, _jsx(T, { id: freshSnowFallDepth72H.unit })] }))] }))] })] }));
|
|
8
8
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"weather-days.d.ts","sourceRoot":"","sources":["../../../../../src/lbm/components/lumiplan/weather/weather-days.tsx"],"names":[],"mappings":"AAQA,MAAM,CAAC,OAAO,UAAU,IAAI,CAAC,EAC3B,IAAI,EACJ,eAAe,EACf,kBAAkB,EAClB,IAAI,GACL;;;;;CAAA,2CAiEA"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import classNames from "classnames";
|
|
4
|
+
import Button from "dt-design-system/es/button";
|
|
5
|
+
import T from "../i18n/translations";
|
|
6
|
+
import useWindowSizes from "../../../../common/hooks/use-window-sizes";
|
|
7
|
+
// import useWindowSizes from "ublo-lib/es/common/hooks/use-window-sizes";
|
|
8
|
+
import css from "./weather-days.module.css";
|
|
9
|
+
export default function Days({ days, currentDayIndex, setCurrentDayIndex, lang, }) {
|
|
10
|
+
const [showLeftShadow, setShowLeftShadow] = React.useState(false);
|
|
11
|
+
const [showRightShadow, setShowRightShadow] = React.useState(false);
|
|
12
|
+
const containerRef = React.useRef(null);
|
|
13
|
+
const scrollerRef = React.useRef(null);
|
|
14
|
+
const { width, height } = useWindowSizes();
|
|
15
|
+
const refreshShadows = React.useCallback(() => {
|
|
16
|
+
const container = containerRef.current;
|
|
17
|
+
const scroller = scrollerRef.current;
|
|
18
|
+
if (container && scroller) {
|
|
19
|
+
setShowLeftShadow(scroller.scrollLeft > 50);
|
|
20
|
+
const maxScroll = Math.round(scroller.scrollWidth) - Math.round(scroller.clientWidth);
|
|
21
|
+
setShowRightShadow(scroller.scrollLeft < maxScroll - 50);
|
|
22
|
+
}
|
|
23
|
+
}, []);
|
|
24
|
+
React.useEffect(() => {
|
|
25
|
+
refreshShadows();
|
|
26
|
+
}, [refreshShadows, width, height]);
|
|
27
|
+
const daysClasses = classNames(css.days, {
|
|
28
|
+
[css.leftShadow]: showLeftShadow,
|
|
29
|
+
[css.rightShadow]: showRightShadow,
|
|
30
|
+
});
|
|
31
|
+
return (_jsx("div", { ref: containerRef, className: daysClasses, children: _jsx("div", { ref: scrollerRef, onScroll: refreshShadows, className: css.content, children: days.map((day, i) => {
|
|
32
|
+
const { date, am, pm } = day;
|
|
33
|
+
if (!pm || !am)
|
|
34
|
+
return null;
|
|
35
|
+
const isSelected = i === currentDayIndex;
|
|
36
|
+
const updateCurrentDay = () => {
|
|
37
|
+
setCurrentDayIndex(i);
|
|
38
|
+
};
|
|
39
|
+
const isToday = new Date(date).getDate() === new Date().getDate();
|
|
40
|
+
const locale = lang === "fr" ? "fr-FR" : "en-UK";
|
|
41
|
+
const today = new Date(date).toLocaleDateString(locale, {
|
|
42
|
+
weekday: "long",
|
|
43
|
+
});
|
|
44
|
+
const formatedDate = new Date(date).toLocaleDateString(locale, {
|
|
45
|
+
day: "2-digit",
|
|
46
|
+
month: "2-digit",
|
|
47
|
+
year: "numeric",
|
|
48
|
+
});
|
|
49
|
+
const classes = classNames(css.day, {
|
|
50
|
+
[css.daySelected]: isSelected,
|
|
51
|
+
});
|
|
52
|
+
return (_jsxs(Button, { className: classes, onClick: updateCurrentDay, children: [_jsx("b", { children: isToday ? _jsx(T, { id: "weather.today" }) : today }), formatedDate] }, date));
|
|
53
|
+
}) }) }));
|
|
54
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
.days {
|
|
2
|
+
position: relative;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.days::before,
|
|
6
|
+
.days::after {
|
|
7
|
+
content: "";
|
|
8
|
+
position: absolute;
|
|
9
|
+
top: 0;
|
|
10
|
+
width: 40px;
|
|
11
|
+
height: 100%;
|
|
12
|
+
background: linear-gradient(
|
|
13
|
+
to right,
|
|
14
|
+
#fff,
|
|
15
|
+
rgba(255, 255, 255, 0.6),
|
|
16
|
+
transparent
|
|
17
|
+
);
|
|
18
|
+
z-index: 1;
|
|
19
|
+
opacity: 0;
|
|
20
|
+
transition: opacity 320ms ease;
|
|
21
|
+
pointer-events: none;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.days::before {
|
|
25
|
+
left: 0;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.days::after {
|
|
29
|
+
right: 0;
|
|
30
|
+
transform: rotate(0.5turn);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.leftShadow::before,
|
|
34
|
+
.rightShadow::after {
|
|
35
|
+
opacity: 1;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.content {
|
|
39
|
+
width: 100%;
|
|
40
|
+
display: flex;
|
|
41
|
+
align-items: center;
|
|
42
|
+
overflow: auto;
|
|
43
|
+
scroll-snap-type: x proximity;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
button.day {
|
|
47
|
+
--ds-button-padding: 16px;
|
|
48
|
+
--ds-button-font-size: 14px;
|
|
49
|
+
--ds-button-foreground: hsl(var(--primary));
|
|
50
|
+
--ds-button-font-weight: 400;
|
|
51
|
+
--ds-button-background: transparent;
|
|
52
|
+
--ds-button-hover-background: hsla(var(--primary), 10%);
|
|
53
|
+
--ds-button-radius: 0;
|
|
54
|
+
|
|
55
|
+
flex-direction: column;
|
|
56
|
+
scroll-snap-align: start;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
button.daySelected {
|
|
60
|
+
position: relative;
|
|
61
|
+
--ds-button-background: hsla(var(--primary), 10%);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
button.day b {
|
|
65
|
+
text-transform: uppercase;
|
|
66
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"weather-zones.d.ts","sourceRoot":"","sources":["../../../../../src/lbm/components/lumiplan/weather/weather-zones.tsx"],"names":[],"mappings":"AAQA,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,EAC5B,YAAY,EACZ,gBAAgB,EAChB,mBAAmB,GACpB;;;;CAAA,2CAgEA"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import classNames from "classnames";
|
|
4
|
+
import useWindowSizes from "../../../../common/hooks/use-window-sizes";
|
|
5
|
+
// import useWindowSizes from "ublo-lib/es/common/hooks/use-window-sizes";
|
|
6
|
+
import Button from "dt-design-system/es/button";
|
|
7
|
+
import T from "../i18n/translations";
|
|
8
|
+
import css from "./weather-zones.module.css";
|
|
9
|
+
export default function Zones({ weatherZones, currentZoneIndex, setCurrentZoneIndex, }) {
|
|
10
|
+
const [showLeftShadow, setShowLeftShadow] = React.useState(false);
|
|
11
|
+
const [showRightShadow, setShowRightShadow] = React.useState(false);
|
|
12
|
+
const containerRef = React.useRef(null);
|
|
13
|
+
const scrollerRef = React.useRef(null);
|
|
14
|
+
const { width, height } = useWindowSizes();
|
|
15
|
+
const refreshShadows = React.useCallback(() => {
|
|
16
|
+
const container = containerRef.current;
|
|
17
|
+
const scroller = scrollerRef.current;
|
|
18
|
+
if (container && scroller) {
|
|
19
|
+
setShowLeftShadow(scroller.scrollLeft > 50);
|
|
20
|
+
const maxScroll = Math.round(scroller.scrollWidth) - Math.round(scroller.clientWidth);
|
|
21
|
+
setShowRightShadow(scroller.scrollLeft < maxScroll - 50);
|
|
22
|
+
}
|
|
23
|
+
}, []);
|
|
24
|
+
React.useEffect(() => {
|
|
25
|
+
refreshShadows();
|
|
26
|
+
}, [refreshShadows, width, height]);
|
|
27
|
+
const zonesClasses = classNames(css.zones, {
|
|
28
|
+
[css.leftShadow]: showLeftShadow,
|
|
29
|
+
[css.rightShadow]: showRightShadow,
|
|
30
|
+
});
|
|
31
|
+
return (_jsx("div", { ref: containerRef, className: zonesClasses, children: _jsx("div", { ref: scrollerRef, onScroll: refreshShadows, className: css.content, children: weatherZones.map((zone, i) => {
|
|
32
|
+
const hasData = Boolean(zone.weatherInfos.length > 0 &&
|
|
33
|
+
zone.weatherInfos[0].am &&
|
|
34
|
+
zone.weatherInfos[0].pm);
|
|
35
|
+
if (!hasData)
|
|
36
|
+
return null;
|
|
37
|
+
const { name, altitude } = zone;
|
|
38
|
+
const { value, unit } = altitude;
|
|
39
|
+
const isSelected = i === currentZoneIndex;
|
|
40
|
+
const updateCurrentZone = () => {
|
|
41
|
+
setCurrentZoneIndex(i);
|
|
42
|
+
};
|
|
43
|
+
const classes = classNames(css.zone, {
|
|
44
|
+
[css.zoneSelected]: isSelected,
|
|
45
|
+
});
|
|
46
|
+
return (_jsxs(Button, { className: classes, onClick: updateCurrentZone, children: [_jsx("b", { children: name }), " ", value, _jsx("span", { children: _jsx(T, { id: unit }) })] }, name));
|
|
47
|
+
}) }) }));
|
|
48
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
.zones {
|
|
2
|
+
position: relative;
|
|
3
|
+
margin-bottom: 30px;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.zones::before,
|
|
7
|
+
.zones::after {
|
|
8
|
+
content: "";
|
|
9
|
+
position: absolute;
|
|
10
|
+
top: 0;
|
|
11
|
+
width: 40px;
|
|
12
|
+
height: 100%;
|
|
13
|
+
background: linear-gradient(
|
|
14
|
+
to right,
|
|
15
|
+
#fff,
|
|
16
|
+
rgba(255, 255, 255, 0.6),
|
|
17
|
+
transparent
|
|
18
|
+
);
|
|
19
|
+
z-index: 1;
|
|
20
|
+
opacity: 0;
|
|
21
|
+
transition: opacity 320ms ease;
|
|
22
|
+
pointer-events: none;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.zones::before {
|
|
26
|
+
left: 0;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.zones::after {
|
|
30
|
+
right: 0;
|
|
31
|
+
transform: rotate(0.5turn);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.leftShadow::before,
|
|
35
|
+
.rightShadow::after {
|
|
36
|
+
opacity: 1;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.content {
|
|
40
|
+
width: 100%;
|
|
41
|
+
display: flex;
|
|
42
|
+
align-items: center;
|
|
43
|
+
gap: 10px;
|
|
44
|
+
overflow: auto;
|
|
45
|
+
scroll-snap-type: x proximity;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
button.zone {
|
|
49
|
+
--ds-button-padding: 8px;
|
|
50
|
+
--ds-button-font-size: 14px;
|
|
51
|
+
--ds-button-foreground: hsl(var(--primary));
|
|
52
|
+
--ds-button-font-weight: 400;
|
|
53
|
+
--ds-button-background: transparent;
|
|
54
|
+
--ds-button-hover-background: hsla(var(--primary), 10%);
|
|
55
|
+
--ds-button-shadow: 0 0 0 1px hsl(var(--primary)) inset;
|
|
56
|
+
|
|
57
|
+
display: block;
|
|
58
|
+
white-space: nowrap;
|
|
59
|
+
scroll-snap-align: start;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
button.zone:first-child {
|
|
63
|
+
margin-left: auto;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
button.zone:last-child {
|
|
67
|
+
margin-right: auto;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
button.zoneSelected {
|
|
71
|
+
--ds-button-foreground: hsl(var(--grey-000));
|
|
72
|
+
--ds-button-shadow: 0;
|
|
73
|
+
|
|
74
|
+
background: var(--blue-gradient);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
button.zone b {
|
|
78
|
+
text-transform: uppercase;
|
|
79
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"weather.d.ts","sourceRoot":"","sources":["../../../../../src/lbm/components/lumiplan/weather/weather.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"weather.d.ts","sourceRoot":"","sources":["../../../../../src/lbm/components/lumiplan/weather/weather.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAU/B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAKhD,KAAK,KAAK,GAAG;IACX,OAAO,CAAC,EAAE,eAAe,GAAG,IAAI,CAAC;CAClC,CAAC;AAEF,QAAA,MAAM,OAAO,8EA+EZ,CAAC;AAIF,eAAe,OAAO,CAAC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import classNames from "classnames";
|
|
4
3
|
import { useUbloContext } from "ublo/with-ublo";
|
|
5
4
|
import Button from "dt-design-system/es/button";
|
|
6
5
|
import Tooltip from "dt-design-system/es/tooltip";
|
|
@@ -9,8 +8,10 @@ import * as Icons from "dt-design-system/es/icons";
|
|
|
9
8
|
import AvalancheRisk from "./avalanche-risk";
|
|
10
9
|
import SnowData from "./snow-data";
|
|
11
10
|
import WeatherData from "./weather-data";
|
|
12
|
-
import
|
|
11
|
+
import { t } from "../i18n/translations";
|
|
13
12
|
import css from "./weather.module.css";
|
|
13
|
+
import Days from "./weather-days";
|
|
14
|
+
import Zones from "./weather-zones";
|
|
14
15
|
const Weather = React.forwardRef(({ weather }, ref) => {
|
|
15
16
|
const { lang } = useUbloContext();
|
|
16
17
|
const [currentZoneIndex, setCurrentZoneIndex] = React.useState(0);
|
|
@@ -36,45 +37,7 @@ const Weather = React.forwardRef(({ weather }, ref) => {
|
|
|
36
37
|
const toggleExpanded = () => {
|
|
37
38
|
setExpanded(!expanded);
|
|
38
39
|
};
|
|
39
|
-
return (_jsxs("div", { ref: ref, className: css.weather, "data-tags": t(lang, "weather.title"), children: [_jsxs("div", { className: css.
|
|
40
|
-
const { date, am, pm } = day;
|
|
41
|
-
if (!pm || !am)
|
|
42
|
-
return null;
|
|
43
|
-
const isSelected = i === currentDayIndex;
|
|
44
|
-
const updateCurrentDay = () => {
|
|
45
|
-
setCurrentDayIndex(i);
|
|
46
|
-
};
|
|
47
|
-
const isToday = new Date(date).getDate() === new Date().getDate();
|
|
48
|
-
const locale = lang === "fr" ? "fr-FR" : "en-UK";
|
|
49
|
-
const today = new Date(date).toLocaleDateString(locale, {
|
|
50
|
-
weekday: "long",
|
|
51
|
-
});
|
|
52
|
-
const formatedDate = new Date(date).toLocaleDateString(locale, {
|
|
53
|
-
day: "2-digit",
|
|
54
|
-
month: "2-digit",
|
|
55
|
-
year: "numeric",
|
|
56
|
-
});
|
|
57
|
-
const classes = classNames(css.day, {
|
|
58
|
-
[css.daySelected]: isSelected,
|
|
59
|
-
});
|
|
60
|
-
return (_jsxs(Button, { className: classes, onClick: updateCurrentDay, children: [_jsx("b", { children: isToday ? _jsx(T, { id: "weather.today" }) : today }), formatedDate] }, date));
|
|
61
|
-
}) }), _jsx("div", { className: css.zones, children: weatherZones.map((zone, i) => {
|
|
62
|
-
const hasData = Boolean(zone.weatherInfos.length > 0 &&
|
|
63
|
-
zone.weatherInfos[0].am &&
|
|
64
|
-
zone.weatherInfos[0].pm);
|
|
65
|
-
if (!hasData)
|
|
66
|
-
return null;
|
|
67
|
-
const { name, altitude } = zone;
|
|
68
|
-
const { value, unit } = altitude;
|
|
69
|
-
const isSelected = i === currentZoneIndex;
|
|
70
|
-
const updateCurrentZone = () => {
|
|
71
|
-
setCurrentZoneIndex(i);
|
|
72
|
-
};
|
|
73
|
-
const classes = classNames(css.zone, {
|
|
74
|
-
[css.zoneSelected]: isSelected,
|
|
75
|
-
});
|
|
76
|
-
return (_jsxs(Button, { className: classes, onClick: updateCurrentZone, children: [_jsx("b", { children: name }), " ", value, _jsx("span", { children: _jsx(T, { id: unit }) })] }, name));
|
|
77
|
-
}) })] }), _jsxs("div", { className: css.info, children: [_jsx(AvalancheRisk, { avalancheRisk: snowData.avalancheRisk }), _jsxs("div", { className: css.infoBottom, children: [_jsx(SnowData, { data: snowData, expanded: expanded }), _jsx(WeatherData, { kind: "am", data: am, expanded: expanded }), _jsx(WeatherData, { kind: "pm", data: pm, expanded: expanded })] }), _jsx(Tooltip, { content: t(lang, expanded ? "see-less" : "see-more"), children: _jsx(Button, { className: css.expandButton, variant: "transparent", onClick: toggleExpanded, children: _jsx(ExpandIcon, {}) }) })] })] }));
|
|
40
|
+
return (_jsxs("div", { ref: ref, className: css.weather, "data-tags": t(lang, "weather.title"), children: [_jsx(Zones, { weatherZones: weatherZones, currentZoneIndex: currentZoneIndex, setCurrentZoneIndex: setCurrentZoneIndex }), _jsx(Days, { days: days, currentDayIndex: currentDayIndex, setCurrentDayIndex: setCurrentDayIndex, lang: lang }), _jsxs("div", { className: css.info, children: [_jsx(AvalancheRisk, { avalancheRisk: snowData.avalancheRisk }), _jsxs("div", { className: css.infoBottom, children: [_jsx(SnowData, { data: snowData, expanded: expanded }), _jsx(WeatherData, { kind: "am", data: am, expanded: expanded }), _jsx(WeatherData, { kind: "pm", data: pm, expanded: expanded })] }), _jsx(Tooltip, { content: t(lang, expanded ? "see-less" : "see-more"), children: _jsx(Button, { className: css.expandButton, variant: "transparent", onClick: toggleExpanded, children: _jsx(ExpandIcon, {}) }) })] })] }));
|
|
78
41
|
});
|
|
79
42
|
Weather.displayName = "Weather";
|
|
80
43
|
export default Weather;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
width: 100%;
|
|
4
4
|
max-width: 1200px;
|
|
5
5
|
height: 300px;
|
|
6
|
-
margin:
|
|
6
|
+
margin: 20px auto;
|
|
7
7
|
border-radius: var(--radius-200);
|
|
8
8
|
overflow: hidden;
|
|
9
9
|
}
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
max-width: 1200px;
|
|
14
14
|
display: flex;
|
|
15
15
|
flex-direction: column;
|
|
16
|
-
margin:
|
|
16
|
+
margin: 20px auto;
|
|
17
17
|
padding: 0 10px;
|
|
18
18
|
}
|
|
19
19
|
|
|
@@ -23,74 +23,6 @@
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
.header {
|
|
27
|
-
display: flex;
|
|
28
|
-
flex-direction: column-reverse;
|
|
29
|
-
gap: 16px;
|
|
30
|
-
overflow: auto;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
@media (min-width: 700px) {
|
|
34
|
-
.header {
|
|
35
|
-
flex-direction: row;
|
|
36
|
-
align-items: center;
|
|
37
|
-
justify-content: space-between;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.days {
|
|
42
|
-
display: flex;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
.zones {
|
|
46
|
-
display: flex;
|
|
47
|
-
gap: 10px;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
button.zone {
|
|
51
|
-
--ds-button-padding: 12px;
|
|
52
|
-
--ds-button-font-size: 14px;
|
|
53
|
-
--ds-button-foreground: hsl(var(--primary));
|
|
54
|
-
--ds-button-font-weight: 400;
|
|
55
|
-
--ds-button-background: transparent;
|
|
56
|
-
--ds-button-hover-background: hsla(var(--primary), 10%);
|
|
57
|
-
--ds-button-shadow: 0 0 0 1px hsl(var(--primary)) inset;
|
|
58
|
-
|
|
59
|
-
display: block;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
button.zoneSelected {
|
|
63
|
-
--ds-button-foreground: hsl(var(--grey-000));
|
|
64
|
-
--ds-button-shadow: 0;
|
|
65
|
-
|
|
66
|
-
background: var(--blue-gradient);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
button.zone b {
|
|
70
|
-
text-transform: uppercase;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
button.day {
|
|
74
|
-
--ds-button-padding: 16px;
|
|
75
|
-
--ds-button-font-size: 14px;
|
|
76
|
-
--ds-button-foreground: hsl(var(--primary));
|
|
77
|
-
--ds-button-font-weight: 400;
|
|
78
|
-
--ds-button-background: transparent;
|
|
79
|
-
--ds-button-hover-background: hsla(var(--primary), 10%);
|
|
80
|
-
--ds-button-radius: 0;
|
|
81
|
-
|
|
82
|
-
flex-direction: column;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
button.daySelected {
|
|
86
|
-
position: relative;
|
|
87
|
-
--ds-button-background: hsla(var(--primary), 10%);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
button.day b {
|
|
91
|
-
text-transform: uppercase;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
26
|
.info {
|
|
95
27
|
display: flex;
|
|
96
28
|
flex-direction: column;
|