4 Commits

12 changed files with 69 additions and 9 deletions

View File

@@ -21,6 +21,7 @@ const { t } = useI18n()
const { createFileShare } = useMyAppShare() const { createFileShare } = useMyAppShare()
const { data } = useQuery({ const { data } = useQuery({
queryKey: ['create-share', ...props?.data?.files?.map((item) => item.id)], queryKey: ['create-share', ...props?.data?.files?.map((item) => item.id)],
staleTime: Infinity,
queryFn: async () => { queryFn: async () => {
const { files, config } = props?.data || {} const { files, config } = props?.data || {}
const data = await createFileShare({ const data = await createFileShare({

View File

@@ -5,6 +5,7 @@ import { Markdown } from 'tiptap-markdown'
import Placeholder from '@tiptap/extension-placeholder' import Placeholder from '@tiptap/extension-placeholder'
import { cx } from 'class-variance-authority' import { cx } from 'class-variance-authority'
import countWords from '@/lib/countWords' import countWords from '@/lib/countWords'
const { t } = useI18n()
const props = defineProps<{ const props = defineProps<{
modelValue?: string modelValue?: string
@@ -64,6 +65,6 @@ onUnmounted(() => {
v-if="modelValue?.length && modelValue?.length > 0" v-if="modelValue?.length && modelValue?.length > 0"
class="absolute bottom-2 right-3 flex justify-end px-2 py-1 text-xs text-gray-400 select-none bg-white rounded-md" class="absolute bottom-2 right-3 flex justify-end px-2 py-1 text-xs text-gray-400 select-none bg-white rounded-md"
> >
{{ `${modelValue?.length ?? 0} 长度 · ${countWords(modelValue ?? '')} 字符` }} {{ `${modelValue?.length ?? 0} ${t('common.length')} · ${countWords(modelValue ?? '')} ${t('common.words')}` }}
</div> </div>
</template> </template>

View File

@@ -0,0 +1,43 @@
<script lang="ts" setup>
import type { ToasterProps } from 'vue-sonner'
import 'vue-sonner/style.css'
import { CircleCheckIcon, InfoIcon, Loader2Icon, OctagonXIcon, TriangleAlertIcon, XIcon } from '@lucide/vue'
import { Toaster as Sonner } from 'vue-sonner'
import { cn } from '@/lib/utils'
const props = defineProps<ToasterProps>()
</script>
<template>
<Sonner
:class="cn('toaster group', props.class)"
:style="{
'--normal-bg': 'var(--popover)',
'--normal-text': 'var(--popover-foreground)',
'--normal-border': 'var(--border)',
'--border-radius': 'var(--radius)',
}"
v-bind="props"
>
<template #success-icon>
<CircleCheckIcon class="size-4" />
</template>
<template #info-icon>
<InfoIcon class="size-4" />
</template>
<template #warning-icon>
<TriangleAlertIcon class="size-4" />
</template>
<template #error-icon>
<OctagonXIcon class="size-4" />
</template>
<template #loading-icon>
<div>
<Loader2Icon class="size-4 animate-spin" />
</div>
</template>
<template #close-icon>
<XIcon class="size-4" />
</template>
</Sonner>
</template>

View File

@@ -0,0 +1 @@
export { default as Toaster } from './Sonner.vue'

View File

@@ -38,7 +38,9 @@
}, },
"common": { "common": {
"add": "Hinzufügen", "add": "Hinzufügen",
"copySuccess": "Erfolgreich kopiert" "copySuccess": "Erfolgreich kopiert",
"length": "Länge",
"words": "Wörter"
}, },
"page": { "page": {
"upload": { "upload": {

View File

@@ -38,7 +38,9 @@
}, },
"common": { "common": {
"add": "Add", "add": "Add",
"copySuccess": "Copy Success" "copySuccess": "Copy Success",
"length": "length",
"words": "words"
}, },
"page": { "page": {
"upload": { "upload": {

View File

@@ -38,7 +38,9 @@
}, },
"common": { "common": {
"add": "Ajouter", "add": "Ajouter",
"copySuccess": "Copié avec succès" "copySuccess": "Copié avec succès",
"length": "longueur",
"words": "mots"
}, },
"page": { "page": {
"upload": { "upload": {

View File

@@ -38,7 +38,9 @@
}, },
"common": { "common": {
"add": "追加", "add": "追加",
"copySuccess": "コピーしました" "copySuccess": "コピーしました",
"length": "長さ",
"words": "文字"
}, },
"page": { "page": {
"upload": { "upload": {

View File

@@ -38,7 +38,9 @@
}, },
"common": { "common": {
"add": "추가", "add": "추가",
"copySuccess": "복사되었습니다" "copySuccess": "복사되었습니다",
"length": "길이",
"words": "단어"
}, },
"page": { "page": {
"upload": { "upload": {

View File

@@ -38,7 +38,9 @@
}, },
"common": { "common": {
"add": "添加", "add": "添加",
"copySuccess": "复制成功" "copySuccess": "复制成功",
"length": "长度",
"words": "字符"
}, },
"page": { "page": {
"upload": { "upload": {

View File

@@ -38,7 +38,9 @@
}, },
"common": { "common": {
"add": "新增", "add": "新增",
"copySuccess": "複製成功" "copySuccess": "複製成功",
"length": "長度",
"words": "字符"
}, },
"page": { "page": {
"upload": { "upload": {

View File

@@ -1,5 +1,5 @@
<script lang="ts" setup> <script lang="ts" setup>
import { Toaster } from 'vue-sonner' import { Toaster } from '@/components/ui/sonner'
const { locale } = useI18n() const { locale } = useI18n()
await useSeo({ locale: locale.value }) await useSeo({ locale: locale.value })
const appConfig = useMyAppConfig() const appConfig = useMyAppConfig()