Skip to content

Commit 4e260c5

Browse files
feat: Fix, add, tweak various empty states across the app (#241)
* fix: add empty state to locations list * fix: add empty states for homepage lists * fix: add empty state to notifiers list * fix: update profile notifiers to use translation, add en and pt-pt copy * chore: tweak copy for notifier empty state * fix: add new empty state for search page * fix: update new empty states to use translation strings * chore: eslint fixes, translation * fix: translation key --------- Co-authored-by: Matt Kilgore <matthew@kilgore.dev>
1 parent 55a9355 commit 4e260c5

File tree

10 files changed

+46
-20
lines changed

10 files changed

+46
-20
lines changed

frontend/assets/css/main.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@
2727

2828
::-webkit-scrollbar-thumb:hover {
2929
background-color: #9B9B9B;
30-
}
30+
}

frontend/components/Base/Card.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div class="card bg-base-100 shadow-xl rounded-lg">
2+
<div class="card rounded-lg bg-base-100 shadow-xl">
33
<div v-if="$slots.title" class="px-4 py-5 sm:px-6">
44
<component :is="collapsable ? 'button' : 'div'" v-on="collapsable ? { click: toggle } : {}">
55
<h3 class="flex items-center text-lg font-medium leading-6">

frontend/components/Item/View/Selectable.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
<template v-else>
6060
<div class="grid grid-cols-1 gap-4 sm:grid-cols-2 md:grid-cols-3">
6161
<ItemCard v-for="item in items" :key="item.id" :item="item" />
62-
<div class="hidden text-lg first:block">{{ $t("components.item.view.selectable.no_items") }}</div>
62+
<div class="hidden first:block">{{ $t("components.item.view.selectable.no_items") }}</div>
6363
</div>
6464
</template>
6565
</section>

frontend/components/Location/Tree/Root.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111

1212
<template>
1313
<div class="root border-2 p-4">
14+
<p v-if="locs.length === 0" class="text-center text-sm">
15+
{{ $t("location.tree.no_locations") }}
16+
</p>
1417
<LocationTreeNode v-for="item in locs" :key="item.id" :item="item" :tree-id="treeId" />
1518
</div>
1619
</template>

