forked from XiaoMo/ChatGPT-Next-Web
feat: add tight border layout
This commit is contained in:
parent
14d50f1167
commit
ff0cf2f9dc
12
app/404.tsx
12
app/404.tsx
@ -1,12 +0,0 @@
|
|||||||
import Link from "next/link";
|
|
||||||
|
|
||||||
export default function FourOhFour() {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<h1>404 - Page Not Found</h1>
|
|
||||||
<Link href="/">
|
|
||||||
<a>Go back home</a>
|
|
||||||
</Link>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
12
app/500.tsx
12
app/500.tsx
@ -1,12 +0,0 @@
|
|||||||
import Link from "next/link";
|
|
||||||
|
|
||||||
export default function FourOhFour() {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<h1>500 - Page Not Found</h1>
|
|
||||||
<Link href="/">
|
|
||||||
<a>Go back home</a>
|
|
||||||
</Link>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
@ -1,18 +1,33 @@
|
|||||||
.container {
|
@mixin container {
|
||||||
max-width: 1080px;
|
|
||||||
min-width: 600px;
|
|
||||||
min-height: 480px;
|
|
||||||
width: 90vw;
|
|
||||||
height: 90vh;
|
|
||||||
background-color: var(--white);
|
background-color: var(--white);
|
||||||
border: var(--border-in-light);
|
border: var(--border-in-light);
|
||||||
border-radius: 20px;
|
border-radius: 20px;
|
||||||
box-shadow: var(--shadow);
|
box-shadow: var(--shadow);
|
||||||
color: var(--black);
|
color: var(--black);
|
||||||
background-color: var(--white);
|
background-color: var(--white);
|
||||||
|
min-width: 600px;
|
||||||
|
min-height: 480px;
|
||||||
|
|
||||||
display: flex;
|
display: flex;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container {
|
||||||
|
@include container();
|
||||||
|
|
||||||
|
max-width: 1080px;
|
||||||
|
max-height: 864px;
|
||||||
|
width: 90vw;
|
||||||
|
height: 90vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tight-container {
|
||||||
|
@include container();
|
||||||
|
|
||||||
|
width: 100vw;
|
||||||
|
height: 100vh;
|
||||||
|
border-radius: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sidebar {
|
.sidebar {
|
||||||
|
@ -291,11 +291,16 @@ export function Home() {
|
|||||||
|
|
||||||
// settings
|
// settings
|
||||||
const [openSettings, setOpenSettings] = useState(false);
|
const [openSettings, setOpenSettings] = useState(false);
|
||||||
|
const config = useChatStore((state) => state.config);
|
||||||
|
|
||||||
useSwitchTheme();
|
useSwitchTheme();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.container}>
|
<div
|
||||||
|
className={`${
|
||||||
|
config.tightBorder ? styles["tight-container"] : styles.container
|
||||||
|
}`}
|
||||||
|
>
|
||||||
<div className={styles.sidebar}>
|
<div className={styles.sidebar}>
|
||||||
<div className={styles["sidebar-header"]}>
|
<div className={styles["sidebar-header"]}>
|
||||||
<div className={styles["sidebar-title"]}>ChatGPT Next</div>
|
<div className={styles["sidebar-title"]}>ChatGPT Next</div>
|
||||||
@ -347,9 +352,10 @@ export function Home() {
|
|||||||
|
|
||||||
export function Settings() {
|
export function Settings() {
|
||||||
const [showEmojiPicker, setShowEmojiPicker] = useState(false);
|
const [showEmojiPicker, setShowEmojiPicker] = useState(false);
|
||||||
const [config, updateConfig] = useChatStore((state) => [
|
const [config, updateConfig, resetConfig] = useChatStore((state) => [
|
||||||
state.config,
|
state.config,
|
||||||
state.updateConfig,
|
state.updateConfig,
|
||||||
|
state.resetConfig,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -361,7 +367,12 @@ export function Settings() {
|
|||||||
</div>
|
</div>
|
||||||
<div className={styles["window-actions"]}>
|
<div className={styles["window-actions"]}>
|
||||||
<div className={styles["window-action-button"]}>
|
<div className={styles["window-action-button"]}>
|
||||||
<IconButton icon={<ResetIcon />} bordered title="重置所有选项" />
|
<IconButton
|
||||||
|
icon={<ResetIcon />}
|
||||||
|
onClick={resetConfig}
|
||||||
|
bordered
|
||||||
|
title="重置所有选项"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -432,6 +443,19 @@ export function Settings() {
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</ListItem>
|
</ListItem>
|
||||||
|
|
||||||
|
<ListItem>
|
||||||
|
<div className={styles["settings-title"]}>紧凑边框</div>
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
checked={config.tightBorder}
|
||||||
|
onChange={(e) =>
|
||||||
|
updateConfig(
|
||||||
|
(config) => (config.tightBorder = e.currentTarget.checked)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
></input>
|
||||||
|
</ListItem>
|
||||||
</List>
|
</List>
|
||||||
<List>
|
<List>
|
||||||
<ListItem>
|
<ListItem>
|
||||||
|
21
app/store.ts
21
app/store.ts
@ -30,8 +30,18 @@ interface ChatConfig {
|
|||||||
submitKey: SubmitKey;
|
submitKey: SubmitKey;
|
||||||
avatar: string;
|
avatar: string;
|
||||||
theme: Theme;
|
theme: Theme;
|
||||||
|
tightBorder: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const DEFAULT_CONFIG: ChatConfig = {
|
||||||
|
historyMessageCount: 5,
|
||||||
|
sendBotMessages: false as boolean,
|
||||||
|
submitKey: SubmitKey.CtrlEnter as SubmitKey,
|
||||||
|
avatar: "1fae0",
|
||||||
|
theme: Theme.Auto as Theme,
|
||||||
|
tightBorder: false,
|
||||||
|
};
|
||||||
|
|
||||||
interface ChatStat {
|
interface ChatStat {
|
||||||
tokenCount: number;
|
tokenCount: number;
|
||||||
wordCount: number;
|
wordCount: number;
|
||||||
@ -94,6 +104,7 @@ interface ChatStore {
|
|||||||
) => void;
|
) => void;
|
||||||
|
|
||||||
getConfig: () => ChatConfig;
|
getConfig: () => ChatConfig;
|
||||||
|
resetConfig: () => void;
|
||||||
updateConfig: (updater: (config: ChatConfig) => void) => void;
|
updateConfig: (updater: (config: ChatConfig) => void) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,11 +114,11 @@ export const useChatStore = create<ChatStore>()(
|
|||||||
sessions: [createEmptySession()],
|
sessions: [createEmptySession()],
|
||||||
currentSessionIndex: 0,
|
currentSessionIndex: 0,
|
||||||
config: {
|
config: {
|
||||||
historyMessageCount: 5,
|
...DEFAULT_CONFIG,
|
||||||
sendBotMessages: false as boolean,
|
},
|
||||||
submitKey: SubmitKey.CtrlEnter as SubmitKey,
|
|
||||||
avatar: "1fae0",
|
resetConfig() {
|
||||||
theme: Theme.Auto as Theme,
|
set(() => ({ config: { ...DEFAULT_CONFIG } }));
|
||||||
},
|
},
|
||||||
|
|
||||||
getConfig() {
|
getConfig() {
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
/** @type {import('next').NextConfig} */
|
/** @type {import('next').NextConfig} */
|
||||||
|
|
||||||
const withLess = require("next-with-less");
|
const nextConfig = {
|
||||||
|
|
||||||
const nextConfig = withLess({
|
|
||||||
experimental: {
|
experimental: {
|
||||||
appDir: true,
|
appDir: true,
|
||||||
},
|
},
|
||||||
@ -14,6 +12,6 @@ const nextConfig = withLess({
|
|||||||
|
|
||||||
return config;
|
return config;
|
||||||
},
|
},
|
||||||
});
|
};
|
||||||
|
|
||||||
module.exports = nextConfig;
|
module.exports = nextConfig;
|
||||||
|
Loading…
Reference in New Issue
Block a user