From e0bbb8bb68429d160c50af512eaa5181b50dc2c3 Mon Sep 17 00:00:00 2001 From: Dogtiti <499960698@qq.com> Date: Wed, 6 Nov 2024 16:58:26 +0800 Subject: [PATCH 1/2] style: improve classname by clsx --- app/components/auth.tsx | 6 +++-- app/components/button.tsx | 24 ++++++++++-------- app/components/chat-list.tsx | 13 +++++----- app/components/chat.tsx | 30 +++++++++++----------- app/components/exporter.tsx | 14 ++++++----- app/components/home.tsx | 17 ++++++++----- app/components/input-range.tsx | 3 ++- app/components/markdown.tsx | 12 ++++++--- app/components/mask.tsx | 3 ++- app/components/message-selector.tsx | 14 +++++------ app/components/new-chat.tsx | 5 +++- app/components/plugin.tsx | 8 ++++-- app/components/sd/sd-panel.tsx | 3 ++- app/components/sd/sd.tsx | 8 ++++-- app/components/sidebar.tsx | 17 +++++++------ app/components/ui-lib.tsx | 39 +++++++++++++++++------------ 16 files changed, 130 insertions(+), 86 deletions(-) diff --git a/app/components/auth.tsx b/app/components/auth.tsx index 539a52eecc9..5375bda3f70 100644 --- a/app/components/auth.tsx +++ b/app/components/auth.tsx @@ -18,6 +18,8 @@ import { trackSettingsPageGuideToCPaymentClick, trackAuthorizationPageButtonToCPaymentClick, } from "../utils/auth-settings-events"; +import clsx from "clsx"; + const storage = safeLocalStorage(); export function AuthPage() { @@ -54,7 +56,7 @@ export function AuthPage() { onClick={() => navigate(Path.Home)} > -
+
@@ -163,7 +165,7 @@ function TopBanner() { onMouseEnter={handleMouseEnter} onMouseLeave={handleMouseLeave} > -
+
{Locale.Auth.TopTips} diff --git a/app/components/button.tsx b/app/components/button.tsx index 87b4abd30f9..157d5d73da5 100644 --- a/app/components/button.tsx +++ b/app/components/button.tsx @@ -2,6 +2,7 @@ import * as React from "react"; import styles from "./button.module.scss"; import { CSSProperties } from "react"; +import clsx from "clsx"; export type ButtonType = "primary" | "danger" | null; @@ -22,12 +23,16 @@ export function IconButton(props: { }) { return (
diff --git a/app/components/chat-list.tsx b/app/components/chat-list.tsx index 03b1a5c8803..63dc4d5ff30 100644 --- a/app/components/chat-list.tsx +++ b/app/components/chat-list.tsx @@ -18,6 +18,7 @@ import { Mask } from "../store/mask"; import { useRef, useEffect } from "react"; import { showConfirm } from "./ui-lib"; import { useMobileScreen } from "../utils"; +import clsx from "clsx"; export function ChatItem(props: { onClick?: () => void; @@ -45,11 +46,11 @@ export function ChatItem(props: { {(provided) => (
{ draggableRef.current = ele; @@ -63,7 +64,7 @@ export function ChatItem(props: { > {props.narrow ? (
-
+
{props.showToast && context.length > 0 && (
props.setShowModal(true)} > @@ -332,10 +333,9 @@ export function PromptHints(props: { {props.prompts.map((prompt, i) => (
props.onPromptSelect(prompt)} onMouseEnter={() => setSelectIndex(i)} @@ -395,7 +395,7 @@ export function ChatAction(props: { return (
{ props.onClick(); setTimeout(updateWidth, 1); @@ -1596,9 +1596,12 @@ function _Chat() {
)} -
+
setIsEditingMessage(true)} > {!session.topic ? DEFAULT_TOPIC : session.topic} @@ -1872,7 +1875,7 @@ function _Chat() { )} {getMessageImages(message).length > 1 && (