feat: enhance navigation and content structure across chat and project components

This commit is contained in:
2025-09-05 12:51:25 +02:00
parent b140760cfe
commit addb63a792
13 changed files with 337 additions and 231 deletions

View File

@@ -80,6 +80,11 @@ function goHome() {
clearMessages()
router.push('/')
}
const route = useRoute()
function isRoute(name: string): boolean {
return route.path.includes(name) && route.name !== '/'
}
</script>
<template>
@@ -206,6 +211,40 @@ function goHome() {
@click.prevent="goHome"
/>
</UTooltip>
<UTooltip
v-if="isRoute('/projects')"
:text="t('palette.tooltip.writings')"
arrow
:content="toolTipContent"
:delay-duration="0"
>
<UButton
:label="t('palette.cmd.writings')"
variant="outline"
color="neutral"
size="xl"
icon="i-ph-books-duotone"
class="rounded-lg cursor-pointer p-2 w-full justify-center"
href="/writings"
/>
</UTooltip>
<UTooltip
v-if="isRoute('/writings')"
:text="t('palette.tooltip.projects')"
arrow
:content="toolTipContent"
:delay-duration="0"
>
<UButton
:label="t('palette.cmd.projects')"
variant="outline"
color="neutral"
size="xl"
icon="i-ph-code-duotone"
class="rounded-lg cursor-pointer p-2 w-full justify-center"
href="/projects"
/>
</UTooltip>
</UFieldGroup>
<ClientOnly>
<UFieldGroup class="flex items-center justify-center">

View File

@@ -19,7 +19,7 @@ const props = defineProps<{
message: ChatMessage
}>()
const { t, locale, locales } = useI18n()
const { locale, locales, t } = useI18n()
const currentLocale = computed(() => locales.value.find(l => l.code === locale.value))
const formatDate = computed(() => useDateFormat(props.message.createdAt, 'D MMMM YYYY, HH:mm', { locales: currentLocale.value?.code ?? 'en' }).value)
@@ -73,9 +73,31 @@ const dynamicComponent = computed(() => componentMap[props.message.type])
v-if="dynamicComponent"
:type="message.type"
/>
<div v-else-if="message.type === ChatType.INIT">
{{ t(message.content || '') }}
</div>
<i18n-t v-else-if="message.type === ChatType.INIT" :keypath="message.content || ''" tag="div">
<template #space>
<br>
</template>
<template #links>
<div class="inline-flex items-center gap-2 mb-2">
<UButton
:label="t('tool.projects.link')"
to="/projects"
icon="i-ph-code-duotone"
variant="outline"
size="sm"
class="cursor-pointer translate-y-1"
/>
<UButton
:label="t('tool.writings.link')"
to="/writings"
icon="i-ph-books-duotone"
variant="outline"
size="sm"
class="cursor-pointer translate-y-1"
/>
</div>
</template>
</i18n-t>
<div v-else>
{{ message }}
</div>