Skip to content

Commit

Permalink
fix: types error
Browse files Browse the repository at this point in the history
  • Loading branch information
Dogtiti committed Apr 19, 2023
1 parent 8aa740b commit 6d321ca
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 10 deletions.
5 changes: 3 additions & 2 deletions public/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"current-tasks": "Current tasks",
"coming-soon": " Coming Soon!",
"back": "Back",
"image":"Image"

"image": "Image",
"delete": "Delete",
"share": "Share"
}
4 changes: 3 additions & 1 deletion public/locales/zh/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,7 @@
"current-tasks": "当前任务",
"coming-soon": "即将到来!",
"back": "返回",
"image":"图片"
"image": "图片",
"delete": "删除",
"share": "分享"
}
4 changes: 2 additions & 2 deletions src/components/ChatWindow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ interface ChatWindowProps extends HeaderProps {
showDonation: boolean;
fullscreen?: boolean;
scrollToBottom?: boolean;
showWeChatPay: () => void;
showWeChatPay?: () => void;
}

const messageListId = "chat-window-message-list";
Expand Down Expand Up @@ -282,7 +282,7 @@ const ChatMessage = ({ message }: { message: Message }) => {
);
};

const DonationMessage = ({ showWeChatPay }: { showWeChatPay: () => void }) => {
const DonationMessage = ({ showWeChatPay }: { showWeChatPay?: () => void }) => {
const { t } = useTranslation(["chat", "common"]);
return (
<div className="mx-2 my-1 flex flex-col gap-2 rounded-lg border-[2px] border-white/10 bg-blue-500/20 p-1 text-center font-mono hover:border-[#1E88E5]/40 sm:mx-4 sm:p-3 sm:text-base md:flex-row">
Expand Down
24 changes: 19 additions & 5 deletions src/pages/agent/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type NextPage } from "next";
import { type NextPage, type GetStaticProps } from "next";
import DefaultLayout from "../../layout/default";
import Button from "../../components/Button";

Expand All @@ -10,10 +10,13 @@ import type { Message } from "../../types/agentTypes";
import Toast from "../../components/toast";
import { FaTrash, FaShare, FaBackspace } from "react-icons/fa";
import { env } from "../../env/client.mjs";
import { useTranslation } from "next-i18next";
import { serverSideTranslations } from "next-i18next/serverSideTranslations";

const AgentPage: NextPage = () => {
const [showCopied, setShowCopied] = useState(false);
const router = useRouter();
const { t } = useTranslation();

const agentId = typeof router.query.id === "string" ? router.query.id : "";

Expand Down Expand Up @@ -55,7 +58,7 @@ const AgentPage: NextPage = () => {
}}
enabledClassName={"bg-green-600 hover:bg-green-400"}
>
Share
{t("share")}
</Button>
<Button
icon={<FaTrash />}
Expand All @@ -64,19 +67,30 @@ const AgentPage: NextPage = () => {
}}
enabledClassName={"bg-red-600 hover:bg-red-400"}
>
Delete
{t("delete")}
</Button>
<Button icon={<FaBackspace />} onClick={() => void router.push("/")}>
Back
{t("back")}
</Button>
</div>
<Toast
model={[showCopied, setShowCopied]}
title="Copied to clipboard! 🚀"
title={`${t("copied")} 🚀}`}
className="bg-gray-950 text-sm"
/>
</DefaultLayout>
);
};

export default AgentPage;

export const getStaticProps: GetStaticProps = async ({ locale }) => ({
props: {
...(await serverSideTranslations(locale ?? "zh", [
"common",
"help",
"settings",
"chat",
])),
},
});

0 comments on commit 6d321ca

Please sign in to comment.