fix(i18n): 补充页面缺失的中英文翻译并修复登录重定向循环
- 补充 login/signup/dictionary/srt-player/alphabet 页面的翻译 - 修复登录页面邮箱登录时 password 参数错误 - 修复登录/注册页面的无限重定向循环问题 - 调整登录/注册卡片宽度为 w-96
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"alphabet": {
|
"alphabet": {
|
||||||
"chooseCharacters": "Please select the characters you want to learn",
|
"chooseCharacters": "Please select the characters you want to learn",
|
||||||
|
"chooseAlphabetHint": "Select an alphabet to start learning",
|
||||||
"japanese": "Japanese Kana",
|
"japanese": "Japanese Kana",
|
||||||
"english": "English Alphabet",
|
"english": "English Alphabet",
|
||||||
"uyghur": "Uyghur Alphabet",
|
"uyghur": "Uyghur Alphabet",
|
||||||
@@ -14,7 +15,11 @@
|
|||||||
"roman": "Romanization",
|
"roman": "Romanization",
|
||||||
"letter": "Letter",
|
"letter": "Letter",
|
||||||
"random": "Random Mode",
|
"random": "Random Mode",
|
||||||
"randomNext": "Random Next"
|
"randomNext": "Random Next",
|
||||||
|
"previousLetter": "Previous letter",
|
||||||
|
"nextLetter": "Next letter",
|
||||||
|
"keyboardHint": "Use left/right arrow keys or space for random, ESC to go back",
|
||||||
|
"swipeHint": "Use left/right arrow keys or swipe to navigate, ESC to go back"
|
||||||
},
|
},
|
||||||
"folders": {
|
"folders": {
|
||||||
"title": "Folders",
|
"title": "Folders",
|
||||||
@@ -107,7 +112,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"auth": {
|
"auth": {
|
||||||
"title": "Authentication",
|
"title": "Sign In",
|
||||||
|
"signUpTitle": "Sign Up",
|
||||||
"signIn": "Sign In",
|
"signIn": "Sign In",
|
||||||
"signUp": "Sign Up",
|
"signUp": "Sign Up",
|
||||||
"email": "Email",
|
"email": "Email",
|
||||||
@@ -133,7 +139,18 @@
|
|||||||
"identifierRequired": "Please enter your email or username",
|
"identifierRequired": "Please enter your email or username",
|
||||||
"passwordRequired": "Please enter your password",
|
"passwordRequired": "Please enter your password",
|
||||||
"confirmPasswordRequired": "Please confirm your password",
|
"confirmPasswordRequired": "Please confirm your password",
|
||||||
"loading": "Loading..."
|
"loading": "Loading...",
|
||||||
|
"confirm": "Confirm",
|
||||||
|
"noAccountLink": "Don't have an account? Sign up",
|
||||||
|
"hasAccountLink": "Already have an account? Sign in",
|
||||||
|
"usernamePlaceholder": "Username",
|
||||||
|
"emailPlaceholder": "Email address",
|
||||||
|
"passwordPlaceholder": "Password",
|
||||||
|
"usernameOrEmailPlaceholder": "Username or email",
|
||||||
|
"loginFailed": "Login failed",
|
||||||
|
"signUpFailed": "Sign up failed",
|
||||||
|
"fillAllFields": "Please fill in all fields",
|
||||||
|
"enterCredentials": "Please enter username and password"
|
||||||
},
|
},
|
||||||
"memorize": {
|
"memorize": {
|
||||||
"folder_selector": {
|
"folder_selector": {
|
||||||
@@ -187,11 +204,17 @@
|
|||||||
"uploaded": "Uploaded",
|
"uploaded": "Uploaded",
|
||||||
"notUploaded": "Not Uploaded",
|
"notUploaded": "Not Uploaded",
|
||||||
"upload": "Upload",
|
"upload": "Upload",
|
||||||
|
"uploadVideoButton": "Upload Video",
|
||||||
|
"uploadSubtitleButton": "Upload Subtitle",
|
||||||
|
"subtitleUploaded": "Subtitle Uploaded ({count} entries)",
|
||||||
|
"subtitleNotUploaded": "Subtitle Not Uploaded",
|
||||||
"autoPauseStatus": "Auto Pause: {enabled}",
|
"autoPauseStatus": "Auto Pause: {enabled}",
|
||||||
"on": "On",
|
"on": "On",
|
||||||
"off": "Off",
|
"off": "Off",
|
||||||
"videoUploadFailed": "Video upload failed",
|
"videoUploadFailed": "Video upload failed",
|
||||||
"subtitleUploadFailed": "Subtitle upload failed"
|
"subtitleUploadFailed": "Subtitle upload failed",
|
||||||
|
"subtitleLoadSuccess": "Subtitle loaded successfully",
|
||||||
|
"subtitleLoadFailed": "Subtitle load failed"
|
||||||
},
|
},
|
||||||
"text_speaker": {
|
"text_speaker": {
|
||||||
"generateIPA": "Generate IPA",
|
"generateIPA": "Generate IPA",
|
||||||
@@ -256,7 +279,9 @@
|
|||||||
"pleaseLogin": "Please log in first",
|
"pleaseLogin": "Please log in first",
|
||||||
"pleaseCreateFolder": "Please create a folder first",
|
"pleaseCreateFolder": "Please create a folder first",
|
||||||
"savedToFolder": "Saved to folder: {folderName}",
|
"savedToFolder": "Saved to folder: {folderName}",
|
||||||
"saveFailed": "Save failed, please try again later"
|
"saveFailed": "Save failed, please try again later",
|
||||||
|
"definition": "Definition",
|
||||||
|
"example": "Example"
|
||||||
},
|
},
|
||||||
"explore": {
|
"explore": {
|
||||||
"title": "Explore",
|
"title": "Explore",
|
||||||
@@ -291,6 +316,7 @@
|
|||||||
"displayName": "Display Name",
|
"displayName": "Display Name",
|
||||||
"notSet": "Not Set",
|
"notSet": "Not Set",
|
||||||
"memberSince": "Member Since",
|
"memberSince": "Member Since",
|
||||||
|
"logout": "Logout",
|
||||||
"folders": {
|
"folders": {
|
||||||
"title": "Folders",
|
"title": "Folders",
|
||||||
"noFolders": "No folders yet",
|
"noFolders": "No folders yet",
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"alphabet": {
|
"alphabet": {
|
||||||
"chooseCharacters": "请选择您想学习的字符",
|
"chooseCharacters": "请选择您想学习的字符",
|
||||||
|
"chooseAlphabetHint": "选择一种语言的字母表开始学习",
|
||||||
"japanese": "日语假名",
|
"japanese": "日语假名",
|
||||||
"english": "英文字母",
|
"english": "英文字母",
|
||||||
"uyghur": "维吾尔字母",
|
"uyghur": "维吾尔字母",
|
||||||
@@ -14,7 +15,11 @@
|
|||||||
"roman": "罗马音",
|
"roman": "罗马音",
|
||||||
"letter": "字母",
|
"letter": "字母",
|
||||||
"random": "随机模式",
|
"random": "随机模式",
|
||||||
"randomNext": "随机下一个"
|
"randomNext": "随机下一个",
|
||||||
|
"previousLetter": "上一个字母",
|
||||||
|
"nextLetter": "下一个字母",
|
||||||
|
"keyboardHint": "使用左右箭头键或空格键随机切换,ESC键返回",
|
||||||
|
"swipeHint": "使用左右箭头键或滑动切换字母"
|
||||||
},
|
},
|
||||||
"folders": {
|
"folders": {
|
||||||
"title": "文件夹",
|
"title": "文件夹",
|
||||||
@@ -108,6 +113,7 @@
|
|||||||
},
|
},
|
||||||
"auth": {
|
"auth": {
|
||||||
"title": "登录",
|
"title": "登录",
|
||||||
|
"signUpTitle": "注册",
|
||||||
"signIn": "登录",
|
"signIn": "登录",
|
||||||
"signUp": "注册",
|
"signUp": "注册",
|
||||||
"email": "邮箱",
|
"email": "邮箱",
|
||||||
@@ -133,7 +139,18 @@
|
|||||||
"identifierRequired": "请输入邮箱或用户名",
|
"identifierRequired": "请输入邮箱或用户名",
|
||||||
"passwordRequired": "请输入密码",
|
"passwordRequired": "请输入密码",
|
||||||
"confirmPasswordRequired": "请确认密码",
|
"confirmPasswordRequired": "请确认密码",
|
||||||
"loading": "加载中..."
|
"loading": "加载中...",
|
||||||
|
"confirm": "确认",
|
||||||
|
"noAccountLink": "没有账号?去注册",
|
||||||
|
"hasAccountLink": "已有账号?去登录",
|
||||||
|
"usernamePlaceholder": "用户名",
|
||||||
|
"emailPlaceholder": "邮箱地址",
|
||||||
|
"passwordPlaceholder": "密码",
|
||||||
|
"usernameOrEmailPlaceholder": "用户名或邮箱地址",
|
||||||
|
"loginFailed": "登录失败",
|
||||||
|
"signUpFailed": "注册失败",
|
||||||
|
"fillAllFields": "请填写所有字段",
|
||||||
|
"enterCredentials": "请输入用户名和密码"
|
||||||
},
|
},
|
||||||
"memorize": {
|
"memorize": {
|
||||||
"folder_selector": {
|
"folder_selector": {
|
||||||
@@ -187,11 +204,17 @@
|
|||||||
"subtitleFile": "字幕文件",
|
"subtitleFile": "字幕文件",
|
||||||
"uploaded": "已上传",
|
"uploaded": "已上传",
|
||||||
"notUploaded": "未上传",
|
"notUploaded": "未上传",
|
||||||
|
"uploadVideoButton": "上传视频",
|
||||||
|
"uploadSubtitleButton": "上传字幕",
|
||||||
|
"subtitleUploaded": "字幕已上传 ({count} 条)",
|
||||||
|
"subtitleNotUploaded": "字幕未上传",
|
||||||
"autoPauseStatus": "自动暂停: {enabled}",
|
"autoPauseStatus": "自动暂停: {enabled}",
|
||||||
"on": "开",
|
"on": "开",
|
||||||
"off": "关",
|
"off": "关",
|
||||||
"videoUploadFailed": "视频上传失败",
|
"videoUploadFailed": "视频上传失败",
|
||||||
"subtitleUploadFailed": "字幕上传失败"
|
"subtitleUploadFailed": "字幕上传失败",
|
||||||
|
"subtitleLoadSuccess": "字幕加载成功",
|
||||||
|
"subtitleLoadFailed": "字幕加载失败"
|
||||||
},
|
},
|
||||||
"text_speaker": {
|
"text_speaker": {
|
||||||
"generateIPA": "生成IPA",
|
"generateIPA": "生成IPA",
|
||||||
@@ -256,7 +279,9 @@
|
|||||||
"pleaseLogin": "请先登录",
|
"pleaseLogin": "请先登录",
|
||||||
"pleaseCreateFolder": "请先创建文件夹",
|
"pleaseCreateFolder": "请先创建文件夹",
|
||||||
"savedToFolder": "已保存到文件夹:{folderName}",
|
"savedToFolder": "已保存到文件夹:{folderName}",
|
||||||
"saveFailed": "保存失败,请稍后重试"
|
"saveFailed": "保存失败,请稍后重试",
|
||||||
|
"definition": "释义",
|
||||||
|
"example": "例句"
|
||||||
},
|
},
|
||||||
"explore": {
|
"explore": {
|
||||||
"title": "探索",
|
"title": "探索",
|
||||||
@@ -272,14 +297,6 @@
|
|||||||
"sortByFavorites": "按收藏数排序",
|
"sortByFavorites": "按收藏数排序",
|
||||||
"sortByFavoritesActive": "取消按收藏数排序"
|
"sortByFavoritesActive": "取消按收藏数排序"
|
||||||
},
|
},
|
||||||
"favorites": {
|
|
||||||
"title": "收藏",
|
|
||||||
"subtitle": "我收藏的文件夹",
|
|
||||||
"loading": "加载中...",
|
|
||||||
"noFavorites": "还没有收藏",
|
|
||||||
"folderInfo": "{userName} • {totalPairs} 个文本对",
|
|
||||||
"unknownUser": "未知用户"
|
|
||||||
},
|
|
||||||
"favorites": {
|
"favorites": {
|
||||||
"title": "我的收藏",
|
"title": "我的收藏",
|
||||||
"subtitle": "收藏的公开文件夹",
|
"subtitle": "收藏的公开文件夹",
|
||||||
@@ -299,6 +316,7 @@
|
|||||||
"displayName": "显示名称",
|
"displayName": "显示名称",
|
||||||
"notSet": "未设置",
|
"notSet": "未设置",
|
||||||
"memberSince": "注册时间",
|
"memberSince": "注册时间",
|
||||||
|
"logout": "登出",
|
||||||
"folders": {
|
"folders": {
|
||||||
"title": "文件夹",
|
"title": "文件夹",
|
||||||
"noFolders": "还没有文件夹",
|
"noFolders": "还没有文件夹",
|
||||||
|
|||||||
@@ -1,17 +1,18 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useState } from "react";
|
import { useState, useEffect } from "react";
|
||||||
import { authClient } from "@/lib/auth-client";
|
import { authClient } from "@/lib/auth-client";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { useRouter, useSearchParams } from "next/navigation";
|
import { useRouter, useSearchParams } from "next/navigation";
|
||||||
import { useEffect } from "react";
|
|
||||||
import { toast } from "sonner";
|
import { toast } from "sonner";
|
||||||
|
import { useTranslations } from "next-intl";
|
||||||
import { Card, CardBody } from "@/design-system/base/card";
|
import { Card, CardBody } from "@/design-system/base/card";
|
||||||
import { Input } from "@/design-system/base/input";
|
import { Input } from "@/design-system/base/input";
|
||||||
import { PrimaryButton } from "@/design-system/base/button";
|
import { PrimaryButton } from "@/design-system/base/button";
|
||||||
import { VStack } from "@/design-system/layout/stack";
|
import { VStack } from "@/design-system/layout/stack";
|
||||||
|
|
||||||
export default function LoginPage() {
|
export default function LoginPage() {
|
||||||
|
const t = useTranslations("auth");
|
||||||
const [username, setUsername] = useState("");
|
const [username, setUsername] = useState("");
|
||||||
const [password, setPassword] = useState("");
|
const [password, setPassword] = useState("");
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
@@ -19,18 +20,18 @@ export default function LoginPage() {
|
|||||||
const searchParams = useSearchParams();
|
const searchParams = useSearchParams();
|
||||||
const redirectTo = searchParams.get("redirect");
|
const redirectTo = searchParams.get("redirect");
|
||||||
|
|
||||||
const session = authClient.useSession().data;
|
const { data: session, isPending } = authClient.useSession();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (session) {
|
if (!isPending && session?.user?.username && !redirectTo) {
|
||||||
router.push(redirectTo ?? "/profile");
|
router.push("/folders");
|
||||||
}
|
}
|
||||||
}, [session, router, redirectTo]);
|
}, [session, isPending, router, redirectTo]);
|
||||||
|
|
||||||
const handleLogin = async () => {
|
const handleLogin = async () => {
|
||||||
if (!username || !password) {
|
if (!username || !password) {
|
||||||
toast.error("请输入用户名和密码");
|
toast.error(t("enterCredentials"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -39,7 +40,7 @@ export default function LoginPage() {
|
|||||||
if (username.includes("@")) {
|
if (username.includes("@")) {
|
||||||
await authClient.signIn.email({
|
await authClient.signIn.email({
|
||||||
email: username,
|
email: username,
|
||||||
password: username
|
password: password,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
await authClient.signIn.username({
|
await authClient.signIn.username({
|
||||||
@@ -47,9 +48,9 @@ export default function LoginPage() {
|
|||||||
password: password,
|
password: password,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
router.push(redirectTo ?? "/profile");
|
router.push(redirectTo ?? "/folders");
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
toast.error("登录失败");
|
toast.error(t("loginFailed"));
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
@@ -57,21 +58,21 @@ export default function LoginPage() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex justify-center items-center min-h-screen">
|
<div className="flex justify-center items-center min-h-screen">
|
||||||
<Card className="w-80">
|
<Card className="w-96">
|
||||||
<CardBody>
|
<CardBody>
|
||||||
<VStack gap={4} align="center" justify="center">
|
<VStack gap={4} align="center" justify="center">
|
||||||
<h1 className="text-3xl font-bold text-center w-full">登录</h1>
|
<h1 className="text-3xl font-bold text-center w-full">{t("title")}</h1>
|
||||||
|
|
||||||
<VStack gap={0} align="center" justify="center" className="w-full">
|
<VStack gap={0} align="center" justify="center" className="w-full">
|
||||||
<Input
|
<Input
|
||||||
placeholder="用户名或邮箱地址"
|
placeholder={t("usernameOrEmailPlaceholder")}
|
||||||
value={username}
|
value={username}
|
||||||
onChange={(e) => setUsername(e.target.value)}
|
onChange={(e) => setUsername(e.target.value)}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Input
|
<Input
|
||||||
type="password"
|
type="password"
|
||||||
placeholder="密码"
|
placeholder={t("passwordPlaceholder")}
|
||||||
value={password}
|
value={password}
|
||||||
onChange={(e) => setPassword(e.target.value)}
|
onChange={(e) => setPassword(e.target.value)}
|
||||||
/>
|
/>
|
||||||
@@ -82,14 +83,14 @@ export default function LoginPage() {
|
|||||||
loading={loading}
|
loading={loading}
|
||||||
fullWidth
|
fullWidth
|
||||||
>
|
>
|
||||||
确认
|
{t("confirm")}
|
||||||
</PrimaryButton>
|
</PrimaryButton>
|
||||||
|
|
||||||
<Link
|
<Link
|
||||||
href={"/signup" + (redirectTo ? `?redirect=${redirectTo}` : "")}
|
href={"/signup" + (redirectTo ? `?redirect=${redirectTo}` : "")}
|
||||||
className="text-center text-primary-500 hover:underline"
|
className="text-center text-primary-500 hover:underline"
|
||||||
>
|
>
|
||||||
没有账号?去注册
|
{t("noAccountLink")}
|
||||||
</Link>
|
</Link>
|
||||||
</VStack>
|
</VStack>
|
||||||
</CardBody>
|
</CardBody>
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ import { headers } from "next/headers";
|
|||||||
export default async function ProfilePage() {
|
export default async function ProfilePage() {
|
||||||
const session = await auth.api.getSession({ headers: await headers() });
|
const session = await auth.api.getSession({ headers: await headers() });
|
||||||
|
|
||||||
if (!session) {
|
if (!session?.user?.id) {
|
||||||
redirect("/login?redirect=/profile");
|
redirect("/login?redirect=/profile");
|
||||||
}
|
}
|
||||||
|
|
||||||
redirect(`/users/${session.user.username}`);
|
redirect(session.user.username ? `/users/${session.user.username}` : "/folders");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,12 +6,14 @@ import Link from "next/link";
|
|||||||
import { useRouter, useSearchParams } from "next/navigation";
|
import { useRouter, useSearchParams } from "next/navigation";
|
||||||
import { useEffect } from "react";
|
import { useEffect } from "react";
|
||||||
import { toast } from "sonner";
|
import { toast } from "sonner";
|
||||||
|
import { useTranslations } from "next-intl";
|
||||||
import { Card, CardBody } from "@/design-system/base/card";
|
import { Card, CardBody } from "@/design-system/base/card";
|
||||||
import { Input } from "@/design-system/base/input";
|
import { Input } from "@/design-system/base/input";
|
||||||
import { PrimaryButton } from "@/design-system/base/button";
|
import { PrimaryButton } from "@/design-system/base/button";
|
||||||
import { VStack } from "@/design-system/layout/stack";
|
import { VStack } from "@/design-system/layout/stack";
|
||||||
|
|
||||||
export default function SignUpPage() {
|
export default function SignUpPage() {
|
||||||
|
const t = useTranslations("auth");
|
||||||
const [username, setUsername] = useState("");
|
const [username, setUsername] = useState("");
|
||||||
const [email, setEmail] = useState("");
|
const [email, setEmail] = useState("");
|
||||||
const [password, setPassword] = useState("");
|
const [password, setPassword] = useState("");
|
||||||
@@ -20,18 +22,18 @@ export default function SignUpPage() {
|
|||||||
const searchParams = useSearchParams();
|
const searchParams = useSearchParams();
|
||||||
const redirectTo = searchParams.get("redirect");
|
const redirectTo = searchParams.get("redirect");
|
||||||
|
|
||||||
const session = authClient.useSession().data;
|
const { data: session, isPending } = authClient.useSession();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (session) {
|
if (!isPending && session?.user?.username && !redirectTo) {
|
||||||
router.push(redirectTo ?? "/profile");
|
router.push("/folders");
|
||||||
}
|
}
|
||||||
}, [session, router, redirectTo]);
|
}, [session, isPending, router, redirectTo]);
|
||||||
|
|
||||||
const handleSignUp = async () => {
|
const handleSignUp = async () => {
|
||||||
if (!username || !email || !password) {
|
if (!username || !email || !password) {
|
||||||
toast.error("请填写所有字段");
|
toast.error(t("fillAllFields"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,9 +45,9 @@ export default function SignUpPage() {
|
|||||||
username: username,
|
username: username,
|
||||||
password: password,
|
password: password,
|
||||||
});
|
});
|
||||||
router.push(redirectTo ?? "/profile");
|
router.push(redirectTo ?? "/folders");
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
toast.error("注册失败");
|
toast.error(t("signUpFailed"));
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
@@ -53,28 +55,28 @@ export default function SignUpPage() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex justify-center items-center min-h-screen">
|
<div className="flex justify-center items-center min-h-screen">
|
||||||
<Card className="w-80">
|
<Card className="w-96">
|
||||||
<CardBody>
|
<CardBody>
|
||||||
<VStack gap={4} align="center" justify="center">
|
<VStack gap={4} align="center" justify="center">
|
||||||
<h1 className="text-3xl font-bold text-center w-full">注册</h1>
|
<h1 className="text-3xl font-bold text-center w-full">{t("signUpTitle")}</h1>
|
||||||
|
|
||||||
<VStack gap={0} align="center" justify="center" className="w-full">
|
<VStack gap={0} align="center" justify="center" className="w-full">
|
||||||
<Input
|
<Input
|
||||||
placeholder="用户名"
|
placeholder={t("usernamePlaceholder")}
|
||||||
value={username}
|
value={username}
|
||||||
onChange={(e) => setUsername(e.target.value)}
|
onChange={(e) => setUsername(e.target.value)}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Input
|
<Input
|
||||||
type="email"
|
type="email"
|
||||||
placeholder="邮箱地址"
|
placeholder={t("emailPlaceholder")}
|
||||||
value={email}
|
value={email}
|
||||||
onChange={(e) => setEmail(e.target.value)}
|
onChange={(e) => setEmail(e.target.value)}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Input
|
<Input
|
||||||
type="password"
|
type="password"
|
||||||
placeholder="密码"
|
placeholder={t("passwordPlaceholder")}
|
||||||
value={password}
|
value={password}
|
||||||
onChange={(e) => setPassword(e.target.value)}
|
onChange={(e) => setPassword(e.target.value)}
|
||||||
/>
|
/>
|
||||||
@@ -85,14 +87,14 @@ export default function SignUpPage() {
|
|||||||
loading={loading}
|
loading={loading}
|
||||||
fullWidth
|
fullWidth
|
||||||
>
|
>
|
||||||
确认
|
{t("confirm")}
|
||||||
</PrimaryButton>
|
</PrimaryButton>
|
||||||
|
|
||||||
<Link
|
<Link
|
||||||
href={"/login" + (redirectTo ? `?redirect=${redirectTo}` : "")}
|
href={"/login" + (redirectTo ? `?redirect=${redirectTo}` : "")}
|
||||||
className="text-center text-primary-500 hover:underline"
|
className="text-center text-primary-500 hover:underline"
|
||||||
>
|
>
|
||||||
已有账号?去登录
|
{t("hasAccountLink")}
|
||||||
</Link>
|
</Link>
|
||||||
</VStack>
|
</VStack>
|
||||||
</CardBody>
|
</CardBody>
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ export default async function UserPage({ params }: UserPageProps) {
|
|||||||
<div className="bg-white rounded-lg shadow-md p-6 mb-6">
|
<div className="bg-white rounded-lg shadow-md p-6 mb-6">
|
||||||
<div className="flex items-center justify-between mb-4">
|
<div className="flex items-center justify-between mb-4">
|
||||||
<div></div>
|
<div></div>
|
||||||
{isOwnProfile && <LinkButton href="/logout">登出</LinkButton>}
|
{isOwnProfile && <LinkButton href="/logout">{t("logout")}</LinkButton>}
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center space-x-6">
|
<div className="flex items-center space-x-6">
|
||||||
{/* Avatar */}
|
{/* Avatar */}
|
||||||
|
|||||||
@@ -54,8 +54,8 @@ export default function Alphabet() {
|
|||||||
{t("chooseCharacters")}
|
{t("chooseCharacters")}
|
||||||
</h1>
|
</h1>
|
||||||
{/* 副标题说明 */}
|
{/* 副标题说明 */}
|
||||||
<p className="text-gray-600 mb-8 text-lg">
|
<p className="text-lg text-gray-600 text-center">
|
||||||
选择一种语言的字母表开始学习
|
{t("chooseAlphabetHint")}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
{/* 语言选择按钮网格 */}
|
{/* 语言选择按钮网格 */}
|
||||||
|
|||||||
@@ -133,10 +133,11 @@ export function DictionaryClient({ initialFolders }: DictionaryClientProps) {
|
|||||||
placeholder={t("searchPlaceholder")}
|
placeholder={t("searchPlaceholder")}
|
||||||
variant="search"
|
variant="search"
|
||||||
required
|
required
|
||||||
|
containerClassName="flex-1"
|
||||||
/>
|
/>
|
||||||
<LightButton
|
<LightButton
|
||||||
type="submit"
|
type="submit"
|
||||||
className="px-6 py-3 whitespace-nowrap text-center sm:min-w-30"
|
className="h-10 px-6 rounded-full whitespace-nowrap"
|
||||||
loading={isSearching}
|
loading={isSearching}
|
||||||
>
|
>
|
||||||
{t("search")}
|
{t("search")}
|
||||||
|
|||||||
@@ -1,13 +1,15 @@
|
|||||||
import { TSharedEntry } from "@/shared/dictionary-type";
|
import { TSharedEntry } from "@/shared/dictionary-type";
|
||||||
|
import { useTranslations } from "next-intl";
|
||||||
|
|
||||||
interface DictionaryEntryProps {
|
interface DictionaryEntryProps {
|
||||||
entry: TSharedEntry;
|
entry: TSharedEntry;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function DictionaryEntry({ entry }: DictionaryEntryProps) {
|
export function DictionaryEntry({ entry }: DictionaryEntryProps) {
|
||||||
|
const t = useTranslations("dictionary");
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{/* 音标和词性 */}
|
|
||||||
<div className="flex items-center gap-3 mb-3">
|
<div className="flex items-center gap-3 mb-3">
|
||||||
{entry.ipa && (
|
{entry.ipa && (
|
||||||
<span className="text-gray-600 text-lg">
|
<span className="text-gray-600 text-lg">
|
||||||
@@ -21,19 +23,17 @@ export function DictionaryEntry({ entry }: DictionaryEntryProps) {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* 释义 */}
|
|
||||||
<div className="mb-3">
|
<div className="mb-3">
|
||||||
<h3 className="text-sm font-semibold text-gray-700 mb-1">
|
<h3 className="text-sm font-semibold text-gray-700 mb-1">
|
||||||
释义
|
{t("definition")}
|
||||||
</h3>
|
</h3>
|
||||||
<p className="text-gray-800">{entry.definition}</p>
|
<p className="text-gray-800">{entry.definition}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* 例句 */}
|
|
||||||
{entry.example && (
|
{entry.example && (
|
||||||
<div>
|
<div>
|
||||||
<h3 className="text-sm font-semibold text-gray-700 mb-1">
|
<h3 className="text-sm font-semibold text-gray-700 mb-1">
|
||||||
例句
|
{t("example")}
|
||||||
</h3>
|
</h3>
|
||||||
<p className="text-gray-700 pl-4 border-l-4 border-[#35786f]">
|
<p className="text-gray-700 pl-4 border-l-4 border-[#35786f]">
|
||||||
{entry.example}
|
{entry.example}
|
||||||
|
|||||||
@@ -127,21 +127,21 @@ export default function SrtPlayerPage() {
|
|||||||
<div className="border-gray-200 border-2 flex items p-2 justify-between items-center rounded gap-8">
|
<div className="border-gray-200 border-2 flex items p-2 justify-between items-center rounded gap-8">
|
||||||
<div className="flex items-center flex-col">
|
<div className="flex items-center flex-col">
|
||||||
<Video size={16} />
|
<Video size={16} />
|
||||||
<span className="text-sm">视频文件</span>
|
<span className="text-sm">{srtT("videoFile")}</span>
|
||||||
</div>
|
</div>
|
||||||
<LightButton onClick={handleVideoUpload} disabled={!!videoUrl}>
|
<LightButton onClick={handleVideoUpload} disabled={!!videoUrl}>
|
||||||
{videoUrl ? '已上传' : '上传视频'}
|
{videoUrl ? srtT("uploaded") : srtT("uploadVideoButton")}
|
||||||
</LightButton>
|
</LightButton>
|
||||||
</div>
|
</div>
|
||||||
<div className="border-gray-200 border-2 flex items p-2 justify-between items-center rounded gap-8">
|
<div className="border-gray-200 border-2 flex items p-2 justify-between items-center rounded gap-8">
|
||||||
<div className="flex items-center flex-col">
|
<div className="flex items-center flex-col">
|
||||||
<FileText size={16} />
|
<FileText size={16} />
|
||||||
<span className="text-sm">
|
<span className="text-sm">
|
||||||
{subtitleData.length > 0 ? `字幕已上传 (${subtitleData.length} 条)` : "字幕未上传"}
|
{subtitleData.length > 0 ? srtT("subtitleUploaded", { count: subtitleData.length }) : srtT("subtitleNotUploaded")}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<LightButton onClick={handleSubtitleUpload} disabled={!!subtitleUrl}>
|
<LightButton onClick={handleSubtitleUpload} disabled={!!subtitleUrl}>
|
||||||
{subtitleUrl ? '已上传' : '上传字幕'}
|
{subtitleUrl ? srtT("uploaded") : srtT("uploadSubtitleButton")}
|
||||||
</LightButton>
|
</LightButton>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user