fix(testcase): improve empty state layout and i18n

This commit is contained in:
cfngc4594 2026-05-29 13:08:54 +08:00
parent 65edacea8c
commit a13e9a92e1
4 changed files with 45 additions and 42 deletions

View File

@ -213,7 +213,8 @@
}, },
"Testcase": { "Testcase": {
"Table": { "Table": {
"Case": "Case" "Case": "Case",
"Empty": "No test cases found for this problem."
} }
}, },
"WorkspaceEditorHeader": { "WorkspaceEditorHeader": {

View File

@ -213,7 +213,8 @@
}, },
"Testcase": { "Testcase": {
"Table": { "Table": {
"Case": "样例" "Case": "样例",
"Empty": "该题目暂无测试用例。"
} }
}, },
"WorkspaceEditorHeader": { "WorkspaceEditorHeader": {

View File

@ -11,7 +11,7 @@ interface TestcasePanelProps {
export const TestcasePanel = ({ problemId }: TestcasePanelProps) => { export const TestcasePanel = ({ problemId }: TestcasePanelProps) => {
return ( return (
<PanelLayout> <PanelLayout isScroll={false}>
<Suspense fallback={<TestcaseContentSkeleton />}> <Suspense fallback={<TestcaseContentSkeleton />}>
<TestcaseContent problemId={problemId} /> <TestcaseContent problemId={problemId} />
</Suspense> </Suspense>

View File

@ -2,7 +2,7 @@ import prisma from "@/lib/prisma";
import { Input } from "@/components/ui/input"; import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label"; import { Label } from "@/components/ui/label";
import { getTranslations } from "next-intl/server"; import { getTranslations } from "next-intl/server";
import { Card, CardContent } from "@/components/ui/card"; import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area";
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
interface TestcaseTableProps { interface TestcaseTableProps {
@ -19,15 +19,14 @@ export const TestcaseTable = async ({ problemId }: TestcaseTableProps) => {
if (testcases.length === 0) { if (testcases.length === 0) {
return ( return (
<Card> <div className="flex h-full w-full items-center justify-center p-4 text-center text-muted-foreground">
<CardContent className="p-4 text-center"> {t("Empty")}
No testcases found for this problem. </div>
</CardContent>
</Card>
); );
} }
return ( return (
<ScrollArea className="h-full">
<Tabs defaultValue={testcases[0].id} className="items-center px-5 py-4"> <Tabs defaultValue={testcases[0].id} className="items-center px-5 py-4">
<TabsList className="bg-transparent p-0"> <TabsList className="bg-transparent p-0">
{testcases.map((testcase, index) => ( {testcases.map((testcase, index) => (
@ -62,5 +61,7 @@ export const TestcaseTable = async ({ problemId }: TestcaseTableProps) => {
</TabsContent> </TabsContent>
))} ))}
</Tabs> </Tabs>
<ScrollBar orientation="horizontal" />
</ScrollArea>
); );
}; };