mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-12-05 23:54:25 +00:00
feat(webui): complete webui translations and integrate i18n
This commit is contained in:
@@ -4,6 +4,7 @@ import { useTeamContextStore } from '@/ui/stores/team-context'
|
||||
import { useMutation, useQuery, useSuspenseQuery } from '@tanstack/react-query'
|
||||
import { createFileRoute } from '@tanstack/react-router'
|
||||
import { useEffect } from 'react'
|
||||
import { m } from '@/ui/paraglide/messages.js'
|
||||
|
||||
const projectInfoQueryOptions = (projectId: string) => ({
|
||||
queryKey: ['projects', projectId],
|
||||
@@ -71,7 +72,7 @@ function CollectionPage() {
|
||||
})
|
||||
|
||||
if (!teamId || !rootFolderId || !rootFolder || !collection) {
|
||||
return <div>Loading collection...</div>
|
||||
return <div>{m.loading_collection()}</div>
|
||||
}
|
||||
|
||||
const sourceFolderId = collection.filter.sourceFolderId || rootFolderId
|
||||
@@ -94,5 +95,5 @@ export const Route = createFileRoute('/projects/$projectId/collections/$collecti
|
||||
component: CollectionPage,
|
||||
loader: ({ context: { queryClient }, params: { projectId } }) =>
|
||||
queryClient.ensureQueryData(projectInfoQueryOptions(projectId)),
|
||||
pendingComponent: () => <div>Loading collection...</div>,
|
||||
pendingComponent: () => <div>{m.loading_collection()}</div>,
|
||||
})
|
||||
|
||||
@@ -148,17 +148,19 @@ function CollectionsPage() {
|
||||
) : collections.length === 0 ? (
|
||||
<div className="flex flex-col items-center justify-center h-64 text-muted-foreground gap-3">
|
||||
<LayoutGrid className="h-10 w-10 text-muted-foreground/50" />
|
||||
<p>No collections created yet.</p>
|
||||
<p>{m.no_collections_yet()}</p>
|
||||
</div>
|
||||
) : (
|
||||
<div className="border border-border rounded-xl bg-background overflow-hidden shadow-xs">
|
||||
<Table>
|
||||
<TableHeader>
|
||||
<TableRow className="hover:bg-transparent bg-muted/20">
|
||||
<TableHead className="font-semibold px-4 py-3">Collection Name</TableHead>
|
||||
<TableHead className="font-semibold px-4 py-3">Creator</TableHead>
|
||||
<TableHead className="font-semibold px-4 py-3">
|
||||
{m.collection_name()}
|
||||
</TableHead>
|
||||
<TableHead className="font-semibold px-4 py-3">{m.creator()}</TableHead>
|
||||
<TableHead className="font-semibold px-4 py-3 w-[200px]">
|
||||
Created Date
|
||||
{m.created_date()}
|
||||
</TableHead>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
@@ -197,7 +199,7 @@ function CollectionsPage() {
|
||||
</AvatarFallback>
|
||||
</Avatar>
|
||||
<span className="text-sm font-medium text-foreground truncate max-w-[200px]">
|
||||
{collection.creator?.name || 'Unknown'}
|
||||
{collection.creator?.name || m.unknown()}
|
||||
</span>
|
||||
</div>
|
||||
</TableCell>
|
||||
|
||||
@@ -115,10 +115,10 @@ function SharesPage() {
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: ['shares', projectId] })
|
||||
toast.success('Share link status updated')
|
||||
toast.success(m.share_link_status_updated())
|
||||
},
|
||||
onError: (err) => {
|
||||
toast.error(`Error: ${err.message}`)
|
||||
toast.error(m.error_message({ message: err.message }))
|
||||
},
|
||||
})
|
||||
|
||||
@@ -129,7 +129,7 @@ function SharesPage() {
|
||||
const handleCopyLink = (shareId: string) => {
|
||||
const url = `${window.location.origin}/share/${shareId}`
|
||||
navigator.clipboard.writeText(url)
|
||||
toast.success('Link copied to clipboard')
|
||||
toast.success(m.link_copied())
|
||||
}
|
||||
|
||||
return (
|
||||
@@ -178,21 +178,21 @@ function SharesPage() {
|
||||
) : shares.length === 0 ? (
|
||||
<div className="flex flex-col items-center justify-center h-64 text-muted-foreground gap-3">
|
||||
<Link2 className="h-10 w-10 text-muted-foreground/50" />
|
||||
<p>No share links created yet.</p>
|
||||
<p>{m.no_share_links_yet()}</p>
|
||||
</div>
|
||||
) : (
|
||||
<div className="border border-border rounded-xl bg-background overflow-hidden shadow-xs">
|
||||
<Table>
|
||||
<TableHeader>
|
||||
<TableRow className="hover:bg-transparent bg-muted/20">
|
||||
<TableHead className="font-semibold px-4 py-3">Name</TableHead>
|
||||
<TableHead className="font-semibold px-4 py-3">Public Link</TableHead>
|
||||
<TableHead className="font-semibold px-4 py-3">Creator</TableHead>
|
||||
<TableHead className="font-semibold px-4 py-3">{m.name()}</TableHead>
|
||||
<TableHead className="font-semibold px-4 py-3">{m.public_link()}</TableHead>
|
||||
<TableHead className="font-semibold px-4 py-3">{m.creator()}</TableHead>
|
||||
<TableHead className="font-semibold px-4 py-3 w-[150px]">
|
||||
Created Date
|
||||
{m.created_date()}
|
||||
</TableHead>
|
||||
<TableHead className="font-semibold px-4 py-3 text-right w-[120px]">
|
||||
Active
|
||||
{m.active()}
|
||||
</TableHead>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
@@ -219,7 +219,7 @@ function SharesPage() {
|
||||
<span
|
||||
className="truncate text-xs font-mono bg-muted/50 text-muted-foreground px-2 py-1 rounded-md border border-border cursor-pointer hover:bg-muted transition-colors flex-1"
|
||||
onClick={() => handleCopyLink(share.id)}
|
||||
title="Click to copy link"
|
||||
title={m.click_to_copy_link()}
|
||||
>
|
||||
{shareUrl}
|
||||
</span>
|
||||
@@ -256,7 +256,7 @@ function SharesPage() {
|
||||
</AvatarFallback>
|
||||
</Avatar>
|
||||
<span className="text-sm font-medium text-foreground truncate max-w-[150px]">
|
||||
{share.creator?.name || 'Unknown'}
|
||||
{share.creator?.name || m.unknown()}
|
||||
</span>
|
||||
</div>
|
||||
</TableCell>
|
||||
|
||||
Reference in New Issue
Block a user