From 49fffe8cbeaf25b0ac7ea50deb5cace4af6f9444 Mon Sep 17 00:00:00 2001 From: bbig Date: Wed, 12 Jul 2023 18:04:12 +0800 Subject: [PATCH] v1.5: Add login module and GPT selection feature --- app/components/button.module.scss | 29 +++++++-- app/components/button.tsx | 8 ++- app/components/emoji.tsx | 31 +++++++++- app/components/home.tsx | 8 +-- app/components/settings.module.scss | 5 ++ app/components/settings.tsx | 73 +++++++++++++++++++++- app/components/sidebar.tsx | 14 ++--- app/components/ui-lib.module.scss | 91 +++++++++++++++++++++++++--- app/components/ui-lib.tsx | 58 ++++++++++++++++++ app/constant.ts | 1 + app/locales/cn.ts | 10 ++- app/locales/en.ts | 6 ++ app/masks/cn.ts | 35 ++++++++++- app/masks/en.ts | 35 ++++++++++- package.json | 2 +- public/avatar/chatgpt.png | Bin 0 -> 5872 bytes public/avatar/chatgpt4.png | Bin 0 -> 5672 bytes 17 files changed, 375 insertions(+), 31 deletions(-) create mode 100644 public/avatar/chatgpt.png create mode 100644 public/avatar/chatgpt4.png diff --git a/app/components/button.module.scss b/app/components/button.module.scss index 5aa53dc..e332df2 100644 --- a/app/components/button.module.scss +++ b/app/components/button.module.scss @@ -27,6 +27,26 @@ fill: white !important; } } + + &.danger { + color: rgba($color: red, $alpha: 0.8); + border-color: rgba($color: red, $alpha: 0.5); + background-color: rgba($color: red, $alpha: 0.05); + + &:hover { + border-color: red; + background-color: rgba($color: red, $alpha: 0.1); + } + + path { + fill: red !important; + } + } + + &:hover, + &:focus { + border-color: var(--primary); + } } .shadow { @@ -37,10 +57,6 @@ border: var(--border-in-light); } -.icon-button:hover { - border-color: var(--primary); -} - .icon-button-icon { width: 16px; height: 16px; @@ -56,9 +72,12 @@ } .icon-button-text { - margin-left: 5px; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; + + &:not(:first-child) { + margin-left: 5px; + } } diff --git a/app/components/button.tsx b/app/components/button.tsx index f93741b..7a56339 100644 --- a/app/components/button.tsx +++ b/app/components/button.tsx @@ -2,16 +2,20 @@ import * as React from "react"; import styles from "./button.module.scss"; +export type ButtonType = "primary" | "danger" | null; + export function IconButton(props: { onClick?: () => void; icon?: JSX.Element; - type?: "primary" | "danger"; + type?: ButtonType; text?: string; bordered?: boolean; shadow?: boolean; className?: string; title?: string; disabled?: boolean; + tabIndex?: number; + autoFocus?: boolean; }) { return (