Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions i18n/en/code.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"Theme.Navbar.download-now": {
"message": "Download Now"
},
"Theme.Navbar.go-to-hub-flow": {
"message": "Go to Hub"
},
Expand Down
3 changes: 3 additions & 0 deletions i18n/zh-CN/code.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"Theme.Navbar.download-now": {
"message": "Download Now"
},
"Theme.Navbar.go-to-hub-flow": {
"message": "前往创造平台"
},
Expand Down
33 changes: 20 additions & 13 deletions src/theme/Navbar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,18 @@ const isSignedIn = () => {

const CALLBACK_URL = "https://chat.oomol.com/";

const handleSignin = () => {
if (isSignedIn()) {
return window.open(CALLBACK_URL, "_self");
}

const redirectURL = `https://api.oomol.com/v1/auth/redirect?redirect=${encodeURIComponent(CALLBACK_URL)}`;
window.open(redirectURL, "_self");
const handleSignin = (locale: string) => {
// if (isSignedIn()) {
// return window.open(CALLBACK_URL, "_self");
// }

// const redirectURL = `https://api.oomol.com/v1/auth/redirect?redirect=${encodeURIComponent(CALLBACK_URL)}`;
// window.open(redirectURL, "_self");
const downloadUrl =
locale === "zh-CN"
? "https://oomol.com/zh-CN/downloads/"
: "https://oomol.com/downloads/";
window.open(downloadUrl, "_self");
};

interface NavbarProps {}
Expand Down Expand Up @@ -167,12 +172,14 @@ const Navbar: React.FC<NavbarProps> = memo(() => {
<NavbarItem
style={{ cursor: "pointer" }}
className={styles.signInButton}
label={
isSignedIn()
? translate({ message: "Theme.Navbar.use-in-chat" })
: translate({ message: "Theme.Navbar.sign-in" })
}
onClick={handleSignin}
// label={
// isSignedIn()
// ? translate({ message: "Theme.Navbar.use-in-chat" })
// : translate({ message: "Theme.Navbar.sign-in" })
// }
// TODO: Temporarily change to "Download Now" button
label={translate({ message: "Theme.Navbar.download-now" })}
onClick={() => handleSignin(locale)}
/>
);
}}
Expand Down