Skip to content

Commit

Permalink
Mobile UI: add active loadpoint indicator (#12973)
Browse files Browse the repository at this point in the history
  • Loading branch information
naltatis committed Mar 26, 2024
1 parent 2e59510 commit 87df042
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion assets/js/components/Loadpoints.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,24 @@
:class="{ 'indicator--selected': selected(index) }"
@click="scrollTo(index)"
>
<shopicon-filled-circle class="indicator-icon"></shopicon-filled-circle>
<shopicon-filled-lightning
v-if="isCharging(loadpoint)"
class="indicator-icon"
></shopicon-filled-lightning>
<shopicon-filled-circle
v-else-if="loadpoint.connected"
class="indicator-icon"
></shopicon-filled-circle>
<shopicon-bold-circle v-else class="indicator-icon"></shopicon-bold-circle>
</button>
</div>
</div>
</template>

<script>
import "@h2d2/shopicons/es/filled/circle";
import "@h2d2/shopicons/es/bold/circle";
import "@h2d2/shopicons/es/filled/lightning";
import Loadpoint from "./Loadpoint.vue";
Expand Down Expand Up @@ -73,6 +83,9 @@ export default {
const { offsetWidth } = this.$refs.carousel.children[0];
this.selectedIndex = Math.round((scrollLeft - 7.5) / offsetWidth);
},
isCharging(lp) {
return lp.charging && lp.chargePower > 0;
},
selected(index) {
return this.selectedIndex === index;
},
Expand Down

0 comments on commit 87df042

Please sign in to comment.