feat(webui): complete webui translations and integrate i18n

This commit is contained in:
yiling
2026-06-27 10:12:07 +08:00
parent 914855a25c
commit 5c21463075
1420 changed files with 43252 additions and 460 deletions
+15 -24
View File
@@ -1,6 +1,7 @@
import { ShumaiLogo } from '@/ui/components/ui/icons'
import { CheckCircle2 } from 'lucide-react'
import { ReactNode } from 'react'
import { m } from '@/ui/paraglide/messages.js'
export function AuthLayout({ children }: { children: ReactNode }) {
return (
@@ -27,41 +28,31 @@ export function AuthLayout({ children }: { children: ReactNode }) {
{/* Marketing Copy / Feature Points */}
<div className="relative my-8 md:my-0 space-y-6">
<h2 className="text-3xl font-extrabold tracking-tight leading-tight text-zinc-900 dark:text-zinc-50">
One workspace
<br />
for all your
<br />
<span className="bg-gradient-to-r from-rose-500 to-orange-500 bg-clip-text text-transparent">
creative assets.
</span>
{m.auth_tagline()}
</h2>
<p className="text-zinc-600 dark:text-zinc-400 text-sm leading-relaxed max-w-sm">
Upload and index your files, enrich them with custom metadata schemas, draw
annotations directly on media, and gather instant feedback — all in one modern
workspace built for creators.
{m.auth_description()}
</p>
<ul className="space-y-3.5 pt-4">
{[
'Instant asset uploads & high-fidelity media players',
'Custom metadata schemas & drawing canvas reviews',
'Frictionless team workspaces & secure sharing',
].map((text, i) => (
<li
key={i}
className="flex items-center gap-3 text-sm text-zinc-700 dark:text-zinc-300 font-medium"
>
<CheckCircle2 className="w-5 h-5 text-rose-500 flex-shrink-0" />
<span>{text}</span>
</li>
))}
{[m.auth_feature_uploads(), m.auth_feature_metadata(), m.auth_feature_teams()].map(
(text, i) => (
<li
key={i}
className="flex items-center gap-3 text-sm text-zinc-700 dark:text-zinc-300 font-medium"
>
<CheckCircle2 className="w-5 h-5 text-rose-500 flex-shrink-0" />
<span>{text}</span>
</li>
),
)}
</ul>
</div>
{/* Footer Label */}
<div className="relative pt-4 border-t border-zinc-200/30 dark:border-zinc-800/30">
<p className="text-xs text-zinc-500 dark:text-zinc-400 font-medium">
Join our community of developers and designers.
{m.auth_community_cta()}
</p>
</div>
</div>
@@ -23,6 +23,7 @@ import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'
import { useForm, useStore } from '@tanstack/react-form'
import { Loader2, Puzzle } from 'lucide-react'
import { useEffect, useMemo } from 'react'
import { m } from '@/ui/paraglide/messages.js'
import { toast } from 'sonner'
import { AgentInfo, AgentType, ThinkingLevel, thinkingLevelSchema } from '@shumai/dtos'
import { Textarea } from '@/ui/components/ui/textarea'
@@ -41,7 +42,7 @@ interface AgentFormDialogProps {
}
const agentFormSchema = z.object({
name: z.string().min(1, 'Name is required'),
name: z.string().min(1, m.name_is_required()),
type: z.enum(['chat', 'autofill', 'embedding']),
avatar: z.string().optional(),
providerId: z.string().optional(),
@@ -98,14 +99,14 @@ export function AgentFormDialog({
if (!data.providerId) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'Provider is required',
message: m.provider_is_required(),
path: ['providerId'],
})
}
if (!data.modelId) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'Model is required',
message: m.model_is_required(),
path: ['modelId'],
})
}
@@ -167,10 +168,10 @@ export function AgentFormDialog({
onSuccess: () => {
onClose()
queryClient.invalidateQueries({ queryKey: ['agents', teamId] })
toast.success('Agent created successfully')
toast.success(m.agent_created_successfully())
},
onError: (error) => {
toast.error(`Error: ${error.message}`)
toast.error(m.error_message({ message: error.message }))
},
})
@@ -186,10 +187,10 @@ export function AgentFormDialog({
onSuccess: () => {
onClose()
queryClient.invalidateQueries({ queryKey: ['agents', teamId] })
toast.success('Agent updated successfully')
toast.success(m.agent_updated_successfully())
},
onError: (error) => {
toast.error(`Error: ${error.message}`)
toast.error(m.error_message({ message: error.message }))
},
})
@@ -217,9 +218,7 @@ export function AgentFormDialog({
<DialogContent className="sm:max-w-3xl h-[90vh] flex flex-col p-0 overflow-hidden">
<DialogHeader className="p-6 pb-2 flex-shrink-0">
<DialogTitle>{title}</DialogTitle>
<DialogDescription>
Configure your AI agent's personality and capabilities.
</DialogDescription>
<DialogDescription>{m.configure_agent_description()}</DialogDescription>
</DialogHeader>
<form
@@ -239,12 +238,12 @@ export function AgentFormDialog({
const isInvalid = !!field.state.meta.errors.length && field.state.meta.isTouched
return (
<Field data-invalid={isInvalid}>
<FieldLabel>Agent Name</FieldLabel>
<FieldLabel>{m.agent_name()}</FieldLabel>
<Input
value={field.state.value}
onBlur={field.handleBlur}
onChange={(e) => field.handleChange(e.target.value)}
placeholder="e.g., Support Assistant"
placeholder={m.agent_name_placeholder()}
aria-invalid={isInvalid}
/>
{isInvalid && <FieldError errors={mapErrors(field.state.meta.errors)} />}
@@ -257,7 +256,7 @@ export function AgentFormDialog({
name="type"
children={(field) => (
<Field>
<FieldLabel>Agent Type</FieldLabel>
<FieldLabel>{m.agent_type()}</FieldLabel>
<Select
value={field.state.value}
onValueChange={(val) => field.handleChange(val as AgentType)}
@@ -267,9 +266,9 @@ export function AgentFormDialog({
<SelectValue />
</SelectTrigger>
<SelectContent>
<SelectItem value="chat">Chat</SelectItem>
<SelectItem value="autofill">Autofill</SelectItem>
<SelectItem value="embedding">Embedding</SelectItem>
<SelectItem value="chat">{m.agent_type_chat()}</SelectItem>
<SelectItem value="autofill">{m.agent_type_autofill()}</SelectItem>
<SelectItem value="embedding">{m.agent_type_embedding()}</SelectItem>
</SelectContent>
</Select>
</Field>
@@ -280,7 +279,7 @@ export function AgentFormDialog({
name="avatar"
children={(field) => (
<Field className="md:col-span-2">
<FieldLabel>Agent Avatar</FieldLabel>
<FieldLabel>{m.agent_avatar()}</FieldLabel>
<div className="flex gap-4 mt-2">
{AVAILABLE_AVATARS.map((avatarPath) => {
const isSelected = field.state.value === avatarPath
@@ -299,7 +298,7 @@ export function AgentFormDialog({
<img
src={avatarPath}
className="w-full h-full object-cover"
alt="Preset Avatar Option"
alt={m.preset_avatar_option()}
/>
</button>
)
@@ -312,7 +311,7 @@ export function AgentFormDialog({
<img
src={field.state.value}
className="w-full h-full object-cover"
alt="Current Custom Avatar"
alt={m.current_custom_avatar()}
/>
</button>
)}
@@ -332,7 +331,7 @@ export function AgentFormDialog({
!!field.state.meta.errors.length && field.state.meta.isTouched
return (
<Field data-invalid={isInvalid}>
<FieldLabel>Provider</FieldLabel>
<FieldLabel>{m.provider()}</FieldLabel>
<Select
value={field.state.value}
onValueChange={(val) => {
@@ -341,7 +340,7 @@ export function AgentFormDialog({
}}
>
<SelectTrigger aria-invalid={isInvalid}>
<SelectValue placeholder="Select Provider" />
<SelectValue placeholder={m.select_provider()} />
</SelectTrigger>
<SelectContent>
{providers?.map((p) => (
@@ -367,7 +366,7 @@ export function AgentFormDialog({
return (
<Field data-invalid={isInvalid}>
<FieldLabel className="flex items-center gap-2">
Model
{m.model()}
{isModelsLoading && <Loader2 className="w-3 h-3 animate-spin" />}
</FieldLabel>
<Select
@@ -376,7 +375,7 @@ export function AgentFormDialog({
disabled={!selectedProviderId || isModelsLoading}
>
<SelectTrigger aria-invalid={isInvalid}>
<SelectValue placeholder="Select Model" />
<SelectValue placeholder={m.select_model()} />
</SelectTrigger>
<SelectContent>
{models?.map((m) => (
@@ -397,26 +396,34 @@ export function AgentFormDialog({
<div className="md:col-span-2">
<form.Field
name="thinkingLevel"
children={(field) => (
<Field>
<FieldLabel>Thinking Level</FieldLabel>
<Select
value={field.state.value}
onValueChange={(val) => field.handleChange(val as ThinkingLevel)}
>
<SelectTrigger>
<SelectValue />
</SelectTrigger>
<SelectContent>
{thinkingLevelSchema.options.map((level) => (
<SelectItem key={level} value={level}>
{level.charAt(0).toUpperCase() + level.slice(1)}
</SelectItem>
))}
</SelectContent>
</Select>
</Field>
)}
children={(field) => {
const thinkingLabels: Record<string, string> = {
off: m.thinking_disable(),
low: m.thinking_low(),
medium: m.thinking_medium(),
high: m.thinking_high(),
}
return (
<Field>
<FieldLabel>{m.thinking_level()}</FieldLabel>
<Select
value={field.state.value}
onValueChange={(val) => field.handleChange(val as ThinkingLevel)}
>
<SelectTrigger>
<SelectValue />
</SelectTrigger>
<SelectContent>
{thinkingLevelSchema.options.map((level) => (
<SelectItem key={level} value={level}>
{thinkingLabels[level] || level}
</SelectItem>
))}
</SelectContent>
</Select>
</Field>
)
}}
/>
</div>
</div>
@@ -425,12 +432,12 @@ export function AgentFormDialog({
name="soul"
children={(field) => (
<Field>
<FieldLabel>Agent Soul (Personality)</FieldLabel>
<FieldLabel>{m.agent_soul()}</FieldLabel>
<Textarea
value={field.state.value}
onBlur={field.handleBlur}
onChange={(e) => field.handleChange(e.target.value)}
placeholder="Describe the agent's personality, tone, and behavior..."
placeholder={m.agent_soul_placeholder()}
className="min-h-[120px]"
/>
</Field>
@@ -440,7 +447,7 @@ export function AgentFormDialog({
<div className="space-y-4">
<Label className="text-base font-bold flex items-center gap-2">
<Puzzle className="w-5 h-5 text-primary" />
Skills
{m.skills()}
</Label>
<div className="space-y-2">
@@ -468,7 +475,7 @@ export function AgentFormDialog({
</div>
<div className="flex items-center gap-2">
<span className="text-xs text-muted-foreground">
{isEnabled ? 'Enabled' : 'Disabled'}
{isEnabled ? m.enabled() : m.disabled()}
</span>
<Switch
checked={isEnabled}
@@ -494,7 +501,7 @@ export function AgentFormDialog({
{allSkills.length === 0 && (
<div className="text-center py-8 border-2 border-dashed border-border rounded-xl">
<p className="text-sm text-muted-foreground">
No skills available.
{m.no_skills_available()}
</p>
</div>
)}
@@ -510,7 +517,7 @@ export function AgentFormDialog({
<DialogFooter className="p-6 pt-4 border-t border-border flex-shrink-0">
<Button variant="outline" onClick={onClose} type="button">
Cancel
{m.cancel()}
</Button>
<form.Subscribe
selector={(state) => [state.canSubmit, state.isSubmitting]}
@@ -528,7 +535,7 @@ export function AgentFormDialog({
{(isSubmitting || createMutation.isPending || updateMutation.isPending) && (
<Loader2 className="w-4 h-4 animate-spin mr-2" />
)}
{initialValues ? 'Save Changes' : 'Create Agent'}
{initialValues ? m.save_changes() : m.create_agent()}
</Button>
)}
/>
@@ -37,6 +37,7 @@ import {
import { cn } from '@/ui/lib/utils'
import { ChevronDown } from 'lucide-react'
import { Switch } from '@/ui/components/ui/switch'
import { m } from '@/ui/paraglide/messages.js'
interface AgentsSettingsProps {
teamId: string
@@ -65,6 +66,12 @@ export function AgentsSettings({ teamId }: AgentsSettingsProps) {
embedding: true,
})
const getSectionLabel = (type: AgentType) => {
if (type === 'chat') return m.agent_type_chat()
if (type === 'autofill') return m.agent_type_autofill()
return m.agent_type_embedding()
}
const { data: agents = [], isLoading } = useQuery({
queryKey: ['agents', teamId],
queryFn: async () => {
@@ -87,7 +94,7 @@ export function AgentsSettings({ teamId }: AgentsSettingsProps) {
onSuccess: () => {
setIsDeleteDialogOpen(false)
queryClient.invalidateQueries({ queryKey: ['agents', teamId] })
toast.success('Agent deleted successfully')
toast.success(m.agent_deleted_successfully())
},
onError: (error) => {
toast.error(error.message)
@@ -129,7 +136,7 @@ export function AgentsSettings({ teamId }: AgentsSettingsProps) {
},
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ['agents', teamId] })
toast.success('Agent updated successfully')
toast.success(m.agent_updated_successfully())
},
onError: (error) => {
toast.error(error.message)
@@ -148,7 +155,11 @@ export function AgentsSettings({ teamId }: AgentsSettingsProps) {
{(isCreateDialogOpen || editingAgent) && (
<AgentFormDialog
isOpen={true}
title={editingAgent ? `Edit ${editingAgent.name}` : `Create ${createType} Agent`}
title={
editingAgent
? m.edit_item({ name: editingAgent.name })
: m.create_type_agent({ type: getSectionLabel(createType) })
}
onClose={() => {
setIsCreateDialogOpen(false)
setAgentToEdit(null)
@@ -162,14 +173,13 @@ export function AgentsSettings({ teamId }: AgentsSettingsProps) {
<AlertDialog open={isDeleteDialogOpen} onOpenChange={setIsDeleteDialogOpen}>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>Are you absolutely sure?</AlertDialogTitle>
<AlertDialogTitle>{m.are_you_absolutely_sure()}</AlertDialogTitle>
<AlertDialogDescription>
This action cannot be undone. This will permanently delete the agent "
{agentToDelete?.name}" and remove all its data from our servers.
{m.delete_agent_confirmation({ name: agentToDelete?.name ?? '' })}
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>Cancel</AlertDialogCancel>
<AlertDialogCancel>{m.cancel()}</AlertDialogCancel>
<AlertDialogAction
className="bg-destructive hover:bg-destructive/90 text-white"
onClick={(e) => {
@@ -185,7 +195,7 @@ export function AgentsSettings({ teamId }: AgentsSettingsProps) {
{deleteAgentMutation.isPending ? (
<Loader2 className="w-4 h-4 animate-spin" />
) : (
'Delete Agent'
m.delete_agent()
)}
</AlertDialogAction>
</AlertDialogFooter>
@@ -222,7 +232,11 @@ export function AgentsSettings({ teamId }: AgentsSettingsProps) {
>
<div className="flex items-center gap-2">
<h3 className="font-semibold text-foreground">
{section.label} {isSingleAgentType ? 'Agent' : 'Agents'}
{section.type === 'chat'
? m.chat_agents()
: section.type === 'autofill'
? m.autofill_agent()
: m.embedding_agent()}
</h3>
{!isSingleAgentType && (
<Badge variant="secondary" className="h-5 px-1.5 min-w-[1.25rem] text-[10px]">
@@ -285,7 +299,7 @@ export function AgentsSettings({ teamId }: AgentsSettingsProps) {
<div className="flex items-center gap-2 text-xs text-muted-foreground mt-0.5">
<span className="flex items-center gap-1">
<Puzzle className="w-3 h-3" />
{agent.skills?.length || 0} Skills
{m.skills_count_value({ count: agent.skills?.length || 0 })}
</span>
</div>
</div>
@@ -331,7 +345,7 @@ export function AgentsSettings({ teamId }: AgentsSettingsProps) {
}}
className="text-red-500 focus:text-red-500 gap-2 cursor-pointer"
>
<Trash2 className="w-4 h-4" /> Delete
<Trash2 className="w-4 h-4" /> {m.delete()}
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>{' '}
@@ -345,7 +359,7 @@ export function AgentsSettings({ teamId }: AgentsSettingsProps) {
<Icon className="w-5 h-5 text-muted-foreground" />
</div>
<p className="text-sm text-muted-foreground">
No {section.label} {isSingleAgentType ? 'agent' : 'agents'} found
{m.no_agents_found({ type: getSectionLabel(section.type) })}
</p>
<Button
variant="link"
@@ -356,7 +370,7 @@ export function AgentsSettings({ teamId }: AgentsSettingsProps) {
setIsCreateDialogOpen(true)
}}
>
Create one now
{m.create_one_now()}
</Button>
</div>
)}
@@ -8,6 +8,7 @@ import {
} from '@/ui/components/ui/dialog'
import { Button } from '@/ui/components/ui/button'
import { Move, ZoomIn, ZoomOut, Loader2 } from 'lucide-react'
import { m } from '@/ui/paraglide/messages.js'
interface AvatarCropDialogProps {
isOpen: boolean
@@ -141,7 +142,7 @@ export function AvatarCropDialog({ isOpen, onClose, imageSrc, onConfirm }: Avata
<DialogHeader className="p-6 border-b border-border/40 bg-gradient-to-br from-primary/5 to-transparent">
<DialogTitle className="text-xl font-bold flex items-center gap-2">
<Move className="w-5 h-5 text-primary" />
Position and resize
{m.position_and_resize()}
</DialogTitle>
</DialogHeader>
@@ -163,7 +164,7 @@ export function AvatarCropDialog({ isOpen, onClose, imageSrc, onConfirm }: Avata
<img
ref={imageRef}
src={imageSrc}
alt="Avatar Source"
alt={m.avatar_source()}
crossOrigin="anonymous"
className="absolute origin-center max-w-none pointer-events-none transition-transform duration-75 select-none"
style={{
@@ -206,16 +207,16 @@ export function AvatarCropDialog({ isOpen, onClose, imageSrc, onConfirm }: Avata
<DialogFooter className="p-6 border-t border-border/40 bg-muted/20 flex flex-row justify-end gap-3">
<Button variant="outline" onClick={onClose} disabled={isSaving}>
Cancel
{m.cancel()}
</Button>
<Button onClick={handleConfirm} disabled={isSaving || !imageSrc} className="min-w-[80px]">
{isSaving ? (
<>
<Loader2 className="w-4 h-4 animate-spin mr-2" />
Saving
{m.saving()}
</>
) : (
'Save'
m.save()
)}
</Button>
</DialogFooter>
@@ -15,6 +15,7 @@ import {
import { Loader2, Plus, Trash2, Copy, Check } from 'lucide-react'
import { toast } from 'sonner'
import type { ApiTokenResponse } from '@shumai/dtos'
import { m } from '@/ui/paraglide/messages.js'
export function DeveloperSettings({ teamId }: { teamId: string }) {
const queryClient = useQueryClient()
@@ -44,10 +45,10 @@ export function DeveloperSettings({ teamId }: { teamId: string }) {
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ['teams', teamId, 'api-tokens'] })
setTokenName('')
toast.success('API token generated successfully')
toast.success(m.api_token_generated_successfully())
},
onError: (err) => {
toast.error(err instanceof Error ? err.message : 'Failed to generate token')
toast.error(err instanceof Error ? err.message : m.failed_to_generate_token())
},
})
@@ -61,10 +62,10 @@ export function DeveloperSettings({ teamId }: { teamId: string }) {
},
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ['teams', teamId, 'api-tokens'] })
toast.success('API token revoked successfully')
toast.success(m.api_token_revoked_successfully())
},
onError: (err) => {
toast.error(err instanceof Error ? err.message : 'Failed to revoke token')
toast.error(err instanceof Error ? err.message : m.failed_to_revoke_token())
},
})
@@ -77,7 +78,7 @@ export function DeveloperSettings({ teamId }: { teamId: string }) {
const handleCopy = (id: string, token: string) => {
navigator.clipboard.writeText(token)
setCopiedId(id)
toast.success('Copied API token to clipboard')
toast.success(m.copied_api_token_to_clipboard())
setTimeout(() => setCopiedId(null), 2000)
}
@@ -93,23 +94,20 @@ export function DeveloperSettings({ teamId }: { teamId: string }) {
<div className="space-y-6">
<Card>
<CardHeader>
<CardTitle>API Tokens</CardTitle>
<CardDescription>
Generate and manage API tokens. These tokens allow you or your agents to run terminal
commands via shumai-cli.
</CardDescription>
<CardTitle>{m.api_tokens()}</CardTitle>
<CardDescription>{m.api_tokens_description()}</CardDescription>
</CardHeader>
<CardContent className="space-y-6">
<form onSubmit={handleGenerate} className="flex gap-4 items-end max-w-md">
<div className="flex-1 space-y-2">
<label htmlFor="tokenName" className="text-sm font-medium text-muted-foreground">
Token Name
{m.token_name()}
</label>
<Input
id="tokenName"
value={tokenName}
onChange={(e) => setTokenName(e.target.value)}
placeholder="e.g. My CLI token"
placeholder={m.token_name_placeholder()}
required
/>
</div>
@@ -119,7 +117,7 @@ export function DeveloperSettings({ teamId }: { teamId: string }) {
) : (
<Plus className="w-4 h-4 mr-2" />
)}
Generate
{m.generate()}
</Button>
</form>
@@ -127,10 +125,10 @@ export function DeveloperSettings({ teamId }: { teamId: string }) {
<Table>
<TableHeader>
<TableRow>
<TableHead>Name</TableHead>
<TableHead>Token</TableHead>
<TableHead>Created At</TableHead>
<TableHead className="w-[100px] text-right">Actions</TableHead>
<TableHead>{m.name()}</TableHead>
<TableHead>{m.token()}</TableHead>
<TableHead>{m.created_at()}</TableHead>
<TableHead className="w-[100px] text-right">{m.actions()}</TableHead>
</TableRow>
</TableHeader>
<TableBody>
@@ -140,7 +138,7 @@ export function DeveloperSettings({ teamId }: { teamId: string }) {
colSpan={4}
className="text-center py-6 text-muted-foreground text-sm"
>
No API tokens found. Generate one above to get started.
{m.no_api_tokens_found()}
</TableCell>
</TableRow>
) : (
@@ -12,6 +12,7 @@ import { Textarea } from '@/ui/components/ui/textarea'
import React from 'react'
import { PROVIDERS } from './constants'
import { ThinkingLevel } from './types'
import { m } from '@/ui/paraglide/messages.js'
// --- Section Header ---
export const SectionLabel: React.FC<{
@@ -46,14 +47,14 @@ export const AgentTypeSelector: React.FC<{
}> = ({ value, onChange }) => {
return (
<div className="space-y-2">
<SectionLabel label="Agent Type" />
<SectionLabel label={m.agent_type()} />
<Select value={value} onValueChange={(val: 'chat' | 'autofill') => onChange(val)}>
<SelectTrigger className="w-full">
<SelectValue placeholder="Select type" />
<SelectValue placeholder={m.select_type()} />
</SelectTrigger>
<SelectContent>
<SelectItem value="chat">Chat Agent</SelectItem>
<SelectItem value="autofill">Autofill Agent</SelectItem>
<SelectItem value="chat">{m.chat_agent()}</SelectItem>
<SelectItem value="autofill">{m.autofill_agent()}</SelectItem>
</SelectContent>
</Select>
</div>
@@ -96,7 +97,7 @@ export const ModelSelector: React.FC<ModelSelectorProps> = ({
models,
onProviderChange,
onModelChange,
label = 'AI Provider',
label = m.ai_provider(),
subLabel,
}) => {
return (
@@ -105,7 +106,7 @@ export const ModelSelector: React.FC<ModelSelectorProps> = ({
<SectionLabel label={label} subLabel={subLabel} />
<Select value={provider || ''} onValueChange={(val) => onProviderChange(val)}>
<SelectTrigger className="w-full">
<SelectValue placeholder="Select provider" />
<SelectValue placeholder={m.select_provider()} />
</SelectTrigger>
<SelectContent>
{PROVIDERS.map((p) => (
@@ -118,10 +119,10 @@ export const ModelSelector: React.FC<ModelSelectorProps> = ({
</div>
<div>
<SectionLabel label="Model" />
<SectionLabel label={m.model()} />
<Select value={model || ''} onValueChange={(val) => onModelChange(val)}>
<SelectTrigger className="w-full">
<SelectValue placeholder="Select model" />
<SelectValue placeholder={m.select_model()} />
</SelectTrigger>
<SelectContent>
{models.length > 0 ? (
@@ -132,7 +133,7 @@ export const ModelSelector: React.FC<ModelSelectorProps> = ({
))
) : (
<SelectItem value="none" disabled>
No models configured
{m.no_models_configured()}
</SelectItem>
)}
</SelectContent>
@@ -154,22 +155,22 @@ export const ThinkingLevelSelector: React.FC<ThinkingLevelSelectorProps> = ({
value,
onChange,
disabled,
label = 'Thinking Strength',
label = m.thinking_strength(),
}) => {
const levels = [
{
id: ThinkingLevel.DISABLED,
label: 'Disable',
desc: 'Standard generation',
label: m.thinking_disable(),
desc: m.standard_generation(),
},
{ id: ThinkingLevel.LOW, label: 'Low', desc: 'Quick reasoning' },
{ id: ThinkingLevel.MEDIUM, label: 'Medium', desc: 'Balanced thought' },
{ id: ThinkingLevel.HIGH, label: 'High', desc: 'Deep reasoning' },
{ id: ThinkingLevel.LOW, label: m.thinking_low(), desc: m.quick_reasoning() },
{ id: ThinkingLevel.MEDIUM, label: m.thinking_medium(), desc: m.balanced_thought() },
{ id: ThinkingLevel.HIGH, label: m.thinking_high(), desc: m.deep_reasoning() },
]
return (
<div className={disabled ? 'opacity-50 pointer-events-none grayscale' : ''}>
<SectionLabel label={label} subLabel="Control the depth of reasoning for complex tasks." />
<SectionLabel label={label} subLabel={m.thinking_level_description()} />
<div className="grid grid-cols-2 sm:grid-cols-4 gap-3">
{levels.map((level) => {
const isSelected = value === level.id
@@ -14,6 +14,7 @@ import {
} from 'lucide-react'
import { toast } from 'sonner'
import type { NotificationSettings as Settings } from '@shumai/dtos'
import { m } from '@/ui/paraglide/messages.js'
export function NotificationSettings({ teamId }: { teamId: string }) {
const queryClient = useQueryClient()
@@ -24,7 +25,7 @@ export function NotificationSettings({ teamId }: { teamId: string }) {
const res = await client.api.teams[':teamId'].notifications.settings.$get({
param: { teamId },
})
if (!res.ok) throw new Error('Failed to fetch notification settings')
if (!res.ok) throw new Error(m.failed_load_settings())
return (await res.json()) as Settings
},
})
@@ -35,16 +36,16 @@ export function NotificationSettings({ teamId }: { teamId: string }) {
param: { teamId },
json: updated,
})
if (!res.ok) throw new Error('Failed to update notification settings')
if (!res.ok) throw new Error(m.failed_to_update_notification_settings())
return await res.json()
},
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ['teams', teamId, 'notification-settings'] })
queryClient.invalidateQueries({ queryKey: ['teams', teamId, 'notifications'] })
toast.success('Notification settings updated')
toast.success(m.notification_settings_updated())
},
onError: (err) => {
toast.error(err instanceof Error ? err.message : 'Failed to update notification settings')
toast.error(err instanceof Error ? err.message : m.failed_to_update_notification_settings())
},
})
@@ -73,12 +74,9 @@ export function NotificationSettings({ teamId }: { teamId: string }) {
<CardHeader className="border-b border-slate-100 dark:border-slate-800 bg-slate-50/50 dark:bg-slate-900/50">
<div className="flex items-center gap-2">
<MessageSquare className="w-5 h-5 text-blue-500" />
<CardTitle className="text-lg">Comments & Replies</CardTitle>
<CardTitle className="text-lg">{m.comments_and_replies()}</CardTitle>
</div>
<CardDescription>
Control notification preferences when other users comment on assets you collaborate on
or mention you.
</CardDescription>
<CardDescription>{m.comments_notification_description()}</CardDescription>
</CardHeader>
<CardContent className="divide-y divide-slate-100 dark:divide-slate-800 p-0">
{/* General Comments */}
@@ -89,10 +87,10 @@ export function NotificationSettings({ teamId }: { teamId: string }) {
</div>
<div className="space-y-0.5">
<h4 className="text-sm font-semibold text-slate-900 dark:text-white">
General Comments
{m.general_comments()}
</h4>
<p className="text-sm text-slate-500 dark:text-slate-400">
When someone comments on an asset
{m.when_someone_comments()}
</p>
</div>
</div>
@@ -111,10 +109,10 @@ export function NotificationSettings({ teamId }: { teamId: string }) {
</div>
<div className="space-y-0.5">
<h4 className="text-sm font-semibold text-slate-900 dark:text-white">
Comment Replies
{m.comment_replies()}
</h4>
<p className="text-sm text-slate-500 dark:text-slate-400">
When someone replies to your comment
{m.when_someone_replies()}
</p>
</div>
</div>
@@ -133,10 +131,10 @@ export function NotificationSettings({ teamId }: { teamId: string }) {
</div>
<div className="space-y-0.5">
<h4 className="text-sm font-semibold text-slate-900 dark:text-white">
@Mentions
{m.at_mentions()}
</h4>
<p className="text-sm text-slate-500 dark:text-slate-400">
When someone @mentions you in a comment
{m.when_someone_mentions()}
</p>
</div>
</div>
@@ -154,11 +152,9 @@ export function NotificationSettings({ teamId }: { teamId: string }) {
<CardHeader className="border-b border-slate-100 dark:border-slate-800 bg-slate-50/50 dark:bg-slate-900/50">
<div className="flex items-center gap-2">
<UploadCloud className="w-5 h-5 text-emerald-500" />
<CardTitle className="text-lg">Assets & Statuses</CardTitle>
<CardTitle className="text-lg">{m.assets_and_statuses()}</CardTitle>
</div>
<CardDescription>
Manage notifications related to file uploads and metadata field status updates.
</CardDescription>
<CardDescription>{m.assets_notification_description()}</CardDescription>
</CardHeader>
<CardContent className="divide-y divide-slate-100 dark:divide-slate-800 p-0">
{/* Your Uploads */}
@@ -169,10 +165,10 @@ export function NotificationSettings({ teamId }: { teamId: string }) {
</div>
<div className="space-y-0.5">
<h4 className="text-sm font-semibold text-slate-900 dark:text-white">
Your Uploads
{m.your_uploads()}
</h4>
<p className="text-sm text-slate-500 dark:text-slate-400">
When you upload assets
{m.when_you_upload_assets()}
</p>
</div>
</div>
@@ -191,10 +187,10 @@ export function NotificationSettings({ teamId }: { teamId: string }) {
</div>
<div className="space-y-0.5">
<h4 className="text-sm font-semibold text-slate-900 dark:text-white">
Other Uploads
{m.other_uploads()}
</h4>
<p className="text-sm text-slate-500 dark:text-slate-400">
When other users upload assets
{m.when_other_users_upload_assets()}
</p>
</div>
</div>
@@ -213,10 +209,10 @@ export function NotificationSettings({ teamId }: { teamId: string }) {
</div>
<div className="space-y-0.5">
<h4 className="text-sm font-semibold text-slate-900 dark:text-white">
Status Updates
{m.status_updates()}
</h4>
<p className="text-sm text-slate-500 dark:text-slate-400">
When someone changes an asset’s status
{m.when_someone_changes_status()}
</p>
</div>
</div>
@@ -59,6 +59,7 @@ import {
import { useEffect, useMemo, useState } from 'react'
import { toast } from 'sonner'
import { z } from 'zod'
import { m } from '@/ui/paraglide/messages.js'
const API_PROTOCOL_LABELS: Record<(typeof KNOWN_APIS)[number], string> = {
'openai-completions': 'OpenAI Completions',
@@ -73,9 +74,9 @@ const API_PROTOCOL_LABELS: Record<(typeof KNOWN_APIS)[number], string> = {
}
const providerFormSchemaBase = z.object({
name: z.string().min(1, 'Provider name is required'),
name: z.string().min(1, m.provider_name_is_required()),
config: providerConfigSchema,
models: z.array(providerModelSchema).min(1, 'At least one model is required'),
models: z.array(providerModelSchema).min(1, m.at_least_one_model_required()),
})
type ProviderFormValues = z.infer<typeof providerFormSchemaBase>
@@ -153,10 +154,10 @@ export function ProvidersSettings({ teamId }: ProvidersSettingsProps) {
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ['teams', teamId, 'providers'] })
setIsCreateDialogOpen(false)
toast.success('Provider created successfully')
toast.success(m.provider_created_successfully())
},
onError: (error) => {
toast.error(`Error: ${error.message}`)
toast.error(m.error_message({ message: error.message }))
},
})
@@ -176,10 +177,10 @@ export function ProvidersSettings({ teamId }: ProvidersSettingsProps) {
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ['teams', teamId, 'providers'] })
setEditingProviderId(null)
toast.success('Provider updated successfully')
toast.success(m.provider_updated_successfully())
},
onError: (error) => {
toast.error(`Error: ${error.message}`)
toast.error(m.error_message({ message: error.message }))
},
})
@@ -197,10 +198,10 @@ export function ProvidersSettings({ teamId }: ProvidersSettingsProps) {
setEditingProviderId(null)
setIsDeleteDialogOpen(false)
setProviderToDelete(null)
toast.success('Provider deleted successfully')
toast.success(m.provider_deleted_successfully())
},
onError: (error) => {
toast.error(`Error: ${error.message}`)
toast.error(m.error_message({ message: error.message }))
},
})
@@ -218,21 +219,21 @@ export function ProvidersSettings({ teamId }: ProvidersSettingsProps) {
<div className="flex items-center justify-between">
<h3 className="text-lg font-semibold text-foreground flex items-center gap-2">
<Cpu className="w-5 h-5 text-primary" />
Configured AI Providers
{m.configured_ai_providers()}
</h3>
<Button
onClick={() => setIsCreateDialogOpen(true)}
className="bg-primary hover:bg-primary/90 text-primary-foreground gap-2"
>
<Plus className="w-4 h-4" />
Add Provider
{m.add_provider()}
</Button>
</div>
<div className="relative px-0.5">
<Search className="absolute left-3.5 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground" />
<Input
placeholder="Search providers..."
placeholder={m.search_providers_placeholder()}
value={searchQuery}
onChange={(e) => setSearchQuery(e.target.value)}
className="pl-10 bg-card border-border focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-0"
@@ -261,7 +262,7 @@ export function ProvidersSettings({ teamId }: ProvidersSettingsProps) {
variant="secondary"
className="flex-none text-[10px] uppercase tracking-wider font-bold h-5"
>
Built-in
{m.built_in()}
</Badge>
)}
</div>
@@ -282,7 +283,7 @@ export function ProvidersSettings({ teamId }: ProvidersSettingsProps) {
<span className="flex items-center gap-1 flex-none">
<span className="h-1 w-1 rounded-full bg-muted-foreground/30 flex-none" />
<Maximize2 className="w-3 h-3" />
{provider.modelsCount} Models
{m.n_models_count({ count: provider.modelsCount })}
{editingProviderId === provider.id && isModelsLoading && (
<Loader2 className="w-3 h-3 animate-spin ml-1" />
)}
@@ -311,7 +312,7 @@ export function ProvidersSettings({ teamId }: ProvidersSettingsProps) {
}}
className="text-destructive focus:text-destructive gap-2 cursor-pointer"
>
<Trash2 className="w-4 h-4" /> Delete
<Trash2 className="w-4 h-4" /> {m.delete()}
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
@@ -324,19 +325,17 @@ export function ProvidersSettings({ teamId }: ProvidersSettingsProps) {
{providers?.length === 0 && (
<div className="text-center py-12 bg-muted/30 rounded-2xl border-2 border-dashed border-border">
<Cpu className="w-12 h-12 text-muted-foreground/50 mx-auto mb-4" />
<h4 className="text-foreground font-medium">No Providers Configured</h4>
<p className="text-sm text-muted-foreground mt-1">
Add your first AI provider to get started.
</p>
<h4 className="text-foreground font-medium">{m.no_providers_configured()}</h4>
<p className="text-sm text-muted-foreground mt-1">{m.add_first_provider()}</p>
</div>
)}
{providers && providers.length > 0 && filteredProviders.length === 0 && (
<div className="text-center py-12">
<Search className="w-12 h-12 text-muted-foreground/50 mx-auto mb-4" />
<h4 className="text-foreground font-medium">No matches found</h4>
<h4 className="text-foreground font-medium">{m.no_matches_found()}</h4>
<p className="text-sm text-muted-foreground mt-1">
Try adjusting your search for "{searchQuery}"
{m.try_adjusting_search({ query: searchQuery })}
</p>
<Button
variant="ghost"
@@ -344,7 +343,7 @@ export function ProvidersSettings({ teamId }: ProvidersSettingsProps) {
onClick={() => setSearchQuery('')}
className="mt-4 text-primary hover:text-primary/90 hover:bg-primary/10"
>
Clear search
{m.clear_search()}
</Button>
</div>
)}
@@ -356,7 +355,7 @@ export function ProvidersSettings({ teamId }: ProvidersSettingsProps) {
onClose={() => setIsCreateDialogOpen(false)}
onSubmit={(values) => createMutation.mutate(values)}
isLoading={createMutation.isPending}
title="Add New Provider"
title={m.add_new_provider()}
existingProviderNames={existingProviderNames}
/>
@@ -376,20 +375,21 @@ export function ProvidersSettings({ teamId }: ProvidersSettingsProps) {
: undefined
}
isBuiltin={editingProvider?.isBuiltin}
title={`Edit ${editingProvider?.name}`}
title={editingProvider ? m.edit_item({ name: editingProvider.name }) : ''}
existingProviderNames={existingProviderNames}
/>
<AlertDialog open={isDeleteDialogOpen} onOpenChange={setIsDeleteDialogOpen}>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>Are you absolutely sure?</AlertDialogTitle>
<AlertDialogTitle>{m.are_you_absolutely_sure()}</AlertDialogTitle>
<AlertDialogDescription>
This action cannot be undone. This will permanently delete the provider "
{providerToDelete?.name}" and all associated model configurations.
{m.delete_provider_confirmation({ name: providerToDelete?.name ?? '' })}
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel onClick={() => setProviderToDelete(null)}>Cancel</AlertDialogCancel>
<AlertDialogCancel onClick={() => setProviderToDelete(null)}>
{m.cancel()}
</AlertDialogCancel>
<AlertDialogAction
className="bg-destructive hover:bg-destructive/90 text-destructive-foreground"
onClick={() => {
@@ -403,7 +403,7 @@ export function ProvidersSettings({ teamId }: ProvidersSettingsProps) {
) : (
<Trash2 className="w-4 h-4 mr-2" />
)}
Delete
{m.delete()}
</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
@@ -504,9 +504,7 @@ function ProviderFormDialog({
<DialogContent className="sm:max-w-4xl h-[90vh] flex flex-col p-0 overflow-hidden">
<DialogHeader className="p-6 pb-2 shrink-0">
<DialogTitle className="text-xl">{title}</DialogTitle>
<DialogDescription>
Configure authentication and model details for your AI provider.
</DialogDescription>
<DialogDescription>{m.configure_provider_description()}</DialogDescription>
</DialogHeader>
<form
@@ -529,14 +527,14 @@ function ProviderFormDialog({
!!field.state.meta.errors.length && field.state.meta.isTouched
return (
<Field data-invalid={isInvalid}>
<FieldLabel htmlFor={field.name}>Provider Name</FieldLabel>
<FieldLabel htmlFor={field.name}>{m.provider_name()}</FieldLabel>
<Input
id={field.name}
name={field.name}
value={field.state.value}
onBlur={field.handleBlur}
onChange={(e) => field.handleChange(e.target.value)}
placeholder="e.g., My OpenAI"
placeholder={m.provider_name_placeholder()}
disabled={isBuiltin}
aria-invalid={isInvalid}
/>
@@ -553,14 +551,14 @@ function ProviderFormDialog({
!!field.state.meta.errors.length && field.state.meta.isTouched
return (
<Field data-invalid={isInvalid}>
<FieldLabel htmlFor={field.name}>Global API Protocol</FieldLabel>
<FieldLabel htmlFor={field.name}>{m.global_api_protocol()}</FieldLabel>
<Select
onValueChange={field.handleChange as (value: string) => void}
value={field.state.value}
disabled={isBuiltin}
>
<SelectTrigger id={field.name} aria-invalid={isInvalid}>
<SelectValue placeholder="Select API Protocol" />
<SelectValue placeholder={m.select_api_protocol()} />
</SelectTrigger>
<SelectContent>
{KNOWN_APIS.map((api) => (
@@ -584,7 +582,7 @@ function ProviderFormDialog({
!!field.state.meta.errors.length && field.state.meta.isTouched
return (
<Field data-invalid={isInvalid}>
<FieldLabel htmlFor={field.name}>Base URL (Optional)</FieldLabel>
<FieldLabel htmlFor={field.name}>{m.base_url_optional()}</FieldLabel>
<Input
id={field.name}
name={field.name}
@@ -594,7 +592,7 @@ function ProviderFormDialog({
placeholder="https://api.openai.com/v1"
aria-invalid={isInvalid}
/>
<FieldDescription>Override the default endpoint.</FieldDescription>
<FieldDescription>{m.override_default_endpoint()}</FieldDescription>
{isInvalid && (
<FieldError errors={mapErrors(field.state.meta.errors)} />
)}
@@ -616,7 +614,7 @@ function ProviderFormDialog({
return (
<Field data-invalid={isInvalid}>
<FieldLabel htmlFor={field.name} className="text-base font-semibold">
API Key
{m.api_key()}
</FieldLabel>
<Input
id={field.name}
@@ -625,15 +623,11 @@ function ProviderFormDialog({
value={field.state.value || ''}
onBlur={field.handleBlur}
onChange={(e) => field.handleChange(e.target.value)}
placeholder="Enter API Key or Environment Variable"
placeholder={m.api_key_placeholder()}
aria-invalid={isInvalid}
/>
<FieldDescription className="text-xs mt-2">
You can provide a literal value (e.g.{' '}
<code className="bg-muted px-1 rounded text-primary">sk-...</code>) or
an Environment variable name (e.g.{' '}
<code className="bg-muted px-1 rounded text-primary">MY_API_KEY</code>
).
{m.api_key_description()}
</FieldDescription>
{isInvalid && (
<FieldError errors={mapErrors(field.state.meta.errors)} />
@@ -653,7 +647,7 @@ function ProviderFormDialog({
children={(modelsField) => (
<div className="space-y-4">
<div className="flex items-center justify-between">
<Label className="text-lg font-bold">Models Configuration</Label>
<Label className="text-lg font-bold">{m.models_configuration()}</Label>
<Button
type="button"
variant="outline"
@@ -675,7 +669,7 @@ function ProviderFormDialog({
className="gap-2"
>
<Plus className="w-4 h-4" />
Add Model
{m.add_model()}
</Button>
</div>
@@ -694,7 +688,7 @@ function ProviderFormDialog({
!!field.state.meta.errors.length && field.state.meta.isTouched
return (
<Field data-invalid={isInvalid}>
<FieldLabel htmlFor={field.name}>Model ID</FieldLabel>
<FieldLabel htmlFor={field.name}>{m.model_id()}</FieldLabel>
<Input
id={field.name}
name={field.name}
@@ -719,7 +713,7 @@ function ProviderFormDialog({
return (
<Field data-invalid={isInvalid}>
<FieldLabel htmlFor={field.name}>
Display Name (Optional)
{m.display_name_optional()}
</FieldLabel>
<Input
id={field.name}
@@ -750,7 +744,7 @@ function ProviderFormDialog({
className="rounded-lg border border-border p-3 shadow-sm bg-muted/50 justify-between"
>
<FieldLabel htmlFor={field.name}>
Reasoning Support
{m.reasoning_support()}
</FieldLabel>
<Switch
id={field.name}
@@ -769,7 +763,7 @@ function ProviderFormDialog({
return (
<Field data-invalid={isInvalid}>
<FieldLabel htmlFor={field.name} className="text-xs">
Context Window (tokens)
{m.context_window_tokens()}
</FieldLabel>
<Input
id={field.name}
@@ -802,7 +796,7 @@ function ProviderFormDialog({
return (
<Field data-invalid={isInvalid}>
<FieldLabel htmlFor={field.name} className="text-xs">
Max Output Tokens
{m.max_output_tokens()}
</FieldLabel>
<Input
id={field.name}
@@ -834,7 +828,7 @@ function ProviderFormDialog({
htmlFor={field.name}
className="text-xs flex items-center gap-1"
>
<DollarSign className="w-3 h-3" /> Input Cost (1M)
<DollarSign className="w-3 h-3" /> {m.input_cost_1m()}
</FieldLabel>
<Input
id={field.name}
@@ -867,7 +861,7 @@ function ProviderFormDialog({
htmlFor={field.name}
className="text-xs flex items-center gap-1"
>
<DollarSign className="w-3 h-3" /> Output Cost (1M)
<DollarSign className="w-3 h-3" /> {m.output_cost_1m()}
</FieldLabel>
<Input
id={field.name}
@@ -913,7 +907,7 @@ function ProviderFormDialog({
<DialogFooter className="p-6 pt-4 border-t border-border gap-2 shrink-0">
<Button type="button" variant="outline" onClick={onClose} disabled={isLoading}>
Cancel
{m.cancel()}
</Button>
<form.Subscribe
selector={(state) => [state.canSubmit, state.isSubmitting]}
@@ -926,7 +920,7 @@ function ProviderFormDialog({
{isSubmitting || isLoading ? (
<Loader2 className="w-4 h-4 animate-spin" />
) : (
'Save Configuration'
m.save_configuration()
)}
</Button>
)}
@@ -938,14 +932,15 @@ function ProviderFormDialog({
<AlertDialog open={isDeleteDialogOpen} onOpenChange={setIsDeleteDialogOpen}>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>Are you absolutely sure?</AlertDialogTitle>
<AlertDialogTitle>{m.are_you_absolutely_sure()}</AlertDialogTitle>
<AlertDialogDescription>
This action cannot be undone. This will permanently delete the provider and all
associated model configurations.
{m.delete_provider_confirmation({ name: initialValues?.name ?? '' })}
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>Cancel</AlertDialogCancel>
<AlertDialogCancel onClick={() => setIsDeleteDialogOpen(false)}>
{m.cancel()}
</AlertDialogCancel>
<AlertDialogAction
className="bg-destructive hover:bg-destructive/90 text-destructive-foreground"
onClick={() => {
@@ -953,7 +948,7 @@ function ProviderFormDialog({
setIsDeleteDialogOpen(false)
}}
>
Delete
{m.delete()}
</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
@@ -7,6 +7,7 @@ import { Input } from '@/ui/components/ui/input'
import { Button } from '@/ui/components/ui/button'
import { Loader2, Plus, X, Globe, Check, Trash2, ShieldAlert } from 'lucide-react'
import { toast } from 'sonner'
import { m } from '@/ui/paraglide/messages.js'
export function SandboxSettings({ teamId }: { teamId: string }) {
const queryClient = useQueryClient()
@@ -18,7 +19,7 @@ export function SandboxSettings({ teamId }: { teamId: string }) {
const res = await client.api.teams[':teamId'].sandbox.$get({
param: { teamId },
})
if (!res.ok) throw new Error('Failed to fetch sandbox settings')
if (!res.ok) throw new Error(m.failed_load_settings())
return await res.json()
},
})
@@ -29,15 +30,15 @@ export function SandboxSettings({ teamId }: { teamId: string }) {
param: { teamId },
json: params,
})
if (!res.ok) throw new Error('Failed to update sandbox settings')
if (!res.ok) throw new Error(m.failed_to_update_sandbox_settings())
return await res.json()
},
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ['teams', teamId, 'sandbox'] })
toast.success('Sandbox settings updated')
toast.success(m.sandbox_settings_updated())
},
onError: (err) => {
toast.error(err instanceof Error ? err.message : 'Failed to update sandbox settings')
toast.error(err instanceof Error ? err.message : m.failed_to_update_sandbox_settings())
},
})
@@ -45,7 +46,7 @@ export function SandboxSettings({ teamId }: { teamId: string }) {
e.preventDefault()
if (!newDomain.trim()) return
if (sandbox?.allowedDomains.includes(newDomain.trim())) {
toast.error('Domain already exists')
toast.error(m.domain_already_exists())
return
}
const updatedAllowed = [...(sandbox?.allowedDomains || []), newDomain.trim()]
@@ -86,12 +87,9 @@ export function SandboxSettings({ teamId }: { teamId: string }) {
<CardHeader>
<div className="flex items-center gap-2">
<Globe className="w-5 h-5 text-primary" />
<CardTitle>Network Sandbox</CardTitle>
<CardTitle>{m.network_sandbox()}</CardTitle>
</div>
<CardDescription>
Configure allowed domains for the sandboxed agent. By default, only essential domains
are allowed.
</CardDescription>
<CardDescription>{m.network_sandbox_description()}</CardDescription>
</CardHeader>
<CardContent>
<form onSubmit={handleAddDomain} className="flex gap-2 mb-6">
@@ -107,12 +105,14 @@ export function SandboxSettings({ teamId }: { teamId: string }) {
) : (
<Plus className="w-4 h-4 mr-2" />
)}
Add Domain
{m.add_domain()}
</Button>
</form>
<div className="space-y-2">
<h4 className="text-sm font-medium text-muted-foreground mb-3">Allowed Domains</h4>
<h4 className="text-sm font-medium text-muted-foreground mb-3">
{m.allowed_domains()}
</h4>
<div className="flex flex-wrap gap-2">
{sandbox?.allowedDomains.map((domain) => (
<div
@@ -131,7 +131,7 @@ export function SandboxSettings({ teamId }: { teamId: string }) {
))}
{sandbox?.allowedDomains.length === 0 && (
<div className="text-sm text-muted-foreground italic">
No custom domains allowed
{m.no_custom_domains_allowed()}
</div>
)}
</div>
@@ -144,12 +144,9 @@ export function SandboxSettings({ teamId }: { teamId: string }) {
<CardHeader>
<div className="flex items-center gap-2">
<ShieldAlert className="w-5 h-5 text-orange-500" />
<CardTitle>Pending Domain Approvals</CardTitle>
<CardTitle>{m.pending_domain_approvals()}</CardTitle>
</div>
<CardDescription>
These domains were blocked during agent execution. You can approve them to allow
future network requests, or delete them from this list.
</CardDescription>
<CardDescription>{m.pending_domains_description()}</CardDescription>
</CardHeader>
<CardContent>
<div className="space-y-3">
@@ -172,7 +169,7 @@ export function SandboxSettings({ teamId }: { teamId: string }) {
disabled={isUpdating}
>
<Check className="w-4 h-4 mr-1.5" />
Approve
{m.approve()}
</Button>
<Button
size="sm"
@@ -182,7 +179,7 @@ export function SandboxSettings({ teamId }: { teamId: string }) {
disabled={isUpdating}
>
<Trash2 className="w-4 h-4 mr-1.5" />
Delete
{m.delete()}
</Button>
</div>
</div>
@@ -190,7 +187,7 @@ export function SandboxSettings({ teamId }: { teamId: string }) {
</div>
) : (
<div className="text-sm text-muted-foreground italic py-2">
No pending domains requiring approval
{m.no_pending_domains()}
</div>
)}
</div>
@@ -199,11 +196,8 @@ export function SandboxSettings({ teamId }: { teamId: string }) {
<Card>
<CardHeader>
<CardTitle>Filesystem Restriction</CardTitle>
<CardDescription>
The agent is restricted to reading and writing only within the <code>.pi</code> and{' '}
<code>/tmp</code> folders. These settings are currently hardcoded for security.
</CardDescription>
<CardTitle>{m.filesystem_restriction()}</CardTitle>
<CardDescription>{m.filesystem_restriction_description()}</CardDescription>
</CardHeader>
</Card>
</div>
@@ -33,6 +33,7 @@ import {
AlertDialogTitle,
} from '@/ui/components/ui/alert-dialog'
import { SkillInfo } from '@shumai/dtos'
import { m } from '@/ui/paraglide/messages.js'
const Github = (props: React.SVGProps<SVGSVGElement>) => (
<svg
@@ -68,7 +69,7 @@ export const SkillsConfigCard: React.FC<SkillsConfigCardProps> = ({ teamId }) =>
queryKey: ['teams', teamId, 'skills'],
queryFn: async () => {
const res = await client.api.teams[':teamId'].skills.$get({ param: { teamId } })
if (!res.ok) throw new Error('Failed to fetch skills')
if (!res.ok) throw new Error(m.failed_load_settings())
return await res.json()
},
})
@@ -79,7 +80,7 @@ export const SkillsConfigCard: React.FC<SkillsConfigCardProps> = ({ teamId }) =>
const res = await client.api.skills[':id'].$delete({
param: { id },
})
if (!res.ok) throw new Error('Failed to delete skill')
if (!res.ok) throw new Error(m.failed_to_delete())
},
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ['teams', teamId, 'skills'] })
@@ -97,14 +98,12 @@ export const SkillsConfigCard: React.FC<SkillsConfigCardProps> = ({ teamId }) =>
<Puzzle className="w-6 h-6" />
</div>
<div>
<CardTitle className="text-xl font-bold">Skills Management</CardTitle>
<CardDescription>
Extend your chatbot's capabilities with custom skills.
</CardDescription>
<CardTitle className="text-xl font-bold">{m.skills_management()}</CardTitle>
<CardDescription>{m.skills_management_description()}</CardDescription>
</div>
</div>
<Button onClick={() => setIsAddDialogOpen(true)} className="gap-2">
<Plus className="w-4 h-4" /> Add Skill
<Plus className="w-4 h-4" /> {m.add_skill()}
</Button>
</CardHeader>
<CardContent>
@@ -117,9 +116,9 @@ export const SkillsConfigCard: React.FC<SkillsConfigCardProps> = ({ teamId }) =>
<div className="mx-auto w-12 h-12 bg-muted rounded-full flex items-center justify-center mb-4 text-muted-foreground">
<Puzzle className="w-6 h-6" />
</div>
<h3 className="text-lg font-medium text-foreground">No skills installed</h3>
<h3 className="text-lg font-medium text-foreground">{m.no_skills_installed()}</h3>
<p className="text-muted-foreground mt-1 max-w-xs mx-auto">
Add a skill via GitHub URL or upload a ZIP file to get started.
{m.add_skill_to_get_started()}
</p>
</div>
) : (
@@ -164,14 +163,13 @@ export const SkillsConfigCard: React.FC<SkillsConfigCardProps> = ({ teamId }) =>
<AlertDialog open={isDeleteDialogOpen} onOpenChange={setIsDeleteDialogOpen}>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>Are you absolutely sure?</AlertDialogTitle>
<AlertDialogTitle>{m.are_you_absolutely_sure()}</AlertDialogTitle>
<AlertDialogDescription>
This action cannot be undone. This will permanently delete the skill "
{selectedSkill?.name}" and all its configurations.
{m.delete_skill_confirmation({ name: selectedSkill?.name ?? '' })}
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>Cancel</AlertDialogCancel>
<AlertDialogCancel>{m.cancel()}</AlertDialogCancel>
<AlertDialogAction
className="bg-destructive hover:bg-destructive/90 text-destructive-foreground"
onClick={() => {
@@ -185,7 +183,7 @@ export const SkillsConfigCard: React.FC<SkillsConfigCardProps> = ({ teamId }) =>
) : (
<Trash2 className="w-4 h-4 mr-2" />
)}
Delete
{m.delete()}
</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
@@ -225,18 +223,20 @@ const SkillItem = ({
}}
className="text-destructive focus:text-destructive gap-2 cursor-pointer"
>
<Trash2 className="w-4 h-4" /> Delete
<Trash2 className="w-4 h-4" /> {m.delete()}
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
</div>
<p className="text-sm text-muted-foreground line-clamp-2">
{skill.description || 'No description provided.'}
{skill.description || m.no_description_provided()}
</p>
</div>
<div className="mt-4 flex items-center justify-between text-[10px] text-muted-foreground uppercase tracking-wider font-semibold">
<span>Updated {new Date(skill.updatedAt).toLocaleDateString()}</span>
<div className="px-2 py-0.5 rounded-full bg-primary/10 text-primary">Installed</div>
<span>
{m.updated_date()} {new Date(skill.updatedAt).toLocaleDateString()}
</span>
<div className="px-2 py-0.5 rounded-full bg-primary/10 text-primary">{m.installed()}</div>
</div>
</div>
)
@@ -284,13 +284,13 @@ const AddSkillDialog = ({
if (res.status === 409) {
const data = (await res.json()) as { error: string }
if (window.confirm(`${data.error}\n\nDo you want to override the existing skill?`)) {
if (window.confirm(`${data.error}\n\n${m.override_existing_skill()}`)) {
await installSkill({ ...payload, override: true })
return
}
} else if (!res.ok) {
const errorData = (await res.json().catch(() => ({}))) as { error?: string }
throw new Error(errorData.error || 'Failed to install skill')
throw new Error(errorData.error || m.failed_to_install_skill())
} else {
queryClient.invalidateQueries({ queryKey: ['teams', teamId, 'skills'] })
onOpenChange(false)
@@ -300,7 +300,7 @@ const AddSkillDialog = ({
if (err instanceof Error) {
alert(err.message)
} else {
alert('An unknown error occurred')
alert(m.an_unknown_error_occurred())
}
} finally {
setIsProcessing(false)
@@ -312,13 +312,13 @@ const AddSkillDialog = ({
const projectId = projectsData?.data?.[0]?.id
if (!projectId) {
alert('You need at least one project in your team to upload skills.')
alert(m.need_project_to_upload_skills())
return
}
const fileToUpload = files[0]
if (!fileToUpload.name.toLowerCase().endsWith('.zip')) {
alert('Only .zip files are supported.')
alert(m.only_zip_files_supported())
return
}
@@ -357,7 +357,7 @@ const AddSkillDialog = ({
if (err instanceof Error) {
alert(err.message)
} else {
alert('An unknown error occurred')
alert(m.an_unknown_error_occurred())
}
} finally {
setIsProcessing(false)
@@ -368,16 +368,14 @@ const AddSkillDialog = ({
<Dialog open={open} onOpenChange={onOpenChange}>
<DialogContent className="sm:max-w-[450px]">
<DialogHeader>
<DialogTitle>Add New Skill</DialogTitle>
<DialogDescription>
Import a skill from a local ZIP archive or a GitHub repository.
</DialogDescription>
<DialogTitle>{m.add_new_skill()}</DialogTitle>
<DialogDescription>{m.import_skill_description()}</DialogDescription>
</DialogHeader>
<div className="space-y-6 pt-4">
{/* File Upload Section */}
<div className="space-y-3">
<Label>Package Upload</Label>
<Label>{m.package_upload()}</Label>
<div
onClick={() => !isProcessing && fileInputRef.current?.click()}
className={cn(
@@ -398,16 +396,16 @@ const AddSkillDialog = ({
<Upload className="w-6 h-6 text-muted-foreground group-hover:text-primary" />
</div>
<div className="mt-3 text-center">
<p className="text-sm font-medium text-foreground">Select ZIP file</p>
<p className="text-sm font-medium text-foreground">{m.select_zip_file()}</p>
<p className="text-[10px] text-muted-foreground mt-1 uppercase tracking-wider font-semibold">
Packages must contain a SKILL.md
{m.packages_must_contain_skill_md()}
</p>
</div>
</div>
{isProcessing && !githubUrl && (
<div className="flex items-center gap-2 text-sm text-primary justify-center bg-primary/10 py-2 rounded-lg animate-pulse">
<Loader2 className="w-4 h-4 animate-spin" />
Processing package...
{m.processing_package()}
</div>
)}
</div>
@@ -417,14 +415,14 @@ const AddSkillDialog = ({
<span className="w-full border-t border-border" />
</div>
<div className="relative flex justify-center text-xs uppercase">
<span className="bg-background px-2 text-muted-foreground font-bold">OR</span>
<span className="bg-background px-2 text-muted-foreground font-bold">{m.or()}</span>
</div>
</div>
{/* GitHub URL Section */}
<div className="space-y-4">
<div className="space-y-2">
<Label htmlFor="githubUrl">GitHub Repository URL</Label>
<Label htmlFor="githubUrl">{m.github_repository_url()}</Label>
<div className="flex gap-2">
<div className="relative flex-1">
<Github className="absolute left-3 top-2.5 w-4 h-4 text-muted-foreground" />
@@ -445,13 +443,11 @@ const AddSkillDialog = ({
{isProcessing && githubUrl ? (
<Loader2 className="w-4 h-4 animate-spin" />
) : (
'Install'
m.install()
)}
</Button>
</div>
<p className="text-[10px] text-muted-foreground italic">
Example: https://github.com/google/gemini-cli
</p>
<p className="text-[10px] text-muted-foreground italic">{m.github_url_example()}</p>
</div>
</div>
</div>
@@ -524,7 +520,7 @@ const ConfigSkillDialog = ({
if (err instanceof Error) {
alert(err.message)
} else {
alert('An unknown error occurred')
alert(m.an_unknown_error_occurred())
}
} finally {
setIsSaving(false)
@@ -540,21 +536,17 @@ const ConfigSkillDialog = ({
<div className="flex items-center justify-between">
<DialogTitle className="flex items-center gap-2">
<Code className="w-5 h-5 text-primary" />
Configure Skill: {skill.name}
{m.configure_skill({ name: skill.name })}
</DialogTitle>
</div>
<DialogDescription>
Manage environment variables for this skill instance.
</DialogDescription>
<DialogDescription>{m.manage_env_vars_description()}</DialogDescription>
</DialogHeader>
<ScrollArea className="max-h-[60vh]">
<div className="py-4 space-y-4 pr-4">
{envVars.length === 0 ? (
<div className="text-center py-10 bg-muted/50 rounded-xl border border-dashed border-border">
<p className="text-muted-foreground text-sm italic">
No environment variables found. Click "Add Variable" to create one.
</p>
<p className="text-muted-foreground text-sm italic">{m.no_env_vars_found()}</p>
</div>
) : (
envVars.map((env: { name: string; default?: string | undefined }, index: number) => (
@@ -571,28 +563,28 @@ const ConfigSkillDialog = ({
<div className="space-y-1.5">
<Label className="text-[10px] uppercase tracking-wider font-bold text-muted-foreground">
Variable Name
{m.variable_name()}
</Label>
<Input
value={env.name}
onChange={(e) => handleEnvVarNameChange(index, e.target.value)}
placeholder="e.app. API_KEY"
placeholder="e.g. API_KEY"
className="h-8 bg-background border-border text-sm font-mono"
/>
</div>
<div className="space-y-1.5">
<Label className="text-[10px] uppercase tracking-wider font-bold text-muted-foreground">
Default Value
{m.default_value()}
</Label>
<Input
value={env.default || ''}
onChange={(e) => handleEnvVarValueChange(index, e.target.value)}
placeholder="Optional default value..."
placeholder={m.optional_default_value_placeholder()}
className="h-8 bg-background border-border text-sm"
/>
<p className="text-[10px] text-muted-foreground italic">
If left empty, the value will be read from the host machine's environment.
{m.env_var_empty_note()}
</p>
</div>
</div>
@@ -608,15 +600,15 @@ const ConfigSkillDialog = ({
onClick={addEnvVar}
className="h-8 gap-1.5 text-primary hover:text-primary hover:bg-primary/10"
>
<Plus className="w-3.5 h-3.5" /> Add Variable
<Plus className="w-3.5 h-3.5" /> {m.add_variable()}
</Button>
<div className="flex gap-2">
<Button variant="ghost" onClick={() => onOpenChange(false)}>
Cancel
{m.cancel()}
</Button>
<Button onClick={handleSave} disabled={isSaving} className="px-8">
{isSaving ? <Loader2 className="w-4 h-4 animate-spin mr-2" /> : null}
Save Changes
{m.save_changes()}
</Button>
</div>
</DialogFooter>
+2 -4
View File
@@ -24,7 +24,7 @@ export function TeamSelector() {
})
if (isLoading) {
return <div>Loading...</div>
return <div>{m.loading()}</div>
}
const teams = teamsData?.data
@@ -39,9 +39,7 @@ export function TeamSelector() {
<DialogContent>
<DialogHeader>
<DialogTitle>{m.select_a_team()}</DialogTitle>
<DialogDescription>
You are a member of multiple teams. Please select one to continue.
</DialogDescription>
<DialogDescription>{m.select_team_description()}</DialogDescription>
</DialogHeader>
<div className="space-y-2">
{teams?.map((team) => (
+5 -4
View File
@@ -1,6 +1,7 @@
import { useEffect, useState } from 'react'
import { Monitor, Moon, Sun } from 'lucide-react'
import { cn } from '../lib/utils'
import { m } from '@/ui/paraglide/messages.js'
type Theme = 'light' | 'dark' | 'system'
@@ -53,14 +54,14 @@ export function ThemeSwitcher() {
}
const options: { value: Theme; icon: typeof Sun; label: string }[] = [
{ value: 'light', icon: Sun, label: 'Light' },
{ value: 'dark', icon: Moon, label: 'Dark' },
{ value: 'system', icon: Monitor, label: 'System' },
{ value: 'light', icon: Sun, label: m.light() },
{ value: 'dark', icon: Moon, label: m.dark() },
{ value: 'system', icon: Monitor, label: m.system() },
]
return (
<div className="space-y-2">
<div className="px-1 text-xs font-semibold text-sidebar-foreground/60">THEME</div>
<div className="px-1 text-xs font-semibold text-sidebar-foreground/60">{m.theme()}</div>
<div className="flex items-center gap-1 rounded-lg bg-sidebar-accent p-1">
{options.map(({ value, icon: Icon, label }) => (
<button
+8 -7
View File
@@ -20,6 +20,7 @@ import { useNavigate } from '@tanstack/react-router'
import { Check } from 'lucide-react'
import { APP_VERSION } from '../version'
import { useTheme } from './theme-provider'
import { m } from '@/ui/paraglide/messages.js'
const Github = (props: React.SVGProps<SVGSVGElement>) => (
<svg
@@ -101,28 +102,28 @@ export function UserMenu() {
</>
)}
<DropdownMenuSub>
<DropdownMenuSubTrigger>Theme</DropdownMenuSubTrigger>
<DropdownMenuSubTrigger>{m.theme()}</DropdownMenuSubTrigger>
<DropdownMenuPortal>
<DropdownMenuSubContent>
<DropdownMenuItem
className="justify-between flex items-center"
onClick={() => setTheme('light')}
>
<span>Light</span>
<span>{m.light()}</span>
{theme === 'light' && <Check className="size-4" />}
</DropdownMenuItem>
<DropdownMenuItem
className="justify-between flex items-center"
onClick={() => setTheme('dark')}
>
<span>Dark</span>
<span>{m.dark()}</span>
{theme === 'dark' && <Check className="size-4" />}
</DropdownMenuItem>
<DropdownMenuItem
className="justify-between flex items-center"
onClick={() => setTheme('system')}
>
<span>System</span>
<span>{m.system()}</span>
{theme === 'system' && <Check className="size-4" />}
</DropdownMenuItem>
</DropdownMenuSubContent>
@@ -138,11 +139,11 @@ export function UserMenu() {
}
disabled={!teamId}
>
Settings
{m.settings()}
</DropdownMenuItem>
<DropdownMenuSeparator />
<DropdownMenuItem className="text-red-500 focus:text-red-500" onClick={handleLogout}>
Log out
{m.log_out()}
</DropdownMenuItem>
<DropdownMenuSeparator />
<DropdownMenuItem
@@ -152,7 +153,7 @@ export function UserMenu() {
}
>
<Github className="size-3.5" />
<span>Version {APP_VERSION}</span>
<span>{m.version({ version: APP_VERSION })}</span>
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>