frontend/locales/en.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@
3838
"location": {
3939
"create_modal": {
4040
"title": "Create Location"
41+
},
42+
"tree": {
43+
"no_locations": "No locations available. Add new locations through the\n `<`span class=\"link-primary\"`>`Create`<`/span`>` button on the navigation bar."
4144
}
4245
}
4346
},
@@ -75,6 +78,12 @@
7578
"set_password": "Set your password",
7679
"tagline": "Track, Organize, and Manage your Things."
7780
},
81+
"labels": {
82+
"no_results": "No Labels Found"
83+
},
84+
"locations": {
85+
"no_results": "No Locations Found"
86+
},
7887
"items": {
7988
"add": "Add",
8089
"created_at": "Created At",
@@ -162,6 +171,7 @@
162171
"notifier_modal": "{ type, select, true {Edit} false {Create} other {Other}} Notifier",
163172
"notifiers": "Notifiers",
164173
"notifiers_sub": "Get notifications for upcoming maintenance reminders",
174+
"no_notifiers": "No notifiers configured",
165175
"test": "Test",
166176
"theme_settings": "Theme Settings",
167177
"theme_settings_sub": "Theme settings are stored in your browser's local storage. You can change the theme at any time. If you're\n having trouble setting your theme try refreshing your browser.",

frontend/locales/pt-PT.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,12 @@
7575
"set_password": "Defina a sua senha",
7676
"tagline": "Acompanhe, organize e faça a gestão das suas coisas."
7777
},
78+
"labels": {
79+
"no_results": "Nenhuma etiqueta encontrada"
80+
},
81+
"locations": {
82+
"no_results": "Nenhuma localização encontrada"
83+
},
7884
"items": {
7985
"add": "Adicionar",
8086
"created_at": "Criado em",
@@ -139,6 +145,7 @@
139145
"notifier_modal": "{ type, select, true {Editar} false {Criar} other {Outro}} Notificador",
140146
"notifiers": "Notificadores",
141147
"notifiers_sub": "Receba notificações para os próximos lembretes de manutenção",
148+
"no_notifiers": "Nenhum notificador configurado",
142149
"test": "Testar",
143150
"theme_settings": "Definições do tema",
144151
"theme_settings_sub": "As configurações do tema são guardadas no armazenamento local do seu navegador. Pode alterar o tema em qualquer altura.\nSe encontrar algum problema com a alteração do tema, tente refrescar o browser.",

frontend/pages/home/index.vue

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,10 @@
3535
</section>
3636

3737
<section>
38-
<Subtitle> Recently Added </Subtitle>
38+
<Subtitle>Recently Added</Subtitle>
3939

40-
<BaseCard v-if="breakpoints.lg">
40+
<p v-if="itemTable.items.length === 0" class="ml-2 text-sm">{{ $t("items.no_results") }}</p>
41+
<BaseCard v-else-if="breakpoints.lg">
4142
<ItemViewTable :items="itemTable.items" disable-controls />
4243
</BaseCard>
4344
<div v-else class="grid grid-cols-1 gap-4 md:grid-cols-2">
@@ -47,14 +48,16 @@
4748

4849
<section>
4950
<Subtitle> Storage Locations </Subtitle>
50-
<div class="card grid grid-cols-1 gap-4 sm:grid-cols-2 md:grid-cols-3">
51+
<p v-if="locations.length === 0" class="ml-2 text-sm">{{ $t("locations.no_results") }}</p>
52+
<div v-else class="card grid grid-cols-1 gap-4 sm:grid-cols-2 md:grid-cols-3">
5153
<LocationCard v-for="location in locations" :key="location.id" :location="location" />
5254
</div>
5355
</section>
5456

5557
<section>
5658
<Subtitle> Labels </Subtitle>
57-
<div class="flex flex-wrap gap-4">
59+
<p v-if="labels.length === 0" class="ml-2 text-sm">{{ $t("labels.no_results") }}</p>
60+
<div v-else class="flex flex-wrap gap-4">
5861
<LabelChip v-for="label in labels" :key="label.id" size="lg" :label="label" class="shadow-md" />
5962
</div>
6063
</section>

frontend/pages/index.vue

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -180,12 +180,7 @@
180180
<a href="https://discord.gg/aY4DCkpNA9" class="tooltip" :data-tip="$t('global.join_discord')" target="_blank">
181181
<MdiDiscord class="size-8" />
182182
</a>
183-
<a
184-
href="https://homebox.software/en/"
185-
class="tooltip"
186-
:data-tip="$t('global.read_docs')"
187-
target="_blank"
188-
>
183+
<a href="https://homebox.software/en/" class="tooltip" :data-tip="$t('global.read_docs')" target="_blank">
189184
<MdiFolder class="size-8" />
190185
</a>
191186
</div>

frontend/pages/items.vue

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import { useLabelStore } from "~~/stores/labels";
44
import { useLocationStore } from "~~/stores/locations";
55
import MdiLoading from "~icons/mdi/loading";
6+
import MdiSelectSearch from "~icons/mdi/select-search";
67
import MdiMagnify from "~icons/mdi/magnify";
78
import MdiDelete from "~icons/mdi/delete";
89
import MdiChevronRight from "~icons/mdi/chevron-right";
@@ -463,15 +464,17 @@
463464

464465
<section class="mt-10">
465466
<BaseSectionHeader ref="itemsTitle"> {{ $t("global.items") }} </BaseSectionHeader>
466-
<p class="flex items-center text-base font-medium">
467+
<p v-if="items.length > 0" class="flex items-center text-base font-medium">
467468
{{ $t("items.results", { total: total }) }}
468469
<span class="ml-auto text-base"> {{ $t("items.pages", { page: page, totalPages: totalPages }) }} </span>
469470
</p>
470471

471-
<div ref="cardgrid" class="mt-4 grid grid-cols-1 gap-4 sm:grid-cols-2 md:grid-cols-3">
472+
<div v-if="items.length === 0" class="flex flex-col items-center gap-2">
473+
<MdiSelectSearch class="size-10" />
474+
<p>{{ $t("items.no_results") }}</p>
475+
</div>
476+
<div v-else ref="cardgrid" class="mt-4 grid grid-cols-1 gap-4 sm:grid-cols-2 md:grid-cols-3">
472477
<ItemCard v-for="item in items" :key="item.id" :item="item" />
473-
474-
<div class="hidden text-xl first:inline">{{ $t("items.no_results") }}</div>
475478
</div>
476479
<div v-if="items.length > 0 && (hasNext || hasPrev)" class="mt-10 flex flex-col items-center gap-2">
477480
<div class="flex">

frontend/pages/profile.vue

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@
372372
{{ token }}
373373
</div>
374374
</div>
375-
<div class="p-5 pt-0 form-control w-full">
375+
<div class="form-control w-full p-5 pt-0">
376376
<label class="label">
377377
<span class="label-text">{{ $t("profile.language") }}</span>
378378
</label>
@@ -397,7 +397,10 @@
397397
</template>
398398

399399
<div v-if="notifiers.data.value" class="mx-4 divide-y divide-gray-400 rounded-md border border-gray-400">
400-
<article v-for="n in notifiers.data.value" :key="n.id" class="p-2">
400+
<p v-if="notifiers.data.value.length === 0" class="p-2 text-center text-sm">
401+
{{ $t("profile.no_notifiers") }}
402+
</p>
403+
<article v-for="n in notifiers.data.value" v-else :key="n.id" class="p-2">
401404
<div class="flex flex-wrap items-center gap-2">
402405
<p class="mr-auto text-lg">{{ n.name }}</p>
403406
<div class="flex justify-end gap-2">
@@ -465,7 +468,9 @@
465468

466469
<div class="px-4 pb-4">
467470
<div class="mb-3">
468-
<BaseButton size="sm" @click="setDisplayHeader"> {{ $t("profile.display_header", { currentValue: preferences.displayHeaderDecor }) }} </BaseButton>
471+
<BaseButton size="sm" @click="setDisplayHeader">
472+
{{ $t("profile.display_header", { currentValue: preferences.displayHeaderDecor }) }}
473+
</BaseButton>
469474
</div>
470475
<div class="rounded-box grid grid-cols-1 gap-4 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5">
471476
<div

0 commit comments

Comments
 (0)