i18n: AppSidebar + NavUser traducidos
This commit is contained in:
@@ -5,6 +5,7 @@ import {
|
|||||||
Clock,
|
Clock,
|
||||||
ChevronRight,
|
ChevronRight,
|
||||||
} from 'lucide-vue-next'
|
} from 'lucide-vue-next'
|
||||||
|
import { useI18n } from 'vue-i18n'
|
||||||
import {
|
import {
|
||||||
Sidebar,
|
Sidebar,
|
||||||
SidebarContent,
|
SidebarContent,
|
||||||
@@ -28,6 +29,8 @@ defineProps<{
|
|||||||
activeTab: string
|
activeTab: string
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
|
const { t } = useI18n()
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
'update:activeTab': [value: string]
|
'update:activeTab': [value: string]
|
||||||
}>()
|
}>()
|
||||||
@@ -45,36 +48,36 @@ function setTab(tab: string) {
|
|||||||
|
|
||||||
<SidebarContent>
|
<SidebarContent>
|
||||||
<SidebarGroup>
|
<SidebarGroup>
|
||||||
<SidebarGroupLabel>Navegación</SidebarGroupLabel>
|
<SidebarGroupLabel>{{ t('sidebar.navigation') }}</SidebarGroupLabel>
|
||||||
<SidebarMenu>
|
<SidebarMenu>
|
||||||
<SidebarMenuItem>
|
<SidebarMenuItem>
|
||||||
<SidebarMenuButton
|
<SidebarMenuButton
|
||||||
:is-active="activeTab === 'dashboard'"
|
:is-active="activeTab === 'dashboard'"
|
||||||
:tooltip="'Diagnóstico'"
|
:tooltip="t('sidebar.diagnosis')"
|
||||||
@click="setTab('dashboard')"
|
@click="setTab('dashboard')"
|
||||||
>
|
>
|
||||||
<LayoutDashboard />
|
<LayoutDashboard />
|
||||||
<span>Diagnóstico</span>
|
<span>{{ t('sidebar.diagnosis') }}</span>
|
||||||
</SidebarMenuButton>
|
</SidebarMenuButton>
|
||||||
</SidebarMenuItem>
|
</SidebarMenuItem>
|
||||||
<SidebarMenuItem>
|
<SidebarMenuItem>
|
||||||
<SidebarMenuButton
|
<SidebarMenuButton
|
||||||
:is-active="activeTab === 'calendar'"
|
:is-active="activeTab === 'calendar'"
|
||||||
:tooltip="'Calendario'"
|
:tooltip="t('sidebar.calendar')"
|
||||||
@click="setTab('calendar')"
|
@click="setTab('calendar')"
|
||||||
>
|
>
|
||||||
<Calendar />
|
<Calendar />
|
||||||
<span>Calendario</span>
|
<span>{{ t('sidebar.calendar') }}</span>
|
||||||
</SidebarMenuButton>
|
</SidebarMenuButton>
|
||||||
</SidebarMenuItem>
|
</SidebarMenuItem>
|
||||||
<SidebarMenuItem>
|
<SidebarMenuItem>
|
||||||
<SidebarMenuButton
|
<SidebarMenuButton
|
||||||
:is-active="activeTab === 'scheduler'"
|
:is-active="activeTab === 'scheduler'"
|
||||||
:tooltip="'Recetas'"
|
:tooltip="t('sidebar.scheduler')"
|
||||||
@click="setTab('scheduler')"
|
@click="setTab('scheduler')"
|
||||||
>
|
>
|
||||||
<Clock />
|
<Clock />
|
||||||
<span>Recetas</span>
|
<span>{{ t('sidebar.scheduler') }}</span>
|
||||||
</SidebarMenuButton>
|
</SidebarMenuButton>
|
||||||
</SidebarMenuItem>
|
</SidebarMenuItem>
|
||||||
</SidebarMenu>
|
</SidebarMenu>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useAuthStore } from '@/stores/auth'
|
import { useAuthStore } from '@/stores/auth'
|
||||||
|
import { useI18n } from 'vue-i18n'
|
||||||
import {
|
import {
|
||||||
ChevronsUpDown,
|
ChevronsUpDown,
|
||||||
LogOut,
|
LogOut,
|
||||||
@@ -19,6 +20,7 @@ import {
|
|||||||
} from '@/components/ui/sidebar'
|
} from '@/components/ui/sidebar'
|
||||||
|
|
||||||
const auth = useAuthStore()
|
const auth = useAuthStore()
|
||||||
|
const { t } = useI18n()
|
||||||
const { isMobile } = useSidebar()
|
const { isMobile } = useSidebar()
|
||||||
|
|
||||||
const initials = (auth.user?.name || 'U').split(' ').map(n => n[0]).join('').slice(0, 2).toUpperCase()
|
const initials = (auth.user?.name || 'U').split(' ').map(n => n[0]).join('').slice(0, 2).toUpperCase()
|
||||||
@@ -35,11 +37,11 @@ const avatarSrc = '/Evil_Morty_Profile_Icon.webp'
|
|||||||
class="data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground"
|
class="data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground"
|
||||||
>
|
>
|
||||||
<Avatar class="h-8 w-8 rounded-lg grayscale">
|
<Avatar class="h-8 w-8 rounded-lg grayscale">
|
||||||
<AvatarImage :src="avatarSrc" :alt="auth.user?.name || 'Usuario'" />
|
<AvatarImage :src="avatarSrc" :alt="auth.user?.name || t('sidebar.userAlt')" />
|
||||||
<AvatarFallback class="rounded-lg">{{ initials }}</AvatarFallback>
|
<AvatarFallback class="rounded-lg">{{ initials }}</AvatarFallback>
|
||||||
</Avatar>
|
</Avatar>
|
||||||
<div class="grid flex-1 text-left text-sm leading-tight">
|
<div class="grid flex-1 text-left text-sm leading-tight">
|
||||||
<span class="truncate font-medium">{{ auth.user?.name || 'Usuario' }}</span>
|
<span class="truncate font-medium">{{ auth.user?.name || t('sidebar.userFallback') }}</span>
|
||||||
<span class="truncate text-xs text-muted-foreground">{{ auth.user?.email }}</span>
|
<span class="truncate text-xs text-muted-foreground">{{ auth.user?.email }}</span>
|
||||||
</div>
|
</div>
|
||||||
<ChevronsUpDown class="ml-auto size-4" />
|
<ChevronsUpDown class="ml-auto size-4" />
|
||||||
@@ -53,7 +55,7 @@ const avatarSrc = '/Evil_Morty_Profile_Icon.webp'
|
|||||||
>
|
>
|
||||||
<DropdownMenuItem class="gap-2 text-muted-foreground" @click="auth.logout()">
|
<DropdownMenuItem class="gap-2 text-muted-foreground" @click="auth.logout()">
|
||||||
<LogOut class="size-4" />
|
<LogOut class="size-4" />
|
||||||
Cerrar sesión
|
{{ t('sidebar.logout') }}
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
</DropdownMenuContent>
|
</DropdownMenuContent>
|
||||||
</DropdownMenu>
|
</DropdownMenu>
|
||||||
|
|||||||
Reference in New Issue
Block a user