From c99086447e93d5fcf4c2d8a273046cf4a04aa0c9 Mon Sep 17 00:00:00 2001 From: butterfly Date: Wed, 24 Apr 2024 15:44:24 +0800 Subject: [PATCH] feat: redesign settings page --- app/components/Btn/index.tsx | 30 +- app/components/Card/index.tsx | 32 + app/components/Input/index.tsx | 82 ++ app/components/List/index.tsx | 129 ++ app/components/MenuLayout/index.tsx | 51 +- app/components/Popover/index.tsx | 106 +- app/components/Select/index.tsx | 104 ++ app/components/SlideRange/index.tsx | 92 ++ app/components/Switch/index.tsx | 27 + app/components/auth.module.scss | 16 + app/containers/Chat/ChatActions.tsx | 6 +- app/containers/Chat/ChatMessagePanel.tsx | 6 +- app/containers/Chat/ChatPanel.tsx | 10 +- app/containers/Chat/EditMessageModal.tsx | 10 +- app/containers/Chat/MessageActions.tsx | 46 +- app/containers/Chat/PromptToast.tsx | 1 - app/containers/Chat/SessionConfigModal.tsx | 5 +- app/containers/Chat/index.tsx | 5 +- app/containers/Settings/AppSetting.tsx | 192 +++ app/containers/Settings/DangerItems.tsx | 155 ++ app/containers/Settings/MaskConfig.tsx | 162 +++ app/containers/Settings/MaskSetting.tsx | 39 + app/containers/Settings/ModelSetting.tsx | 211 +++ app/containers/Settings/PromptSetting.tsx | 62 + app/containers/Settings/ProviderSetting.tsx | 280 ++++ app/containers/Settings/SettingPanel.tsx | 1267 +---------------- app/containers/Settings/SyncConfigModal.tsx | 198 +++ app/containers/Settings/SyncItems.tsx | 105 ++ app/containers/Settings/UserPromptModal.tsx | 167 +++ app/containers/Settings/index.module.scss | 5 - app/containers/Settings/index.tsx | 6 +- app/containers/Sidebar/index.tsx | 3 +- .../discoverAssistant/index.module.scss | 6 - app/containers/discoverAssistant/index.tsx | 38 - app/containers/index.tsx | 12 +- app/hooks/useDrag.ts | 59 + app/hooks/useDragSideBar.ts | 74 - app/hooks/useListenWinResize.ts | 4 +- app/hooks/useMobileScreen.ts | 3 +- app/hooks/useRelativePosition.ts | 5 +- app/hooks/useRows.ts | 6 +- app/icons/darkIcon.svg | 3 + app/icons/downArrowIcon.svg | 3 + app/icons/lightIcon.svg | 4 + app/icons/passwordInvisible.svg | 3 + app/icons/passwordVisible.svg | 3 + app/icons/systemIcon.svg | 6 + app/locales/cn.ts | 12 +- app/locales/en.ts | 12 +- app/store/config.ts | 21 +- app/styles/globals.css | 5 + app/styles/globals.scss | 36 +- package.json | 1 + tailwind.config.js | 28 +- yarn.lock | 95 ++ 55 files changed, 2603 insertions(+), 1446 deletions(-) create mode 100644 app/components/Card/index.tsx create mode 100644 app/components/Input/index.tsx create mode 100644 app/components/List/index.tsx create mode 100644 app/components/Select/index.tsx create mode 100644 app/components/SlideRange/index.tsx create mode 100644 app/components/Switch/index.tsx create mode 100644 app/containers/Settings/AppSetting.tsx create mode 100644 app/containers/Settings/DangerItems.tsx create mode 100644 app/containers/Settings/MaskConfig.tsx create mode 100644 app/containers/Settings/MaskSetting.tsx create mode 100644 app/containers/Settings/ModelSetting.tsx create mode 100644 app/containers/Settings/PromptSetting.tsx create mode 100644 app/containers/Settings/ProviderSetting.tsx create mode 100644 app/containers/Settings/SyncConfigModal.tsx create mode 100644 app/containers/Settings/SyncItems.tsx create mode 100644 app/containers/Settings/UserPromptModal.tsx delete mode 100644 app/containers/discoverAssistant/index.module.scss delete mode 100644 app/containers/discoverAssistant/index.tsx create mode 100644 app/hooks/useDrag.ts delete mode 100644 app/hooks/useDragSideBar.ts create mode 100644 app/icons/darkIcon.svg create mode 100644 app/icons/downArrowIcon.svg create mode 100644 app/icons/lightIcon.svg create mode 100644 app/icons/passwordInvisible.svg create mode 100644 app/icons/passwordVisible.svg create mode 100644 app/icons/systemIcon.svg diff --git a/app/components/Btn/index.tsx b/app/components/Btn/index.tsx index 59bea6cc0..3c7d9d68a 100644 --- a/app/components/Btn/index.tsx +++ b/app/components/Btn/index.tsx @@ -2,11 +2,11 @@ import * as React from "react"; export type ButtonType = "primary" | "danger" | null; -export default function IconButton(props: { +export default function Btn(props: { onClick?: () => void; icon?: JSX.Element; type?: ButtonType; - text?: string; + text?: React.ReactNode; bordered?: boolean; shadow?: boolean; className?: string; @@ -20,8 +20,6 @@ export default function IconButton(props: { icon, type, text, - bordered, - shadow, className, title, disabled, @@ -29,18 +27,30 @@ export default function IconButton(props: { autoFocus, } = props; + let btnClassName; + + switch (type) { + case "primary": + btnClassName = `${disabled ? "bg-blue-300" : "bg-blue-600"} text-white`; + break; + case "danger": + btnClassName = `${ + disabled ? "bg-blue-300" : "bg-blue-600" + } text-text-danger`; + break; + default: + btnClassName = `${ + disabled ? "bg-gray-100" : "bg-gray-300" + } text-gray-500`; + } + return (