优化细节
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2026-01-04 16:54:31 +08:00
parent 7c70ec1028
commit 6c4a73d857
5 changed files with 4 additions and 38 deletions

View File

@@ -22,7 +22,7 @@
"newFolder": "New Folder", "newFolder": "New Folder",
"creating": "Creating...", "creating": "Creating...",
"noFoldersYet": "No folders yet", "noFoldersYet": "No folders yet",
"folderInfo": "{id}. {name} ({totalPairs})", "folderInfo": "ID: {id} • {totalPairs} pairs",
"enterFolderName": "Enter folder name:", "enterFolderName": "Enter folder name:",
"confirmDelete": "Type \"{name}\" to delete:" "confirmDelete": "Type \"{name}\" to delete:"
}, },

View File

@@ -22,7 +22,7 @@
"newFolder": "新建文件夹", "newFolder": "新建文件夹",
"creating": "创建中...", "creating": "创建中...",
"noFoldersYet": "还没有文件夹", "noFoldersYet": "还没有文件夹",
"folderInfo": "{id}. {name} ({totalPairs})", "folderInfo": "ID: {id} • {totalPairs} 个文本对",
"enterFolderName": "输入文件夹名称:", "enterFolderName": "输入文件夹名称:",
"confirmDelete": "输入 \"{name}\" 以删除:" "confirmDelete": "输入 \"{name}\" 以删除:"
}, },

View File

@@ -11,7 +11,7 @@ import { getTTSAudioUrl } from "@/lib/browser/tts";
import { logger } from "@/lib/logger"; import { logger } from "@/lib/logger";
import { Plus, Trash } from "lucide-react"; import { Plus, Trash } from "lucide-react";
import { useTranslations } from "next-intl"; import { useTranslations } from "next-intl";
import { useEffect, useRef, useState } from "react"; import { useRef, useState } from "react";
import z from "zod"; import z from "zod";
import AddToFolder from "./AddToFolder"; import AddToFolder from "./AddToFolder";
import { import {
@@ -35,9 +35,7 @@ export default function TranslatorPage() {
const [ipaTexts, setIpaTexts] = useState(["", ""]); const [ipaTexts, setIpaTexts] = useState(["", ""]);
const [processing, setProcessing] = useState(false); const [processing, setProcessing] = useState(false);
const { load, play } = useAudioPlayer(); const { load, play } = useAudioPlayer();
const [history, setHistory] = useState< const [history, setHistory] = useState<z.infer<typeof TranslationHistorySchema>[]>(() => tlso.get());
z.infer<typeof TranslationHistorySchema>[]
>([]);
const [showAddToFolder, setShowAddToFolder] = useState(false); const [showAddToFolder, setShowAddToFolder] = useState(false);
const [addToFolderItem, setAddToFolderItem] = useState<z.infer< const [addToFolderItem, setAddToFolderItem] = useState<z.infer<
typeof TranslationHistorySchema typeof TranslationHistorySchema
@@ -50,10 +48,6 @@ export default function TranslatorPage() {
const [autoSaveFolderId, setAutoSaveFolderId] = useState<number | null>(null); const [autoSaveFolderId, setAutoSaveFolderId] = useState<number | null>(null);
const { data: session } = authClient.useSession(); const { data: session } = authClient.useSession();
useEffect(() => {
setHistory(tlso.get());
}, []);
const tts = async (text: string, locale: string) => { const tts = async (text: string, locale: string) => {
if (lastTTS.current.text !== text) { if (lastTTS.current.text !== text) {
const shortName = VOICES.find((v) => v.locale === locale)?.short_name; const shortName = VOICES.find((v) => v.locale === locale)?.short_name;

View File

@@ -1,16 +0,0 @@
"use client";
interface ACardProps {
children?: React.ReactNode;
className?: string;
}
export default function ACard({ children, className }: ACardProps) {
return (
<div
className={`${className} w-[95dvw] md:w-[61vw] h-96 p-2 md:shadow-2xl rounded-xl`}
>
{children}
</div>
);
}

View File

@@ -1,12 +0,0 @@
"use client";
interface BCardProps {
children?: React.ReactNode;
className?: string;
}
export default function BCard({ children, className }: BCardProps) {
return (
<div className={`${className} rounded-xl p-2 shadow-xl`}>{children}</div>
);
}