Merge pull request #191 from shumaiOne/feat/comment-delete-video-shortcuts

feat(comments): support comment deletion and video player shortcuts
This commit is contained in:
Yiling-J
2026-07-16 11:16:18 +08:00
committed by GitHub
19 changed files with 575 additions and 62 deletions
+25
View File
@@ -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)
+14
View File
@@ -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')
+156
View File
@@ -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,161 @@ 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('deleteComment cleans up S3 attachment files and database records', async () => {
const { user, project, assets } = await setupBasicAssets()
// 1. Add user as team owner
await prisma.teamMember.create({
data: {
teamId: project.teamId,
userId: user.id,
role: 'owner',
},
})
// 2. Create StorageKey and Asset for attachment
const storageKey = await prisma.storageKey.create({
data: {
key: 'attachments/test-attachment-file.png',
status: 'active',
},
})
const attachmentAsset = await prisma.asset.create({
data: {
name: 'test-attachment-file.png',
type: AssetType.file,
projectId: project.id,
parentId: assets.root.id,
creatorId: user.id,
storageKeyId: storageKey.id,
sizeByte: 100,
status: 'uploaded',
},
})
// 3. Create a comment with this attachment
const comment = await assetService.createComment({
assetId: assets.fileA1.id,
userId: user.id,
message: 'Comment with attachment',
attachmentIds: [attachmentAsset.id],
})
// Verify it is created in DB
const dbComment = await prisma.assetComment.findUnique({
where: { id: comment.id },
include: { attachments: true },
})
expect(dbComment?.attachments.length).toBe(1)
// 4. Delete the comment
await expect(
assetService.deleteComment({ commentId: comment.id, userId: user.id }),
).resolves.not.toThrow()
// 5. Verify the comment is deleted from DB
await expect(prisma.assetComment.findUnique({ where: { id: comment.id } })).resolves.toBeNull()
// 6. Verify that the attachment Asset and StorageKey are deleted from DB
await expect(prisma.asset.findUnique({ where: { id: attachmentAsset.id } })).resolves.toBeNull()
await expect(prisma.storageKey.findUnique({ where: { id: storageKey.id } })).resolves.toBeNull()
// 7. Verify S3 deletion was called
const { s3Service } = await import('@shumai/core/src/s3/s3')
expect(s3Service.deleteObject).toHaveBeenCalledWith(
'shumai',
'attachments/test-attachment-file.png',
)
})
it('can create and retrieve comments with video timestamp', async () => {
const { user, assets } = await setupBasicAssets()
+86
View File
@@ -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<void> {
const comment = await this.prismaClient.assetComment.findUnique({
where: { id: commentId },
include: {
attachments: {
include: {
asset: {
include: {
storageKey: true,
},
},
},
},
asset: {
select: {
project: { select: { id: true, teamId: true } },
},
},
},
})
if (!comment) {
throw new HTTPException(404, { message: 'Comment not found' })
}
const teamId = comment.asset.project?.teamId
if (!teamId) {
throw new HTTPException(400, {
message: 'Data corruption: Comment asset is not associated with a project',
})
}
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' })
}
// Clean up attachment files from S3/storage and delete their DB records
const bucket = process.env.S3_BUCKET || 'shumai'
for (const att of comment.attachments) {
const asset = att.asset
if (asset.storageKey) {
try {
await s3Service.deleteObject(bucket, asset.storageKey.key)
} catch (err) {
logger.error({ err, assetId: asset.id }, 'Failed to delete attachment file from S3')
}
}
await this.prismaClient.asset.delete({
where: { id: asset.id },
})
if (asset.storageKey) {
await this.prismaClient.storageKey
.delete({
where: { id: asset.storageKey.id },
})
.catch(() => {
// Silently ignore if already deleted
})
}
}
await this.prismaClient.assetComment.delete({
where: { id: commentId },
})
}
async listComments(
assetId: string,
params: PaginationParams,
+110 -9
View File
@@ -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<MessageCardProps> = ({
},
})
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<MessageCardProps> = ({
{/* Content */}
<div className="flex-1 min-w-0">
<div className="flex items-center gap-2 mb-1">
<span className="font-semibold text-sm">{creator?.name || 'Unknown'}</span>
<span className="text-xs text-gray-400">
{new Date(message.createdAt!).toLocaleTimeString([], {
hour: '2-digit',
minute: '2-digit',
})}
</span>
<div className="flex items-center justify-between w-full mb-1">
<div className="flex items-center gap-2">
<span className="font-semibold text-sm">{creator?.name || 'Unknown'}</span>
<span className="text-xs text-gray-400">
{new Date(message.createdAt!).toLocaleTimeString([], {
hour: '2-digit',
minute: '2-digit',
})}
</span>
</div>
{canDelete && (
<div className="opacity-0 group-hover:opacity-100 transition-opacity">
<DropdownMenu modal={false}>
<DropdownMenuTrigger asChild>
<Button
size="icon-xs"
variant="ghost"
className="h-6 w-6 cursor-pointer"
onClick={(e) => e.stopPropagation()}
>
<MoreHorizontal className="h-4 w-4 text-foreground/70" />
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end" onClick={(e) => e.stopPropagation()}>
<DropdownMenuItem
className="text-destructive focus:text-destructive cursor-pointer"
onClick={(e) => {
e.stopPropagation()
setIsDeleteDialogOpen(true)
}}
>
<Trash2 className="mr-2 h-4 w-4" />
<span>{m.delete()}</span>
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
</div>
)}
</div>
<div className="flow-root mt-1">
@@ -664,6 +735,36 @@ export const MessageCard: React.FC<MessageCardProps> = ({
</div>
</DialogContent>
</Dialog>
<AlertDialog open={isDeleteDialogOpen} onOpenChange={setIsDeleteDialogOpen}>
<AlertDialogContent onClick={(e) => e.stopPropagation()}>
<AlertDialogHeader>
<AlertDialogTitle>{m.delete_comment_confirm()}</AlertDialogTitle>
<AlertDialogDescription>{m.delete_comment_description()}</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel
disabled={isDeleting}
onClick={(e) => {
e.stopPropagation()
setIsDeleteDialogOpen(false)
}}
>
{m.cancel()}
</AlertDialogCancel>
<AlertDialogAction
className="bg-destructive hover:bg-destructive/90 text-white"
disabled={isDeleting}
onClick={(e) => {
e.stopPropagation()
deleteComment()
}}
>
{m.delete()}
</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
</div>
)
}
@@ -149,6 +149,47 @@ 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 instanceof HTMLElement && activeEl.isContentEditable))
) {
return
}
const isSpace = e.key === ' '
const isInteractive =
activeEl &&
(activeEl.tagName === 'BUTTON' ||
activeEl.tagName === 'A' ||
activeEl.tagName === 'SELECT' ||
activeEl.tagName === 'OPTION' ||
activeEl.getAttribute('role') === 'button' ||
activeEl.getAttribute('role') === 'link' ||
activeEl.getAttribute('role') === 'checkbox' ||
activeEl.getAttribute('role') === 'radio' ||
activeEl.getAttribute('role') === 'menuitem')
if (isSpace && isInteractive) {
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],
@@ -1,30 +1,30 @@
import { client } from '@/ui/api/client'
import type { AssetInfo, FieldValueInfo } from '@shumai/dtos'
import { m } from '@/ui/paraglide/messages.js'
import type { AssetInfo, FieldValueInfo } from '@shumai/dtos'
import { useQuery } from '@tanstack/react-query'
import { Badge } from '@/ui/components/ui/badge'
import { Button } from '@/ui/components/ui/button'
import { Checkbox } from '@/ui/components/ui/checkbox'
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuSeparator,
DropdownMenuTrigger,
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuSeparator,
DropdownMenuTrigger,
} from '@/ui/components/ui/dropdown-menu'
import { EditableText } from '@/ui/components/ui/editable-text'
import { ProgressCircle } from '@/ui/components/ui/progress-circle'
import { Skeleton } from '@/ui/components/ui/skeleton'
import { formatTimeAgo } from '@/ui/lib/time'
import { cn } from '@/ui/lib/utils'
import { useUploadStore } from '@/ui/stores/upload'
import { useDraggable, useDroppable } from '@dnd-kit/react'
import { Download, Edit, History, MoreHorizontal, Trash2 } from 'lucide-react'
import React, { useEffect, useMemo, useRef, useState } from 'react'
import type { DragState } from '../dnd-types'
import FieldRenderer from '../field-renderer'
import { FilePreview } from './file-preview'
import { useUploadStore } from '@/ui/stores/upload'
import { ProgressCircle } from '@/ui/components/ui/progress-circle'
import { FieldType, type FieldInfo as MetadataFieldInfo } from '@shumai/dtos'
import { FIELD_TYPE_ICONS } from '../fields-manager'
@@ -282,7 +282,7 @@ export function FileCard({
</div>
<div className="flex items-center justify-between gap-2 p-3">
<div className="min-w-0 flex-1">
<div className="min-w-0 flex-1 line-clamp-3 h-[3lh]">
<EditableText
ref={inputRef}
value={name}
@@ -14,8 +14,8 @@ const EditableText = React.forwardRef<HTMLInputElement, EditableTextProps>(
className={cn(
'h-auto min-h-0 w-full rounded-sm border px-1 py-0.5 text-base shadow-none transition-all outline-none focus-visible:ring-0',
!disabled
? 'border-blue-500 bg-muted/10 ring-1 ring-blue-500'
: 'border-transparent bg-transparent cursor-default opacity-100 focus-visible:border-transparent focus-visible:ring-0 caret-transparent select-none',
? 'border-blue-500 !bg-muted/10 ring-1 ring-blue-500'
: 'border-transparent !bg-transparent cursor-default opacity-100 focus-visible:border-transparent focus-visible:ring-0 caret-transparent select-none',
className,
)}
onClick={(e) => {
@@ -194,7 +194,7 @@ export const CompareImagePane = forwardRef<ComparePaneHandle, CompareImagePanePr
return (
<div
ref={containerRef}
className="relative flex-1 overflow-hidden bg-gray-100 dark:bg-gray-950"
className="relative flex-1 overflow-hidden bg-black"
onMouseDown={onActivate}
>
<DrawingCanvas
@@ -413,6 +413,47 @@ const VideoViewer = React.forwardRef<MediaController, FileViewerProps>(
}
}, [])
useEffect(() => {
const handleKeyDown = (e: KeyboardEvent) => {
const activeEl = document.activeElement
if (
activeEl &&
(activeEl.tagName === 'INPUT' ||
activeEl.tagName === 'TEXTAREA' ||
(activeEl instanceof HTMLElement && activeEl.isContentEditable))
) {
return
}
const isSpace = e.key === ' '
const isInteractive =
activeEl &&
(activeEl.tagName === 'BUTTON' ||
activeEl.tagName === 'A' ||
activeEl.tagName === 'SELECT' ||
activeEl.tagName === 'OPTION' ||
activeEl.getAttribute('role') === 'button' ||
activeEl.getAttribute('role') === 'link' ||
activeEl.getAttribute('role') === 'checkbox' ||
activeEl.getAttribute('role') === 'radio' ||
activeEl.getAttribute('role') === 'menuitem')
if (isSpace && isInteractive) {
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
+3 -2
View File
@@ -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."
}
+3 -2
View File
@@ -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": "您确定要删除这条评论吗?此操作将无法撤回。"
}
+2 -1
View File
@@ -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;
+3 -2
View File
@@ -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'
export * from './select_agent.js'
export * from './delete_comment_confirm.js'
export * from './delete_comment_description.js'
@@ -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<Settings_SavedInputs, {
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Delete_Comment_ConfirmInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type Settings_SavedInputs = {};
export type Delete_Comment_ConfirmInputs = {};
@@ -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<Delete_Comment_ConfirmInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_delete_comment_confirm(inputs)
return zh_delete_comment_confirm(inputs)
});
+16
View File
@@ -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<Delete_Comment_DescriptionInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type Delete_Comment_DescriptionInputs = {};
@@ -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<Delete_Comment_DescriptionInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_delete_comment_description(inputs)
return zh_delete_comment_description(inputs)
});
-29
View File
@@ -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<Settings_SavedInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_settings_saved(inputs)
return zh_settings_saved(inputs)
});