Skip to content

Commit 6d3511b

Browse files
authored
Merge pull request #18 from Dogtiti/feature/login
feat: login
2 parents 3e4f6ac + e649ae9 commit 6d3511b

File tree

9 files changed

+175
-15
lines changed

9 files changed

+175
-15
lines changed

public/locales/en/common.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"help": "Help",
44
"settings": "Settings",
55
"new-agent": "New Agent",
6-
"sign-in": "Sign in to be able to save agents and manage your account!",
6+
"sign-in-tips": "Sign in to be able to save agents and manage your account!",
77
"create-agent": "You need to create and save your first agent before anything shows up here!",
88
"my-agents": " My Agent(s)",
99
"close": "Close",
@@ -25,5 +25,7 @@
2525
"back": "Back",
2626
"image": "Image",
2727
"delete": "Delete",
28-
"share": "Share"
28+
"share": "Share",
29+
"sign-in": "Sign In",
30+
"sign-out": "Sign Out"
2931
}

public/locales/zh/common.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"help": "帮助",
44
"settings": "设置",
55
"new-agent": "新的代理",
6-
"sign-in": "请登录以保存代理并管理您的帐户!",
6+
"sign-in-tips": "请登录以保存代理并管理您的帐户!",
77
"create-agent": "在此处显示任何内容之前,您需要创建并保存您的第一个代理!",
88
"my-agents": " 我的代理",
99
"close": "关闭",
@@ -25,5 +25,7 @@
2525
"back": "返回",
2626
"image": "图片",
2727
"delete": "删除",
28-
"share": "分享"
28+
"share": "分享",
29+
"sign-in": "登录",
30+
"sign-out": "登出"
2931
}

public/logo-white.svg

Lines changed: 157 additions & 1 deletion
Loading

src/components/Button.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ const Button = forwardRef(
2323
try {
2424
void Promise.resolve(props.onClick?.(e)).then();
2525
} catch (e) {
26+
console.error(e);
2627
setLoading(false);
2728
}
2829
};

src/components/ChatWindow.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ const ChatMessage = ({ message }: { message: Message }) => {
256256
remarkPlugins={[remarkGfm]}
257257
rehypePlugins={[rehypeHighlight]}
258258
>
259-
{message.value}
259+
{t(message.value)}
260260
</ReactMarkdown>
261261
</div>
262262
) : (

src/components/Drawer.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ const Drawer = ({
117117
/>
118118
))}
119119

120-
{status === "unauthenticated" && <div>{t("sign-in")}</div>}
120+
{status === "unauthenticated" && <div>{t("sign-in-tips")}</div>}
121121
{status === "authenticated" && userAgents.length === 0 && (
122122
<div>{t("create-agent")}</div>
123123
)}
@@ -248,7 +248,7 @@ const AuthItem: React.FC<{
248248
signOut: () => void;
249249
}> = ({ signIn, signOut, session }) => {
250250
const icon = session?.user ? <FaSignInAlt /> : <FaSignOutAlt />;
251-
const text = session?.user ? "Sign Out" : "Sign In";
251+
const text = session?.user ? "sign-out" : "sign-in";
252252
const onClick = session?.user ? signOut : signIn;
253253

254254
return <DrawerItem icon={icon} text={text} onClick={onClick} />;

src/components/TaskWindow.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,17 @@ import { FaListAlt } from "react-icons/fa";
33
import FadeIn from "./motions/FadeIn";
44
import Expand from "./motions/expand";
55
import type { Message } from "../types/agentTypes";
6+
import { useTranslation } from "next-i18next";
67

78
type TaskWindowProps = {
89
tasks: Message[];
910
};
1011
export const TaskWindow = ({ tasks }: TaskWindowProps) => {
12+
const { t } = useTranslation();
1113
return (
1214
<Expand className="xl mx-2 mt-4 hidden w-[20rem] flex-col items-center rounded-2xl border-2 border-white/20 bg-zinc-900 px-1 font-mono shadow-2xl xl:flex">
1315
<div className="sticky top-0 my-2 flex items-center justify-center gap-2 bg-zinc-900 p-2 text-gray-300 ">
14-
<FaListAlt /> Current tasks
16+
<FaListAlt /> <span>{t("current-tasks")}</span>
1517
</div>
1618
<div className="window-heights mb-2 w-full px-1 ">
1719
<div className="flex flex-col gap-2 overflow-y-auto overflow-x-hidden">

src/env/schema.mjs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ export const serverSchema = z.object({
3333
process.env.VERCEL ? z.string() : z.string().url()
3434
),
3535
OPENAI_API_KEY: z.string(),
36-
3736
GOOGLE_CLIENT_ID: requiredAuthEnabledForProduction(),
3837
GOOGLE_CLIENT_SECRET: requiredAuthEnabledForProduction(),
3938
GITHUB_CLIENT_ID: requiredAuthEnabledForProduction(),

src/pages/index.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import { useTranslation } from "next-i18next";
2525
import { useRouter } from "next/router";
2626

2727
const Home: NextPage = () => {
28+
const { t, i18n } = useTranslation();
2829
const { session, status } = useAuth();
2930
const [name, setName] = useState<string>("");
3031
const [goalInput, setGoalInput] = useState<string>("");
@@ -45,10 +46,7 @@ const Home: NextPage = () => {
4546
const [showQQDialog, setShowQQDialog] = useState(false);
4647
const [showKnowlegePlanetDialog, setShowKnowlegePlanetDialog] =
4748
useState(false);
48-
const { t, i18n } = useTranslation();
49-
const [customLanguage, setCustomLanguage] = React.useState<string>(
50-
i18n.language
51-
);
49+
const [customLanguage, setCustomLanguage] = useState<string>(i18n.language);
5250

5351
const router = useRouter();
5452

@@ -298,7 +296,7 @@ const Home: NextPage = () => {
298296
<span className="ml-2">{t("stopping")}</span>
299297
</>
300298
) : (
301-
t("stop-agent")
299+
<span>{t("stop-agent")}</span>
302300
)}
303301
</Button>
304302
</Expand>

0 commit comments

Comments
 (0)