Skip to content

Commit

Permalink
webapp: show pin mapping categories as cards
Browse files Browse the repository at this point in the history
on a desktop browser, this approach allows to display all categories at
once. we also increase readability as the values are much closer to
their label. previously, the values were far to the right of the screen
and it was unpleasent to read which value belonged to which setting. the
grouping of values per category was also not very well conceived.

by using cards, we also avoid some styling issues, namely the use of
rowspan, which caused a spurious table cell border at the end of the old
table layout.
  • Loading branch information
schlimmchen authored and tbnobody committed Nov 1, 2024
1 parent f1c095e commit 71f312d
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 40 deletions.
1 change: 0 additions & 1 deletion lang/es.lang.json
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,6 @@
"LedBrightness": "Brillo del LED {led} ({brightness})"
},
"pininfo": {
"PinOverview": "Resumen de Conexiones",
"Category": "Categoría",
"Name": "Nombre",
"Number": "Número",
Expand Down
1 change: 0 additions & 1 deletion lang/it.lang.json
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,6 @@
"LedBrightness": "LED {led}, Luminosità ({brightness})"
},
"pininfo": {
"PinOverview": "Panoramica della Connessione",
"Category": "Categoria",
"Name": "Nome",
"Number": "Numero",
Expand Down
66 changes: 31 additions & 35 deletions webapp/src/components/PinInfo.vue
Original file line number Diff line number Diff line change
@@ -1,40 +1,36 @@
<template>
<CardElement :text="$t('pininfo.PinOverview')" textVariant="text-bg-primary" table>
<div class="table-responsive">
<table class="table table-hover table-condensed">
<thead>
<tr>
<th>{{ $t('pininfo.Category') }}</th>
<th>{{ $t('pininfo.Name') }}</th>
<th>{{ $t('pininfo.ValueSelected') }}</th>
<th>{{ $t('pininfo.ValueActive') }}</th>
</tr>
</thead>
<tbody>
<template v-for="category in categories" :key="category">
<tr v-for="(prop, prop_idx) in properties(category)" :key="prop">
<td v-if="prop_idx == 0" :rowspan="properties(category).length">
{{ capitalizeFirstLetter(category) }}
</td>
<td :class="{ 'table-danger': !isEqual(category, prop) }">
{{ prop }}
</td>
<td>
<template v-if="selectedPinAssignment && category in selectedPinAssignment">
{{ (selectedPinAssignment as any)[category][prop] }}</template
>
</td>
<td>
<template v-if="currentPinAssignment && category in currentPinAssignment">
{{ (currentPinAssignment as any)[category][prop] }}</template
>
</td>
</tr>
</template>
</tbody>
</table>
<div class="row flex-row flex-wrap g-3">
<div class="col" v-for="category in categories" :key="category">
<CardElement :text="capitalizeFirstLetter(category)" textVariant="text-bg-primary" table>
<div class="table-responsive">
<table class="table table-hover table-condensed">
<tbody>
<tr>
<th>{{ $t('pininfo.Name') }}</th>
<th class="text-center">{{ $t('pininfo.ValueSelected') }}</th>
<th class="text-center">{{ $t('pininfo.ValueActive') }}</th>
</tr>
<tr v-for="(prop, prop_idx) in properties(category)" :key="prop_idx">
<td :class="{ 'table-danger': !isEqual(category, prop) }">
{{ prop }}
</td>
<td class="text-center">
<template v-if="selectedPinAssignment && category in selectedPinAssignment">
{{ (selectedPinAssignment as any)[category][prop] }}</template
>
</td>
<td class="text-center">
<template v-if="currentPinAssignment && category in currentPinAssignment">
{{ (currentPinAssignment as any)[category][prop] }}</template
>
</td>
</tr>
</tbody>
</table>
</div>
</CardElement>
</div>
</CardElement>
</div>
</template>

<script lang="ts">
Expand Down
1 change: 0 additions & 1 deletion webapp/src/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,6 @@
"LedBrightness": "LED {led} Helligkeit ({brightness})"
},
"pininfo": {
"PinOverview": "Anschlussübersicht",
"Category": "Kategorie",
"Name": "Name",
"ValueSelected": "Ausgewählt",
Expand Down
1 change: 0 additions & 1 deletion webapp/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,6 @@
"LedBrightness": "LED {led} brightness ({brightness})"
},
"pininfo": {
"PinOverview": "Connection overview",
"Category": "Category",
"Name": "Name",
"Number": "Number",
Expand Down
1 change: 0 additions & 1 deletion webapp/src/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,6 @@
"LedBrightness": "LED {led} luminosité ({brightness})"
},
"pininfo": {
"PinOverview": "Vue d'ensemble des connexions",
"Category": "Catégorie",
"Name": "Nom",
"ValueSelected": "Sélectionné",
Expand Down

0 comments on commit 71f312d

Please sign in to comment.