A continuation of HomeBox the inventory and organization system built for the Home User
fix: location tree with no locations message
tonyaellie2a43ee1840cd
diff --git a/frontend/components/Location/Tree/Root.vue b/frontend/components/Location/Tree/Root.vueindex 445f7bf3..b61f86fb 100644--- a/frontend/components/Location/Tree/Root.vue+++ b/frontend/components/Location/Tree/Root.vue@@ -1,12 +1,17 @@<script setup lang="ts">import type { TreeItem } from "~~/lib/api/types/data-contracts";import LocationTreeNode from "./Node.vue";+ import { Button } from "~~/components/ui/button";+ import { useDialog } from "~/components/ui/dialog-provider";+ import { DialogID } from "~/components/ui/dialog-provider/utils";type Props = {locs: TreeItem[];treeId: string;};+ const { openDialog } = useDialog();+const props = defineProps<Props>();const collator = new Intl.Collator(undefined, { numeric: true, sensitivity: "base" });@@ -19,9 +24,31 @@<template><div>- <p v-if="sortedLocs.length === 0" class="text-center text-sm">- {{ $t("location.tree.no_locations") }}- </p>- <LocationTreeNode v-for="item in sortedLocs" :key="item.id" :item="item" :tree-id="treeId" />+ <div+ v-if="sortedLocs.length === 0"+ class="py-6 text-center text-sm text-muted-foreground"+ role="status"+ aria-live="polite"+ >+ <p class="mx-auto max-w-xs">+ {{ $t("components.location.tree.no_locations") }}+ </p>+ <Button+ class="mt-3"+ variant="outline"+ size="sm"+ type="button"+ :aria-label="$t('components.location.create_modal.title') || $t('global.create')"+ @click="openDialog(DialogID.CreateLocation)"+ >+ {{ $t("components.location.create_modal.title") || $t("global.create") }}+ </Button>+ </div>++ <ul role="tree" :aria-labelledby="treeId" class="space-y-1">+ <li v-for="item in sortedLocs" :key="item.id" role="treeitem">+ <LocationTreeNode :item="item" :tree-id="treeId" />+ </li>+ </ul></div></template>diff --git a/frontend/locales/en.json b/frontend/locales/en.jsonindex ed969fde..d0721f88 100644--- a/frontend/locales/en.json+++ b/frontend/locales/en.json@@ -226,7 +226,7 @@"clear": "Clear Location Selection"},"tree": {- "no_locations": "No locations available. Add new locations through the\n '<span class=\"link-primary\">'Create'</span>' button on the navigation bar."+ "no_locations": "No locations available. Use the Create button to add a new location."}},"quick_menu": {