Skip to content

Commit b5a1b15

Browse files
authored
Session UI: small tweaks and fixes (#16867)
1 parent 7191ce9 commit b5a1b15

10 files changed

+50
-28
lines changed

assets/js/colors.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ function updateCssColors() {
4343
colors.self = style.getPropertyValue("--evcc-self");
4444
colors.grid = style.getPropertyValue("--evcc-grid");
4545
colors.background = style.getPropertyValue("--evcc-background");
46-
colors.pricePerKWh = style.getPropertyValue("--evcc-grid");
47-
colors.co2PerKWh = style.getPropertyValue("--evcc-grid");
46+
colors.pricePerKWh = style.getPropertyValue("--bs-gray-medium");
47+
colors.co2PerKWh = style.getPropertyValue("--bs-gray-medium");
4848
}
4949

5050
// update colors on theme change

assets/js/components/Config/PropertyField.vue

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
class="w-50"
5050
v-model="value"
5151
equal-width
52+
transparent
5253
:options="[
5354
{ value: false, name: $t('config.options.boolean.no') },
5455
{ value: true, name: $t('config.options.boolean.yes') },

assets/js/components/Config/UserInterfaceSettings.vue

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
id="settingsDesign"
66
v-model="theme"
77
class="w-100"
8+
transparent
89
:options="
910
THEMES.map((value) => ({
1011
value,
@@ -31,6 +32,7 @@
3132
id="settingsUnit"
3233
v-model="unit"
3334
class="w-75"
35+
transparent
3436
:options="
3537
UNITS.map((value) => ({
3638
value,

assets/js/components/Config/VehicleModal.vue

+1
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@
120120
{ name: '2-phases', value: '2' },
121121
{ name: '3-phases', value: undefined },
122122
]"
123+
transparent
123124
equal-width
124125
/>
125126
</FormRow>

assets/js/components/SelectGroup.vue

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div class="mode-group border d-inline-flex" :class="{ large }" role="group">
2+
<div class="mode-group border d-inline-flex" :class="{ large, transparent }" role="group">
33
<button
44
v-for="(option, i) in options"
55
:id="i === 0 ? id : null"
@@ -24,6 +24,7 @@ export default {
2424
modelValue: [Number, String],
2525
equalWidth: Boolean,
2626
large: Boolean,
27+
transparent: Boolean,
2728
},
2829
emits: ["update:modelValue"],
2930
};
@@ -34,6 +35,9 @@ export default {
3435
border: 2px solid var(--evcc-default-text);
3536
border-radius: 17px;
3637
padding: 4px;
38+
}
39+
40+
.mode-group:not(.transparent) {
3741
background: var(--evcc-background);
3842
}
3943

assets/js/components/Sessions/CostHistoryChart.vue

+18-17
Original file line numberDiff line numberDiff line change
@@ -256,27 +256,22 @@ export default {
256256
return null;
257257
}
258258
259-
return (
260-
datasetLabel +
261-
": " +
262-
(this.costType === TYPES.PRICE
259+
const valueFmt =
260+
this.costType === TYPES.PRICE
263261
? this.fmtPricePerKWh(value, this.currency, false)
264-
: this.fmtCo2Medium(value))
265-
);
262+
: this.fmtCo2Medium(value);
263+
return `${datasetLabel}: ${valueFmt}`;
266264
}
267265
268-
return (
269-
datasetLabel +
270-
": " +
271-
(this.costType === TYPES.PRICE
272-
? this.fmtMoney(value || 0, this.currency, true, true)
273-
: this.fmtGrams(value || 0))
274-
);
266+
return value
267+
? `${datasetLabel}: ${
268+
this.costType === TYPES.PRICE
269+
? this.fmtMoney(value, this.currency, true, true)
270+
: this.fmtGrams(value)
271+
}`
272+
: null;
275273
},
276274
labelColor: tooltipLabelColor(false),
277-
labelTextColor: (item) => {
278-
return !item.raw ? colors.muted : "#fff";
279-
},
280275
},
281276
itemSort: function (a, b) {
282277
return b.datasetIndex - a.datasetIndex;
@@ -288,7 +283,13 @@ export default {
288283
stacked: true,
289284
border: { display: false },
290285
grid: { display: false },
291-
ticks: { color: colors.muted },
286+
ticks: {
287+
color: colors.muted,
288+
callback: (value) =>
289+
this.period === PERIODS.YEAR
290+
? this.fmtMonth(new Date(this.year, value, 1), true)
291+
: value,
292+
},
292293
},
293294
y: {
294295
stacked: true,

assets/js/components/Sessions/EnergyHistoryChart.vue

+10-7
Original file line numberDiff line numberDiff line change
@@ -186,19 +186,16 @@ export default {
186186
label: (tooltipItem) => {
187187
const datasetLabel = tooltipItem.dataset.label || "";
188188
const value = tooltipItem.raw || 0;
189-
return (
190-
datasetLabel + ": " + this.fmtWh(value * 1e3, POWER_UNIT.AUTO)
191-
);
189+
return value
190+
? `${datasetLabel}: ${this.fmtWh(value * 1e3, POWER_UNIT.AUTO)}`
191+
: null;
192192
},
193193
labelColor: tooltipLabelColor(false),
194194
labelPointStyle: function () {
195195
return {
196196
pointStyle: "circle",
197197
};
198198
},
199-
labelTextColor: (item) => {
200-
return !item.raw ? colors.muted : "#fff";
201-
},
202199
},
203200
itemSort: function (a, b) {
204201
return b.datasetIndex - a.datasetIndex;
@@ -210,7 +207,13 @@ export default {
210207
stacked: true,
211208
border: { display: false },
212209
grid: { display: false },
213-
ticks: { color: colors.muted },
210+
ticks: {
211+
color: colors.muted,
212+
callback: (value) =>
213+
this.period === PERIODS.YEAR
214+
? this.fmtMonth(new Date(this.year, value, 1), true)
215+
: value,
216+
},
214217
},
215218
y: {
216219
stacked: true,

assets/js/components/Sessions/SessionTable.vue

+4-1
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,10 @@ export default {
189189
emits: ["show-session"],
190190
computed: {
191191
filteredSessions() {
192-
return this.sessions.filter(this.filterByLoadpoint).filter(this.filterByVehicle);
192+
return this.sessions
193+
.filter(this.filterByLoadpoint)
194+
.filter(this.filterByVehicle)
195+
.sort((a, b) => new Date(b.created) - new Date(a.created));
193196
},
194197
maxColumns() {
195198
return COLUMNS_PER_BREAKPOINT[this.breakpoint] || 1;

assets/js/mixins/formatter.js

+6
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,12 @@ export default {
236236
month: "short",
237237
}).format(date);
238238
},
239+
fmtDayOfMonth: function (date) {
240+
return new Intl.DateTimeFormat(this.$i18n?.locale, {
241+
weekday: "short",
242+
day: "numeric",
243+
}).format(date);
244+
},
239245
fmtMoney: function (amout = 0, currency = "EUR", decimals = true, withSymbol = false) {
240246
const currencyDisplay = withSymbol ? "narrowSymbol" : "code";
241247
const result = new Intl.NumberFormat(this.$i18n?.locale, {

assets/js/views/Sessions.vue

+1
Original file line numberDiff line numberDiff line change
@@ -682,6 +682,7 @@ export default {
682682
--vertical-shift: 0rem;
683683
left: 0;
684684
right: 0;
685+
top: max(0rem, env(safe-area-inset-top)) !important;
685686
margin: 0 calc(calc(1.5rem + var(--vertical-shift)) * -1);
686687
-webkit-backdrop-filter: blur(35px);
687688
backdrop-filter: blur(35px);

0 commit comments

Comments
 (0)