Skip to content

Commit 4d7bab4

Browse files
committed
refactor: unify brand constants
1 parent a39c99c commit 4d7bab4

4 files changed

Lines changed: 18 additions & 6 deletions

File tree

packages/frontend/src/config.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,16 @@
33
*/
44
export const DATE_FORMATTER = "YYYY-MM-DD HH:mm:ss";
55

6+
/**
7+
* 应用名称
8+
*/
9+
export const APP_NAME = "Cube Diary";
10+
11+
/**
12+
* 应用副标题
13+
*/
14+
export const APP_SUBTITLE = "记录你的生活";
15+
616
/**
717
* 固定分页条数
818
*/

packages/frontend/src/pages/login/page.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { login } from "../../store/user";
66
import { messageError } from "@/utils/message";
77
import { KeyOutlined } from "@ant-design/icons";
88
import { useLoginSuccess } from "./use-login-success";
9-
import { THEME_BUTTON_COLOR } from "@/config";
9+
import { APP_NAME, APP_SUBTITLE, THEME_BUTTON_COLOR } from "@/config";
1010
import { usePageTitle } from "@/store/global";
1111

1212
export const LoginPage = () => {
@@ -42,8 +42,8 @@ export const LoginPage = () => {
4242
if (e.key === "Enter") onPasswordSubmit();
4343
};
4444

45-
const appTitle = "Cube Note";
46-
const appSubTitle = "记录你的生活";
45+
const appTitle = APP_NAME;
46+
const appSubTitle = APP_SUBTITLE;
4747

4848
return (
4949
<div className="h-screen w-screen bg-gray-100 dark:bg-neutral-800 flex flex-col justify-center items-center dark:text-gray-100">

packages/frontend/src/pages/user-setting/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
SnippetsOutlined,
77
} from "@ant-design/icons";
88
import { UserOutlined, RightOutlined, LogoutOutlined } from "@ant-design/icons";
9+
import { APP_NAME } from "@/config";
910
import { Cell, SplitLine } from "@/components/cell";
1011
import { SettingLinkItem, useSettingMenu } from "./use-setting-menu";
1112
import { AboutModal } from "../about";
@@ -148,7 +149,7 @@ export const MobileSetting: FC<MobileProps> = (props) => {
148149
}
149150
>
150151
<Flex vertical className="p-4" gap={16}>
151-
<h1 className="text-center">Cube Note</h1>
152+
<h1 className="text-center">{APP_NAME}</h1>
152153
<Flex vertical gap={16} className="flex-grow">
153154
<Card size="small">
154155
<Row justify="space-around">

packages/frontend/src/store/global.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { atom, useSetAtom } from "jotai";
22
import { useEffect } from "react";
3+
import { APP_NAME } from "@/config";
34

45
export const getIsMobile = () => {
56
const screenWidth =
@@ -26,13 +27,13 @@ export const usePageTitle = (title: string) => {
2627

2728
useEffect(() => {
2829
setCurrentPageTitle(title);
29-
document.title = title + " - Cube Note";
30+
document.title = title + " - " + APP_NAME;
3031
}, [title]);
3132

3233
useEffect(() => {
3334
return () => {
3435
setCurrentPageTitle("");
35-
document.title = "Cube Note";
36+
document.title = APP_NAME;
3637
};
3738
}, []);
3839
};

0 commit comments

Comments
 (0)