From 62b1fc1d37ae917e1225b14e2ddf2dc3730e6ecc Mon Sep 17 00:00:00 2001 From: yiling Date: Thu, 16 Jul 2026 09:55:05 +0800 Subject: [PATCH] feat(comments): support comment deletion and video player shortcuts --- packages/api/src/file.test.ts | 25 ++++ packages/api/src/file.ts | 14 +++ packages/core/src/asset/asset.test.ts | 88 +++++++++++++ packages/core/src/asset/asset.ts | 86 +++++++++++++ .../webui/components/chat/message-card.tsx | 119 ++++++++++++++++-- .../components/compare/compare-viewer.tsx | 25 ++++ .../components/viewers/video/video-viewer.tsx | 25 ++++ packages/webui/messages/en.json | 5 +- packages/webui/messages/zh.json | 5 +- packages/webui/paraglide/messages/_index.d.ts | 3 +- packages/webui/paraglide/messages/_index.js | 5 +- ...saved.d.ts => delete_comment_confirm.d.ts} | 10 +- .../messages/delete_comment_confirm.js | 29 +++++ .../messages/delete_comment_description.d.ts | 16 +++ .../messages/delete_comment_description.js | 29 +++++ .../paraglide/messages/settings_saved.js | 29 ----- 16 files changed, 463 insertions(+), 50 deletions(-) rename packages/webui/paraglide/messages/{settings_saved.d.ts => delete_comment_confirm.d.ts} (55%) create mode 100644 packages/webui/paraglide/messages/delete_comment_confirm.js create mode 100644 packages/webui/paraglide/messages/delete_comment_description.d.ts create mode 100644 packages/webui/paraglide/messages/delete_comment_description.js delete mode 100644 packages/webui/paraglide/messages/settings_saved.js diff --git a/packages/api/src/file.test.ts b/packages/api/src/file.test.ts index 4811c365..ec54533e 100644 --- a/packages/api/src/file.test.ts +++ b/packages/api/src/file.test.ts @@ -57,6 +57,7 @@ describe('file api', () => { vi.spyOn(assetService, 'deleteAssets').mockImplementation(vi.fn()) vi.spyOn(assetService, 'createComment').mockImplementation(vi.fn()) vi.spyOn(assetService, 'completeComment').mockImplementation(vi.fn()) + vi.spyOn(assetService, 'deleteComment').mockImplementation(vi.fn()) vi.spyOn(assetService, 'listComments').mockImplementation(vi.fn()) vi.spyOn(assetService, 'restoreAssets').mockImplementation(vi.fn()) vi.spyOn(metadataService, 'updateAssetMetadata').mockImplementation(vi.fn()) @@ -358,6 +359,30 @@ describe('file api', () => { }) }) + it('DELETE /comments/:commentId', async () => { + vi.mocked(assetService.deleteComment).mockResolvedValue(undefined) + + const app = new Hono().use('*', authMiddleware).route('/', fileRoute) + const res = await app.request('/comments/comment-id', { + method: 'DELETE', + }) + + expect(res.status).toBe(200) + const json = await res.json() + expect(json.success).toBe(true) + + expect(authzService.hasPermission).toHaveBeenCalledWith({ + user: { id: 'user1', name: 'Test User' }, + permission: Permission.Read, + type: ResourceType.Comment, + id: 'comment-id', + }) + expect(assetService.deleteComment).toHaveBeenCalledWith({ + commentId: 'comment-id', + userId: 'user1', + }) + }) + it('POST /teams/:teamId/files - image with compression', async () => { vi.mocked(s3Service.putObject).mockResolvedValue(undefined) diff --git a/packages/api/src/file.ts b/packages/api/src/file.ts index c40be830..1b8a2aee 100644 --- a/packages/api/src/file.ts +++ b/packages/api/src/file.ts @@ -220,6 +220,20 @@ const route = new Hono<{ Variables: { user: User } }>() return c.json(updated) }, ) + .delete('/comments/:commentId', async (c) => { + const commentId = c.req.param('commentId') + const user = c.get('user') + + await authzService.hasPermission({ + user, + permission: Permission.Read, + type: ResourceType.Comment, + id: commentId, + }) + + await assetService.deleteComment({ commentId, userId: user.id }) + return c.json({ success: true }) + }) .post('/files/restore', zValidator('json', restoreFilesRequestSchema), async (c) => { const user = c.get('user') const req = c.req.valid('json') diff --git a/packages/core/src/asset/asset.test.ts b/packages/core/src/asset/asset.test.ts index 588cb0ef..b85628f3 100644 --- a/packages/core/src/asset/asset.test.ts +++ b/packages/core/src/asset/asset.test.ts @@ -1,6 +1,7 @@ import { describe, expect, it, vi, beforeEach, afterEach } from 'vitest' import { prisma } from '@shumai/db' import { setupTestDbHooks } from '@shumai/db/test' +import { HTTPException } from 'hono/http-exception' import { AssetType, AssetStatus, Prisma } from '@shumai/db' import { AssetService } from './asset' @@ -721,6 +722,93 @@ describe('AssetService', () => { expect(list.data[0].replies.length).toBe(1) }) + it('deleteComment validation and execution', async () => { + const { user, project, assets } = await setupBasicAssets() + + // 1. Create a comment + const comment = await assetService.createComment({ + assetId: assets.fileA1.id, + userId: user.id, + message: 'Self Comment', + attachmentIds: [], + }) + + // 2. Add user as a team member with owner role (team owner) + await prisma.teamMember.create({ + data: { + teamId: project.teamId, + userId: user.id, + role: 'owner', + }, + }) + + // Create another user + const otherUser = await prisma.user.create({ + data: { + name: 'OtherUser', + type: 'human', + email: `other-${Date.now()}@example.com`, + }, + }) + + // Add other user to the team as editor + await prisma.teamMember.create({ + data: { + teamId: project.teamId, + userId: otherUser.id, + role: 'editor', + }, + }) + + // Create comment by other user + const otherComment = await assetService.createComment({ + assetId: assets.fileA1.id, + userId: otherUser.id, + message: 'Other Comment', + attachmentIds: [], + }) + + // 3. User (owner) should be able to delete their own comment + await expect( + assetService.deleteComment({ commentId: comment.id, userId: user.id }), + ).resolves.not.toThrow() + // Verify it is deleted from DB + await expect(prisma.assetComment.findUnique({ where: { id: comment.id } })).resolves.toBeNull() + + // 4. User (owner) should be able to delete other user's comment + await expect( + assetService.deleteComment({ commentId: otherComment.id, userId: user.id }), + ).resolves.not.toThrow() + // Verify it is deleted from DB + await expect( + prisma.assetComment.findUnique({ where: { id: otherComment.id } }), + ).resolves.toBeNull() + + // Create a new comment by user + const comment2 = await assetService.createComment({ + assetId: assets.fileA1.id, + userId: user.id, + message: 'Self Comment 2', + attachmentIds: [], + }) + + // 5. Other user (editor, non-creator) should NOT be able to delete user's comment + await expect( + assetService.deleteComment({ commentId: comment2.id, userId: otherUser.id }), + ).rejects.toThrow(HTTPException) + + // 6. Other user (editor, creator) should be able to delete their own comment + const otherComment2 = await assetService.createComment({ + assetId: assets.fileA1.id, + userId: otherUser.id, + message: 'Other Comment 2', + attachmentIds: [], + }) + await expect( + assetService.deleteComment({ commentId: otherComment2.id, userId: otherUser.id }), + ).resolves.not.toThrow() + }) + it('can create and retrieve comments with video timestamp', async () => { const { user, assets } = await setupBasicAssets() diff --git a/packages/core/src/asset/asset.ts b/packages/core/src/asset/asset.ts index 099aeac5..84a79aa8 100644 --- a/packages/core/src/asset/asset.ts +++ b/packages/core/src/asset/asset.ts @@ -18,6 +18,7 @@ import { AssetUserInfo, } from '@shumai/dtos' import { type Asset, AssetStatus, AssetType, Prisma, type StorageKey } from '@shumai/db' +import { HTTPException } from 'hono/http-exception' import { logger } from '@shumai/core/src/logger' import { PaginatedData, paginateQuery, PaginationParams } from '@shumai/core/src/pagination' import { s3Service } from '@shumai/core/src/s3/s3' @@ -1413,6 +1414,91 @@ export class AssetService { return this.getComment(commentId) } + async deleteComment({ commentId, userId }: { commentId: string; userId: string }): Promise { + interface AssetContext { + parentId: string | null + teamRootFolder: { id: string } | null + project: { id: string; teamId: string } | null + } + + const comment = await this.prismaClient.assetComment.findUnique({ + where: { id: commentId }, + include: { + asset: { + select: { + parentId: true, + teamRootFolder: { select: { id: true } }, + project: { select: { id: true, teamId: true } }, + }, + }, + }, + }) + + if (!comment) { + throw new HTTPException(404, { message: 'Comment not found' }) + } + + let teamId: string | null = null + if (comment.asset.project) { + teamId = comment.asset.project.teamId + } else if (comment.asset.teamRootFolder) { + teamId = comment.asset.teamRootFolder.id + } else { + let currentAsset: AssetContext | null = comment.asset + while (currentAsset && !teamId) { + if (currentAsset.project) { + teamId = currentAsset.project.teamId + break + } + if (currentAsset.teamRootFolder) { + teamId = currentAsset.teamRootFolder.id + break + } + if (currentAsset.parentId) { + const parent: AssetContext | null = await this.prismaClient.asset.findUnique({ + where: { id: currentAsset.parentId }, + select: { + parentId: true, + teamRootFolder: { select: { id: true } }, + project: { select: { id: true, teamId: true } }, + }, + }) + currentAsset = parent + } else { + break + } + } + } + + if (!teamId) { + throw new HTTPException(403, { message: 'Could not resolve team context for comment' }) + } + + const member = await this.prismaClient.teamMember.findUnique({ + where: { + teamIdUserId: { + teamId, + userId, + }, + }, + }) + + if (!member) { + throw new HTTPException(403, { message: 'User is not a member of the team' }) + } + + const isOwner = member.role === 'owner' + const isCreator = comment.creatorId === userId + + if (!isOwner && !isCreator) { + throw new HTTPException(403, { message: 'You do not have permission to delete this comment' }) + } + + await this.prismaClient.assetComment.delete({ + where: { id: commentId }, + }) + } + async listComments( assetId: string, params: PaginationParams, diff --git a/packages/webui/components/chat/message-card.tsx b/packages/webui/components/chat/message-card.tsx index 10e7eab4..7c6d0cb7 100644 --- a/packages/webui/components/chat/message-card.tsx +++ b/packages/webui/components/chat/message-card.tsx @@ -7,11 +7,27 @@ import { DialogHeader, DialogTitle, } from '@/ui/components/ui/dialog' +import { + DropdownMenu, + DropdownMenuContent, + DropdownMenuItem, + DropdownMenuTrigger, +} from '@/ui/components/ui/dropdown-menu' +import { + AlertDialog, + AlertDialogAction, + AlertDialogCancel, + AlertDialogContent, + AlertDialogDescription, + AlertDialogFooter, + AlertDialogHeader, + AlertDialogTitle, +} from '@/ui/components/ui/alert-dialog' import { Separator } from '@/ui/components/ui/separator' import { formatTimeAgo } from '@/ui/lib/time' import type { AttachmentInfo, CommentInfo, UserInfo } from '@shumai/dtos' import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query' -import { Download, File, Terminal } from 'lucide-react' +import { Download, File, Terminal, MoreHorizontal, Trash2 } from 'lucide-react' import React from 'react' import Markdown from 'react-markdown' import { Avatar, AvatarFallback, AvatarImage } from '../ui/avatar' @@ -145,6 +161,31 @@ export const MessageCard: React.FC = ({ }, }) + const [isDeleteDialogOpen, setIsDeleteDialogOpen] = React.useState(false) + + const { mutate: deleteComment, isPending: isDeleting } = useMutation({ + mutationFn: async () => { + const res = await client.api.comments[':commentId'].$delete({ + param: { commentId: message.id }, + }) + if (!res.ok) throw new Error('Failed to delete comment') + return await res.json() + }, + onSuccess: () => { + queryClient.invalidateQueries({ + predicate: (query) => query.queryKey.includes('comments'), + }) + setIsDeleteDialogOpen(false) + }, + }) + + const canDelete = React.useMemo(() => { + if (!me) return false + if (me.role === 'owner') return true + if (message.creator?.id === me.id) return true + return false + }, [me, message.creator?.id]) + const { data: logs, isLoading: isLogsLoading } = useQuery({ queryKey: ['agent-sessions', message.sessionId, 'entries'], queryFn: async () => { @@ -222,14 +263,44 @@ export const MessageCard: React.FC = ({ {/* Content */}
-
- {creator?.name || 'Unknown'} - - {new Date(message.createdAt!).toLocaleTimeString([], { - hour: '2-digit', - minute: '2-digit', - })} - +
+
+ {creator?.name || 'Unknown'} + + {new Date(message.createdAt!).toLocaleTimeString([], { + hour: '2-digit', + minute: '2-digit', + })} + +
+ {canDelete && ( +
+ + + + + e.stopPropagation()}> + { + e.stopPropagation() + setIsDeleteDialogOpen(true) + }} + > + + {m.delete()} + + + +
+ )}
@@ -664,6 +735,36 @@ export const MessageCard: React.FC = ({
+ + + e.stopPropagation()}> + + {m.delete_comment_confirm()} + {m.delete_comment_description()} + + + { + e.stopPropagation() + setIsDeleteDialogOpen(false) + }} + > + {m.cancel()} + + { + e.stopPropagation() + deleteComment() + }} + > + {m.delete()} + + + +
) } diff --git a/packages/webui/components/compare/compare-viewer.tsx b/packages/webui/components/compare/compare-viewer.tsx index 8331234d..b9af17f2 100644 --- a/packages/webui/components/compare/compare-viewer.tsx +++ b/packages/webui/components/compare/compare-viewer.tsx @@ -149,6 +149,31 @@ export function CompareViewer({ applyBoth((h) => (shouldPlay ? h.play() : h.pause())) }, [activeState?.video?.isPlaying, applyBoth]) + useEffect(() => { + const handleKeyDown = (e: KeyboardEvent) => { + const activeEl = document.activeElement + if ( + activeEl && + (activeEl.tagName === 'INPUT' || + activeEl.tagName === 'TEXTAREA' || + activeEl.hasAttribute('contenteditable') || + activeEl.getAttribute('contenteditable') === 'true') + ) { + return + } + + if (e.key === ' ' || e.key.toLowerCase() === 'k') { + e.preventDefault() + handleTogglePlay() + } + } + + window.addEventListener('keydown', handleKeyDown) + return () => { + window.removeEventListener('keydown', handleKeyDown) + } + }, [handleTogglePlay]) + const handleSeek = useCallback( (frame: number) => applyBoth((h) => h.seekToFrame(frame)), [applyBoth], diff --git a/packages/webui/components/viewers/video/video-viewer.tsx b/packages/webui/components/viewers/video/video-viewer.tsx index 6107d109..5d7b0039 100644 --- a/packages/webui/components/viewers/video/video-viewer.tsx +++ b/packages/webui/components/viewers/video/video-viewer.tsx @@ -413,6 +413,31 @@ const VideoViewer = React.forwardRef( } }, []) + useEffect(() => { + const handleKeyDown = (e: KeyboardEvent) => { + const activeEl = document.activeElement + if ( + activeEl && + (activeEl.tagName === 'INPUT' || + activeEl.tagName === 'TEXTAREA' || + activeEl.hasAttribute('contenteditable') || + activeEl.getAttribute('contenteditable') === 'true') + ) { + return + } + + if (e.key === ' ' || e.key.toLowerCase() === 'k') { + e.preventDefault() + togglePlay() + } + } + + window.addEventListener('keydown', handleKeyDown) + return () => { + window.removeEventListener('keydown', handleKeyDown) + } + }, [togglePlay]) + const toggleLoop = () => { const player = playerRef.current if (!player) return diff --git a/packages/webui/messages/en.json b/packages/webui/messages/en.json index 94957c8e..fb6f259e 100644 --- a/packages/webui/messages/en.json +++ b/packages/webui/messages/en.json @@ -840,6 +840,7 @@ "global_chatbot_description": "Select the agent that handles conversation inside the global chatbot sidebar.", "select_chatbot_agent": "Select chatbot agent", "no_chat_agents_warning": "No chat agents found. Please create a Chat Agent below first.", - "settings_saved": "Settings saved successfully", - "select_agent": "Select Agent" + "select_agent": "Select Agent", + "delete_comment_confirm": "Delete Comment?", + "delete_comment_description": "Are you sure you want to delete this comment? This action cannot be undone." } diff --git a/packages/webui/messages/zh.json b/packages/webui/messages/zh.json index 95a2817f..35731673 100644 --- a/packages/webui/messages/zh.json +++ b/packages/webui/messages/zh.json @@ -840,6 +840,7 @@ "global_chatbot_description": "选择在全局聊天机器人边栏中进行对话的智能体。", "select_chatbot_agent": "选择聊天机器人智能体", "no_chat_agents_warning": "未找到聊天智能体。请先在下方创建聊天智能体。", - "settings_saved": "设置保存成功", - "select_agent": "选择智能体" + "select_agent": "选择智能体", + "delete_comment_confirm": "删除评论?", + "delete_comment_description": "您确定要删除这条评论吗?此操作将无法撤回。" } diff --git a/packages/webui/paraglide/messages/_index.d.ts b/packages/webui/paraglide/messages/_index.d.ts index d01cd3ae..a8b3e03f 100644 --- a/packages/webui/paraglide/messages/_index.d.ts +++ b/packages/webui/paraglide/messages/_index.d.ts @@ -786,6 +786,7 @@ export * from "./global_chatbot.js"; export * from "./global_chatbot_description.js"; export * from "./select_chatbot_agent.js"; export * from "./no_chat_agents_warning.js"; -export * from "./settings_saved.js"; export * from "./select_agent.js"; +export * from "./delete_comment_confirm.js"; +export * from "./delete_comment_description.js"; export type LocalizedString = import("../runtime.js").LocalizedString; diff --git a/packages/webui/paraglide/messages/_index.js b/packages/webui/paraglide/messages/_index.js index 2926fc15..119aee9f 100644 --- a/packages/webui/paraglide/messages/_index.js +++ b/packages/webui/paraglide/messages/_index.js @@ -788,5 +788,6 @@ export * from './global_chatbot.js' export * from './global_chatbot_description.js' export * from './select_chatbot_agent.js' export * from './no_chat_agents_warning.js' -export * from './settings_saved.js' -export * from './select_agent.js' \ No newline at end of file +export * from './select_agent.js' +export * from './delete_comment_confirm.js' +export * from './delete_comment_description.js' \ No newline at end of file diff --git a/packages/webui/paraglide/messages/settings_saved.d.ts b/packages/webui/paraglide/messages/delete_comment_confirm.d.ts similarity index 55% rename from packages/webui/paraglide/messages/settings_saved.d.ts rename to packages/webui/paraglide/messages/delete_comment_confirm.d.ts index c2376844..58d40ee5 100644 --- a/packages/webui/paraglide/messages/settings_saved.d.ts +++ b/packages/webui/paraglide/messages/delete_comment_confirm.d.ts @@ -1,16 +1,16 @@ /** * | output | * | --- | -* | "Settings saved successfully" | +* | "Delete Comment?" | * -* @param {Settings_SavedInputs} inputs +* @param {Delete_Comment_ConfirmInputs} inputs * @param {{ locale?: "en" | "zh" }} options * @returns {LocalizedString} */ -export const settings_saved: ((inputs?: Settings_SavedInputs, options?: { +export const delete_comment_confirm: ((inputs?: Delete_Comment_ConfirmInputs, options?: { locale?: "en" | "zh"; -}) => LocalizedString) & import("../runtime.js").MessageMetadata LocalizedString) & import("../runtime.js").MessageMetadata; export type LocalizedString = import("../runtime.js").LocalizedString; -export type Settings_SavedInputs = {}; +export type Delete_Comment_ConfirmInputs = {}; diff --git a/packages/webui/paraglide/messages/delete_comment_confirm.js b/packages/webui/paraglide/messages/delete_comment_confirm.js new file mode 100644 index 00000000..d9d4e72f --- /dev/null +++ b/packages/webui/paraglide/messages/delete_comment_confirm.js @@ -0,0 +1,29 @@ +/* eslint-disable */ +import { getLocale, experimentalStaticLocale } from '../runtime.js'; + +/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */ + +/** @typedef {{}} Delete_Comment_ConfirmInputs */ + +const en_delete_comment_confirm = /** @type {(inputs: Delete_Comment_ConfirmInputs) => LocalizedString} */ () => { + return /** @type {LocalizedString} */ (`Delete Comment?`) +}; + +const zh_delete_comment_confirm = /** @type {(inputs: Delete_Comment_ConfirmInputs) => LocalizedString} */ () => { + return /** @type {LocalizedString} */ (`删除评论?`) +}; + +/** +* | output | +* | --- | +* | "Delete Comment?" | +* +* @param {Delete_Comment_ConfirmInputs} inputs +* @param {{ locale?: "en" | "zh" }} options +* @returns {LocalizedString} +*/ +export const delete_comment_confirm = /** @type {((inputs?: Delete_Comment_ConfirmInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata} */ ((inputs = {}, options = {}) => { + const locale = experimentalStaticLocale ?? options.locale ?? getLocale() + if (locale === "en") return en_delete_comment_confirm(inputs) + return zh_delete_comment_confirm(inputs) +}); \ No newline at end of file diff --git a/packages/webui/paraglide/messages/delete_comment_description.d.ts b/packages/webui/paraglide/messages/delete_comment_description.d.ts new file mode 100644 index 00000000..3a8f1211 --- /dev/null +++ b/packages/webui/paraglide/messages/delete_comment_description.d.ts @@ -0,0 +1,16 @@ +/** +* | output | +* | --- | +* | "Are you sure you want to delete this comment? This action cannot be undone." | +* +* @param {Delete_Comment_DescriptionInputs} inputs +* @param {{ locale?: "en" | "zh" }} options +* @returns {LocalizedString} +*/ +export const delete_comment_description: ((inputs?: Delete_Comment_DescriptionInputs, options?: { + locale?: "en" | "zh"; +}) => LocalizedString) & import("../runtime.js").MessageMetadata; +export type LocalizedString = import("../runtime.js").LocalizedString; +export type Delete_Comment_DescriptionInputs = {}; diff --git a/packages/webui/paraglide/messages/delete_comment_description.js b/packages/webui/paraglide/messages/delete_comment_description.js new file mode 100644 index 00000000..1f3f803c --- /dev/null +++ b/packages/webui/paraglide/messages/delete_comment_description.js @@ -0,0 +1,29 @@ +/* eslint-disable */ +import { getLocale, experimentalStaticLocale } from '../runtime.js'; + +/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */ + +/** @typedef {{}} Delete_Comment_DescriptionInputs */ + +const en_delete_comment_description = /** @type {(inputs: Delete_Comment_DescriptionInputs) => LocalizedString} */ () => { + return /** @type {LocalizedString} */ (`Are you sure you want to delete this comment? This action cannot be undone.`) +}; + +const zh_delete_comment_description = /** @type {(inputs: Delete_Comment_DescriptionInputs) => LocalizedString} */ () => { + return /** @type {LocalizedString} */ (`您确定要删除这条评论吗?此操作将无法撤回。`) +}; + +/** +* | output | +* | --- | +* | "Are you sure you want to delete this comment? This action cannot be undone." | +* +* @param {Delete_Comment_DescriptionInputs} inputs +* @param {{ locale?: "en" | "zh" }} options +* @returns {LocalizedString} +*/ +export const delete_comment_description = /** @type {((inputs?: Delete_Comment_DescriptionInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata} */ ((inputs = {}, options = {}) => { + const locale = experimentalStaticLocale ?? options.locale ?? getLocale() + if (locale === "en") return en_delete_comment_description(inputs) + return zh_delete_comment_description(inputs) +}); \ No newline at end of file diff --git a/packages/webui/paraglide/messages/settings_saved.js b/packages/webui/paraglide/messages/settings_saved.js deleted file mode 100644 index ee681b7e..00000000 --- a/packages/webui/paraglide/messages/settings_saved.js +++ /dev/null @@ -1,29 +0,0 @@ -/* eslint-disable */ -import { getLocale, experimentalStaticLocale } from '../runtime.js'; - -/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */ - -/** @typedef {{}} Settings_SavedInputs */ - -const en_settings_saved = /** @type {(inputs: Settings_SavedInputs) => LocalizedString} */ () => { - return /** @type {LocalizedString} */ (`Settings saved successfully`) -}; - -const zh_settings_saved = /** @type {(inputs: Settings_SavedInputs) => LocalizedString} */ () => { - return /** @type {LocalizedString} */ (`设置保存成功`) -}; - -/** -* | output | -* | --- | -* | "Settings saved successfully" | -* -* @param {Settings_SavedInputs} inputs -* @param {{ locale?: "en" | "zh" }} options -* @returns {LocalizedString} -*/ -export const settings_saved = /** @type {((inputs?: Settings_SavedInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata} */ ((inputs = {}, options = {}) => { - const locale = experimentalStaticLocale ?? options.locale ?? getLocale() - if (locale === "en") return en_settings_saved(inputs) - return zh_settings_saved(inputs) -}); \ No newline at end of file