mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-10-10 03:56:37 +08:00
Update: Style improvements, Italian localization fix and small improvements
- Added 'disabled' class to the input element when tightBorder is false. - Applied unavailable cursor style and disabled gray background for elements with the 'disabled' class. - Fixed Italian localization: Changed 'Lingue' to 'Language' to maintain universal terminology and improve user experience. - Added improvement to resizing the border so that it was at 90% of the screen size - Added new color for disabled options - Added title for explain the usage of tightBorder and adjustedContainer - Added the feature to remove a chat item using the middle click (middle mouse button) - Properly utilized the MouseEvent event in the ChatItem component
This commit is contained in:
parent
03b3f16472
commit
aaba2fa8b5
@ -1,3 +1,4 @@
|
|||||||
|
import React, { MouseEvent as ReactMouseEvent } from "react";
|
||||||
import DeleteIcon from "../icons/delete.svg";
|
import DeleteIcon from "../icons/delete.svg";
|
||||||
import styles from "./home.module.scss";
|
import styles from "./home.module.scss";
|
||||||
import {
|
import {
|
||||||
@ -22,6 +23,12 @@ export function ChatItem(props: {
|
|||||||
id: number;
|
id: number;
|
||||||
index: number;
|
index: number;
|
||||||
}) {
|
}) {
|
||||||
|
const handleMiddleClick = (event: ReactMouseEvent<HTMLDivElement>) => {
|
||||||
|
if (event.button === 1 && props.onDelete) {
|
||||||
|
props.onDelete();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Draggable draggableId={`${props.id}`} index={props.index}>
|
<Draggable draggableId={`${props.id}`} index={props.index}>
|
||||||
{(provided) => (
|
{(provided) => (
|
||||||
@ -30,6 +37,7 @@ export function ChatItem(props: {
|
|||||||
props.selected && styles["chat-item-selected"]
|
props.selected && styles["chat-item-selected"]
|
||||||
}`}
|
}`}
|
||||||
onClick={props.onClick}
|
onClick={props.onClick}
|
||||||
|
onAuxClick={handleMiddleClick}
|
||||||
ref={provided.innerRef}
|
ref={provided.innerRef}
|
||||||
{...provided.draggableProps}
|
{...provided.draggableProps}
|
||||||
{...provided.dragHandleProps}
|
{...provided.dragHandleProps}
|
||||||
|
@ -37,6 +37,13 @@
|
|||||||
|
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.adjusted-container {
|
||||||
|
--window-width: 90vw;
|
||||||
|
max-width: 90vw;
|
||||||
|
max-height: 90vh;
|
||||||
|
border-radius: 20px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.sidebar {
|
.sidebar {
|
||||||
|
@ -110,7 +110,8 @@ function _Home() {
|
|||||||
<div
|
<div
|
||||||
className={`${
|
className={`${
|
||||||
config.tightBorder && !isMobileScreen()
|
config.tightBorder && !isMobileScreen()
|
||||||
? styles["tight-container"]
|
? styles["tight-container"] +
|
||||||
|
(config.adjustedContainer ? " " + styles["adjusted-container"] : "")
|
||||||
: styles.container
|
: styles.container
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
|
@ -293,6 +293,7 @@ export function Settings(props: { closeSettings: () => void }) {
|
|||||||
<SettingItem title={Locale.Settings.TightBorder}>
|
<SettingItem title={Locale.Settings.TightBorder}>
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
|
title={Locale.Settings.TightBorderExplanation}
|
||||||
checked={config.tightBorder}
|
checked={config.tightBorder}
|
||||||
onChange={(e) =>
|
onChange={(e) =>
|
||||||
updateConfig(
|
updateConfig(
|
||||||
@ -302,6 +303,22 @@ export function Settings(props: { closeSettings: () => void }) {
|
|||||||
></input>
|
></input>
|
||||||
</SettingItem>
|
</SettingItem>
|
||||||
|
|
||||||
|
<SettingItem title={Locale.Settings.AdjustedContainer}>
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
title={Locale.Settings.AdjustedContainerExplanation}
|
||||||
|
checked={config.adjustedContainer}
|
||||||
|
disabled={!config.tightBorder}
|
||||||
|
className={!config.tightBorder ? "disabled" : ""}
|
||||||
|
onChange={(e) =>
|
||||||
|
updateConfig(
|
||||||
|
(config) =>
|
||||||
|
(config.adjustedContainer = e.currentTarget.checked),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
></input>
|
||||||
|
</SettingItem>
|
||||||
|
|
||||||
<SettingItem title={Locale.Settings.SendPreviewBubble}>
|
<SettingItem title={Locale.Settings.SendPreviewBubble}>
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
|
@ -83,6 +83,10 @@ const cn = {
|
|||||||
SendKey: "发送键",
|
SendKey: "发送键",
|
||||||
Theme: "主题",
|
Theme: "主题",
|
||||||
TightBorder: "紧凑边框",
|
TightBorder: "紧凑边框",
|
||||||
|
TightBorderExplanation: "此选项将窗口边框调整为适应屏幕尺寸的100%",
|
||||||
|
AdjustedContainer: "调整容器",
|
||||||
|
AdjustedContainerExplanation:
|
||||||
|
"此选项将窗口调整为占据屏幕尺寸的90%,在其周围留下一定边距",
|
||||||
SendPreviewBubble: "发送预览气泡",
|
SendPreviewBubble: "发送预览气泡",
|
||||||
Prompt: {
|
Prompt: {
|
||||||
Disable: {
|
Disable: {
|
||||||
|
@ -85,6 +85,11 @@ const en: LocaleType = {
|
|||||||
SendKey: "Send Key",
|
SendKey: "Send Key",
|
||||||
Theme: "Theme",
|
Theme: "Theme",
|
||||||
TightBorder: "Tight Border",
|
TightBorder: "Tight Border",
|
||||||
|
TightBorderExplanation:
|
||||||
|
"This option adjusts the border of the window to fit 100% of the screen size",
|
||||||
|
AdjustedContainer: "Adjusted container",
|
||||||
|
AdjustedContainerExplanation:
|
||||||
|
"This option adjusts the window to occupy 90% of the screen size, leaving some margins around it",
|
||||||
SendPreviewBubble: "Send Preview Bubble",
|
SendPreviewBubble: "Send Preview Bubble",
|
||||||
Prompt: {
|
Prompt: {
|
||||||
Disable: {
|
Disable: {
|
||||||
|
@ -85,6 +85,11 @@ const es: LocaleType = {
|
|||||||
SendKey: "Tecla de envío",
|
SendKey: "Tecla de envío",
|
||||||
Theme: "Tema",
|
Theme: "Tema",
|
||||||
TightBorder: "Borde ajustado",
|
TightBorder: "Borde ajustado",
|
||||||
|
TightBorderExplanation:
|
||||||
|
"Esta opción ajusta el borde de la ventana para que ocupe el 100% del tamaño de la pantalla",
|
||||||
|
AdjustedContainer: "Contenedor ajustado",
|
||||||
|
AdjustedContainerExplanation:
|
||||||
|
"Esta opción ajusta la ventana para que ocupe el 90% del tamaño de la pantalla, dejando márgenes alrededor",
|
||||||
SendPreviewBubble: "Enviar burbuja de vista previa",
|
SendPreviewBubble: "Enviar burbuja de vista previa",
|
||||||
Prompt: {
|
Prompt: {
|
||||||
Disable: {
|
Disable: {
|
||||||
|
@ -60,7 +60,7 @@ const it: LocaleType = {
|
|||||||
Close: "Chiudi",
|
Close: "Chiudi",
|
||||||
},
|
},
|
||||||
Lang: {
|
Lang: {
|
||||||
Name: "Lingue",
|
Name: "Language",
|
||||||
Options: {
|
Options: {
|
||||||
cn: "简体中文",
|
cn: "简体中文",
|
||||||
en: "English",
|
en: "English",
|
||||||
@ -85,6 +85,11 @@ const it: LocaleType = {
|
|||||||
SendKey: "Tasto invia",
|
SendKey: "Tasto invia",
|
||||||
Theme: "tema",
|
Theme: "tema",
|
||||||
TightBorder: "Bordi stretti",
|
TightBorder: "Bordi stretti",
|
||||||
|
TightBorderExplanation:
|
||||||
|
"Questa opzione adatta il bordo della finestra per adattarlo al 100% della dimensione dello schermo",
|
||||||
|
AdjustedContainer: "Contenitore regolabile",
|
||||||
|
AdjustedContainerExplanation:
|
||||||
|
"Questa opzione adatta la finestra per occupare il 90% della dimensione dello schermo, lasciando dei margini intorno",
|
||||||
SendPreviewBubble: "Invia l'anteprima della bolla",
|
SendPreviewBubble: "Invia l'anteprima della bolla",
|
||||||
Prompt: {
|
Prompt: {
|
||||||
Disable: {
|
Disable: {
|
||||||
|
@ -83,6 +83,10 @@ const tw: LocaleType = {
|
|||||||
SendKey: "發送鍵",
|
SendKey: "發送鍵",
|
||||||
Theme: "主題",
|
Theme: "主題",
|
||||||
TightBorder: "緊湊邊框",
|
TightBorder: "緊湊邊框",
|
||||||
|
TightBorderExplanation: "此選項將視窗邊框調整為適應屏幕尺寸的100%",
|
||||||
|
AdjustedContainer: "調整容器",
|
||||||
|
AdjustedContainerExplanation:
|
||||||
|
"此選項將視窗調整為占据屏幕尺寸的90%,在其周圍留下一定邊距",
|
||||||
SendPreviewBubble: "發送預覽氣泡",
|
SendPreviewBubble: "發送預覽氣泡",
|
||||||
Prompt: {
|
Prompt: {
|
||||||
Disable: {
|
Disable: {
|
||||||
|
@ -51,6 +51,7 @@ export interface ChatConfig {
|
|||||||
fontSize: number;
|
fontSize: number;
|
||||||
theme: Theme;
|
theme: Theme;
|
||||||
tightBorder: boolean;
|
tightBorder: boolean;
|
||||||
|
adjustedContainer: boolean;
|
||||||
sendPreviewBubble: boolean;
|
sendPreviewBubble: boolean;
|
||||||
|
|
||||||
disablePromptHint: boolean;
|
disablePromptHint: boolean;
|
||||||
@ -139,6 +140,7 @@ const DEFAULT_CONFIG: ChatConfig = {
|
|||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
theme: Theme.Auto as Theme,
|
theme: Theme.Auto as Theme,
|
||||||
tightBorder: false,
|
tightBorder: false,
|
||||||
|
adjustedContainer: false,
|
||||||
sendPreviewBubble: true,
|
sendPreviewBubble: true,
|
||||||
|
|
||||||
disablePromptHint: false,
|
disablePromptHint: false,
|
||||||
|
@ -9,6 +9,8 @@
|
|||||||
--bar-color: rgba(0, 0, 0, 0.1);
|
--bar-color: rgba(0, 0, 0, 0.1);
|
||||||
--theme-color: var(--gray);
|
--theme-color: var(--gray);
|
||||||
|
|
||||||
|
--gray-disabled: rgb(230, 230, 230);
|
||||||
|
|
||||||
/* shadow */
|
/* shadow */
|
||||||
--shadow: 50px 50px 100px 10px rgb(0, 0, 0, 0.1);
|
--shadow: 50px 50px 100px 10px rgb(0, 0, 0, 0.1);
|
||||||
--card-shadow: 0px 2px 4px 0px rgb(0, 0, 0, 0.05);
|
--card-shadow: 0px 2px 4px 0px rgb(0, 0, 0, 0.05);
|
||||||
@ -26,6 +28,8 @@
|
|||||||
--second: rgb(27 38 42);
|
--second: rgb(27 38 42);
|
||||||
--hover-color: #323232;
|
--hover-color: #323232;
|
||||||
|
|
||||||
|
--gray-disabled: rgba(59, 59, 59, 0.62);
|
||||||
|
|
||||||
--bar-color: rgba(255, 255, 255, 0.1);
|
--bar-color: rgba(255, 255, 255, 0.1);
|
||||||
|
|
||||||
--border-in-light: 1px solid rgba(255, 255, 255, 0.192);
|
--border-in-light: 1px solid rgba(255, 255, 255, 0.192);
|
||||||
@ -288,3 +292,8 @@ pre {
|
|||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.disabled {
|
||||||
|
background-color: var(--gray-disabled) !important;
|
||||||
|
cursor: not-allowed !important;
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user