From 9fece8f54f463704a9801d85fa048e6d76b81e34 Mon Sep 17 00:00:00 2001 From: xiaomai Date: Fri, 1 May 2026 14:31:29 +0800 Subject: [PATCH] feat(ui): add icons to navigation and UI components Integrate @iconify/vue for consistent iconography across the app Enhance buttons, entity cards, and status messages with visual indicators --- frontend/src/App.vue | 13 +-- frontend/src/components/AppShell.vue | 22 +++-- frontend/src/components/EntityCard.vue | 9 +- frontend/src/components/Modal.vue | 4 +- frontend/src/components/ReorderableList.vue | 4 +- frontend/src/components/StatusMessage.vue | 11 ++- frontend/src/components/TagsSelect.vue | 11 ++- frontend/src/icons.ts | 28 ++++++ frontend/src/styles/main.css | 64 +++++++++++--- frontend/src/views/AdminView.vue | 98 ++++++++++++++++++--- frontend/src/views/HabitatDetail.vue | 12 ++- frontend/src/views/HabitatEdit.vue | 28 ++++-- frontend/src/views/HabitatList.vue | 9 +- frontend/src/views/ItemDetail.vue | 13 ++- frontend/src/views/ItemEdit.vue | 12 ++- frontend/src/views/ItemsList.vue | 9 +- frontend/src/views/LoginView.vue | 3 + frontend/src/views/PokemonDetail.vue | 12 ++- frontend/src/views/PokemonEdit.vue | 12 ++- frontend/src/views/PokemonList.vue | 7 +- frontend/src/views/RecipeDetail.vue | 12 ++- frontend/src/views/RecipeEdit.vue | 22 ++++- frontend/src/views/RecipeList.vue | 16 ++-- frontend/src/views/RegisterView.vue | 3 + frontend/src/views/VerifyEmailView.vue | 7 +- 25 files changed, 361 insertions(+), 80 deletions(-) create mode 100644 frontend/src/icons.ts diff --git a/frontend/src/App.vue b/frontend/src/App.vue index b76d5f6..4207998 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -3,6 +3,7 @@ import { computed, onMounted, onUnmounted, ref } from 'vue'; import { useI18n } from 'vue-i18n'; import { useRouter } from 'vue-router'; import AppShell from './components/AppShell.vue'; +import { iconAdmin, iconChecklist, iconHabitat, iconItem, iconPokemon, iconRecipe } from './icons'; import { getCurrentLocale, onLocaleChange, setCurrentLocale } from './i18n'; import { api, getAuthToken, onAuthTokenChange, setAuthToken, type AuthUser, type Language } from './services/api'; @@ -18,12 +19,12 @@ let removeAuthListener: (() => void) | null = null; let removeLocaleListener: (() => void) | null = null; const navItems = computed(() => [ - { label: t('nav.pokemon'), to: '/pokemon' }, - { label: t('nav.habitats'), to: '/habitats' }, - { label: t('nav.items'), to: '/items' }, - { label: t('nav.recipes'), to: '/recipes' }, - { label: t('nav.checklist'), to: '/checklist' }, - { label: t('nav.admin'), to: '/admin' } + { label: t('nav.pokemon'), to: '/pokemon', icon: iconPokemon }, + { label: t('nav.habitats'), to: '/habitats', icon: iconHabitat }, + { label: t('nav.items'), to: '/items', icon: iconItem }, + { label: t('nav.recipes'), to: '/recipes', icon: iconRecipe }, + { label: t('nav.checklist'), to: '/checklist', icon: iconChecklist }, + { label: t('nav.admin'), to: '/admin', icon: iconAdmin } ]); async function loadCurrentUser() { diff --git a/frontend/src/components/AppShell.vue b/frontend/src/components/AppShell.vue index 43a46ee..9df9c26 100644 --- a/frontend/src/components/AppShell.vue +++ b/frontend/src/components/AppShell.vue @@ -2,6 +2,7 @@ import { Icon } from '@iconify/vue'; import { onBeforeUnmount, onMounted, ref } from 'vue'; import { useI18n } from 'vue-i18n'; +import { iconLogin, iconLogout, iconRegister, iconTranslate, type AppIcon } from '../icons'; import type { AuthUser, Language } from '../services/api'; import PokeBallMark from './PokeBallMark.vue'; @@ -9,7 +10,7 @@ defineProps<{ currentUser: AuthUser | null; languages: Language[]; locale: string; - navItems: Array<{ label: string; to: string }>; + navItems: Array<{ label: string; to: string; icon?: AppIcon }>; }>(); const emit = defineEmits<{ @@ -18,11 +19,6 @@ const emit = defineEmits<{ }>(); const { t } = useI18n(); -const translateIcon = { - width: 24, - height: 24, - body: '' -}; const languageMenu = ref(null); const languageMenuButton = ref(null); const languageMenuOpen = ref(false); @@ -78,6 +74,7 @@ onBeforeUnmount(() => { @@ -93,7 +90,7 @@ onBeforeUnmount(() => { aria-haspopup="menu" @click="toggleLanguageMenu" > -