Skip to content

Commit 00be2be

Browse files
authored
Merge pull request #5088 from ChatGPTNextWeb/revert-5080-refactor-components
Revert "feat: improve components structure"
2 parents 1943f3b + 5b126c7 commit 00be2be

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+270
-329
lines changed
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import styles from "./auth.module.scss";
2-
import { IconButton } from "@/app/components/button/button";
2+
import { IconButton } from "./button";
33

44
import { useNavigate } from "react-router-dom";
5-
import { Path } from "@/app/constant";
6-
import { useAccessStore } from "@/app/store";
7-
import Locale from "@/app/locales";
5+
import { Path } from "../constant";
6+
import { useAccessStore } from "../store";
7+
import Locale from "../locales";
88

9-
import BotIcon from "@/app/icons/bot.svg";
9+
import BotIcon from "../icons/bot.svg";
1010
import { useEffect } from "react";
11-
import { getClientConfig } from "@/app/config/client";
11+
import { getClientConfig } from "../config/client";
1212

1313
export function AuthPage() {
1414
const navigate = useNavigate();

app/components/auth/index.tsx

Lines changed: 0 additions & 1 deletion
This file was deleted.

app/components/button/index.tsx

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
import DeleteIcon from "@/app/icons/delete.svg";
2-
import BotIcon from "@/app/icons/bot.svg";
1+
import DeleteIcon from "../icons/delete.svg";
2+
import BotIcon from "../icons/bot.svg";
33

4-
import styles from "@/app/components/home/home.module.scss";
4+
import styles from "./home.module.scss";
55
import {
66
DragDropContext,
77
Droppable,
88
Draggable,
99
OnDragEndResponder,
1010
} from "@hello-pangea/dnd";
1111

12-
import { useChatStore } from "@/app/store";
12+
import { useChatStore } from "../store";
1313

14-
import Locale from "@/app/locales";
14+
import Locale from "../locales";
1515
import { Link, useLocation, useNavigate } from "react-router-dom";
16-
import { Path } from "@/app/constant";
17-
import { MaskAvatar } from "@/app/components/mask/mask";
18-
import { Mask } from "@/app/store/mask";
16+
import { Path } from "../constant";
17+
import { MaskAvatar } from "./mask";
18+
import { Mask } from "../store/mask";
1919
import { useRef, useEffect } from "react";
20-
import { showConfirm } from "@/app/components/ui-lib";
21-
import { useMobileScreen } from "@/app/utils";
20+
import { showConfirm } from "./ui-lib";
21+
import { useMobileScreen } from "../utils";
2222

2323
export function ChatItem(props: {
2424
onClick?: () => void;

app/components/chat-list/index.tsx

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@import "../../styles/animation.scss";
1+
@import "../styles/animation.scss";
22

33
.attach-images {
44
position: absolute;
@@ -231,12 +231,10 @@
231231

232232
animation: slide-in ease 0.3s;
233233

234-
$linear: linear-gradient(
235-
to right,
236-
rgba(0, 0, 0, 0),
237-
rgba(0, 0, 0, 1),
238-
rgba(0, 0, 0, 0)
239-
);
234+
$linear: linear-gradient(to right,
235+
rgba(0, 0, 0, 0),
236+
rgba(0, 0, 0, 1),
237+
rgba(0, 0, 0, 0));
240238
mask-image: $linear;
241239

242240
@mixin show {
@@ -369,7 +367,7 @@
369367
}
370368
}
371369

372-
.chat-message-user > .chat-message-container {
370+
.chat-message-user>.chat-message-container {
373371
align-items: flex-end;
374372
}
375373

@@ -452,27 +450,23 @@
452450
border: rgba($color: #888, $alpha: 0.2) 1px solid;
453451
}
454452

453+
455454
@media only screen and (max-width: 600px) {
456-
$calc-image-width: calc(100vw / 3 * 2 / var(--image-count));
455+
$calc-image-width: calc(100vw/3*2/var(--image-count));
457456

458457
.chat-message-item-image-multi {
459458
width: $calc-image-width;
460459
height: $calc-image-width;
461460
}
462-
461+
463462
.chat-message-item-image {
464-
max-width: calc(100vw / 3 * 2);
463+
max-width: calc(100vw/3*2);
465464
}
466465
}
467466

468467
@media screen and (min-width: 600px) {
469-
$max-image-width: calc(
470-
calc(1200px - var(--sidebar-width)) / 3 * 2 / var(--image-count)
471-
);
472-
$image-width: calc(
473-
calc(var(--window-width) - var(--sidebar-width)) / 3 * 2 /
474-
var(--image-count)
475-
);
468+
$max-image-width: calc(calc(1200px - var(--sidebar-width))/3*2/var(--image-count));
469+
$image-width: calc(calc(var(--window-width) - var(--sidebar-width))/3*2/var(--image-count));
476470

477471
.chat-message-item-image-multi {
478472
width: $image-width;
@@ -482,7 +476,7 @@
482476
}
483477

484478
.chat-message-item-image {
485-
max-width: calc(calc(1200px - var(--sidebar-width)) / 3 * 2);
479+
max-width: calc(calc(1200px - var(--sidebar-width))/3*2);
486480
}
487481
}
488482

@@ -500,7 +494,7 @@
500494
z-index: 1;
501495
}
502496

503-
.chat-message-user > .chat-message-container > .chat-message-item {
497+
.chat-message-user>.chat-message-container>.chat-message-item {
504498
background-color: var(--second);
505499

506500
&:hover {
@@ -611,8 +605,7 @@
611605
min-height: 68px;
612606
}
613607

614-
.chat-input:focus {
615-
}
608+
.chat-input:focus {}
616609

617610
.chat-input-send {
618611
background-color: var(--primary);
@@ -631,4 +624,4 @@
631624
.chat-input-send {
632625
bottom: 30px;
633626
}
634-
}
627+
}
Lines changed: 49 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -9,34 +9,34 @@ import React, {
99
RefObject,
1010
} from "react";
1111

12-
import SendWhiteIcon from "@/app/icons/send-white.svg";
13-
import BrainIcon from "@/app/icons/brain.svg";
14-
import RenameIcon from "@/app/icons/rename.svg";
15-
import ExportIcon from "@/app/icons/share.svg";
16-
import ReturnIcon from "@/app/icons/return.svg";
17-
import CopyIcon from "@/app/icons/copy.svg";
18-
import LoadingIcon from "@/app/icons/three-dots.svg";
19-
import LoadingButtonIcon from "@/app/icons/loading.svg";
20-
import PromptIcon from "@/app/icons/prompt.svg";
21-
import MaskIcon from "@/app/icons/mask.svg";
22-
import MaxIcon from "@/app/icons/max.svg";
23-
import MinIcon from "@/app/icons/min.svg";
24-
import ResetIcon from "@/app/icons/reload.svg";
25-
import BreakIcon from "@/app/icons/break.svg";
26-
import SettingsIcon from "@/app/icons/chat-settings.svg";
27-
import DeleteIcon from "@/app/icons/clear.svg";
28-
import PinIcon from "@/app/icons/pin.svg";
29-
import EditIcon from "@/app/icons/rename.svg";
30-
import ConfirmIcon from "@/app/icons/confirm.svg";
31-
import CancelIcon from "@/app/icons/cancel.svg";
32-
import ImageIcon from "@/app/icons/image.svg";
33-
34-
import LightIcon from "@/app/icons/light.svg";
35-
import DarkIcon from "@/app/icons/dark.svg";
36-
import AutoIcon from "@/app/icons/auto.svg";
37-
import BottomIcon from "@/app/icons/bottom.svg";
38-
import StopIcon from "@/app/icons/pause.svg";
39-
import RobotIcon from "@/app/icons/robot.svg";
12+
import SendWhiteIcon from "../icons/send-white.svg";
13+
import BrainIcon from "../icons/brain.svg";
14+
import RenameIcon from "../icons/rename.svg";
15+
import ExportIcon from "../icons/share.svg";
16+
import ReturnIcon from "../icons/return.svg";
17+
import CopyIcon from "../icons/copy.svg";
18+
import LoadingIcon from "../icons/three-dots.svg";
19+
import LoadingButtonIcon from "../icons/loading.svg";
20+
import PromptIcon from "../icons/prompt.svg";
21+
import MaskIcon from "../icons/mask.svg";
22+
import MaxIcon from "../icons/max.svg";
23+
import MinIcon from "../icons/min.svg";
24+
import ResetIcon from "../icons/reload.svg";
25+
import BreakIcon from "../icons/break.svg";
26+
import SettingsIcon from "../icons/chat-settings.svg";
27+
import DeleteIcon from "../icons/clear.svg";
28+
import PinIcon from "../icons/pin.svg";
29+
import EditIcon from "../icons/rename.svg";
30+
import ConfirmIcon from "../icons/confirm.svg";
31+
import CancelIcon from "../icons/cancel.svg";
32+
import ImageIcon from "../icons/image.svg";
33+
34+
import LightIcon from "../icons/light.svg";
35+
import DarkIcon from "../icons/dark.svg";
36+
import AutoIcon from "../icons/auto.svg";
37+
import BottomIcon from "../icons/bottom.svg";
38+
import StopIcon from "../icons/pause.svg";
39+
import RobotIcon from "../icons/robot.svg";
4040

4141
import {
4242
ChatMessage,
@@ -49,7 +49,7 @@ import {
4949
useAppConfig,
5050
DEFAULT_TOPIC,
5151
ModelType,
52-
} from "@/app/store";
52+
} from "../store";
5353

5454
import {
5555
copyToClipboard,
@@ -59,17 +59,17 @@ import {
5959
getMessageTextContent,
6060
getMessageImages,
6161
isVisionModel,
62-
} from "@/app/utils";
62+
} from "../utils";
6363

6464
import { uploadImage as uploadImageRemote } from "@/app/utils/chat";
6565

6666
import dynamic from "next/dynamic";
6767

68-
import { ChatControllerPool } from "@/app/client/controller";
69-
import { Prompt, usePromptStore } from "@/app/store/prompt";
70-
import Locale from "@/app/locales";
68+
import { ChatControllerPool } from "../client/controller";
69+
import { Prompt, usePromptStore } from "../store/prompt";
70+
import Locale from "../locales";
7171

72-
import { IconButton } from "@/app/components/button";
72+
import { IconButton } from "./button";
7373
import styles from "./chat.module.scss";
7474

7575
import {
@@ -80,7 +80,7 @@ import {
8080
showConfirm,
8181
showPrompt,
8282
showToast,
83-
} from "@/app/components/ui-lib";
83+
} from "./ui-lib";
8484
import { useNavigate } from "react-router-dom";
8585
import {
8686
CHAT_PAGE_SIZE,
@@ -89,27 +89,20 @@ import {
8989
REQUEST_TIMEOUT_MS,
9090
UNFINISHED_INPUT,
9191
ServiceProvider,
92-
} from "@/app/constant";
93-
import { Avatar } from "../emoji";
94-
import {
95-
ContextPrompts,
96-
MaskAvatar,
97-
MaskConfig,
98-
} from "@/app/components/mask/mask";
99-
import { useMaskStore } from "@/app/store/mask";
100-
import { ChatCommandPrefix, useChatCommand, useCommand } from "@/app/command";
101-
import { prettyObject } from "@/app/utils/format";
102-
import { ExportMessageModal } from "@/app/components/exporter/exporter";
103-
import { getClientConfig } from "@/app/config/client";
104-
import { useAllModels } from "@/app/utils/hooks";
105-
import { MultimodalContent } from "@/app/client/api";
106-
107-
const Markdown = dynamic(
108-
async () => (await import("../markdown/markdown")).Markdown,
109-
{
110-
loading: () => <LoadingIcon />,
111-
},
112-
);
92+
} from "../constant";
93+
import { Avatar } from "./emoji";
94+
import { ContextPrompts, MaskAvatar, MaskConfig } from "./mask";
95+
import { useMaskStore } from "../store/mask";
96+
import { ChatCommandPrefix, useChatCommand, useCommand } from "../command";
97+
import { prettyObject } from "../utils/format";
98+
import { ExportMessageModal } from "./exporter";
99+
import { getClientConfig } from "../config/client";
100+
import { useAllModels } from "../utils/hooks";
101+
import { MultimodalContent } from "../client/api";
102+
103+
const Markdown = dynamic(async () => (await import("./markdown")).Markdown, {
104+
loading: () => <LoadingIcon />,
105+
});
113106

114107
export function SessionConfigModel(props: { onClose: () => void }) {
115108
const chatStore = useChatStore();

0 commit comments

Comments
 (0)