Skip to content

Commit 6737f01

Browse files
committed
chore: artifact => artifacts
1 parent f2d2622 commit 6737f01

9 files changed

Lines changed: 38 additions & 34 deletions

File tree

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.artifact {
1+
.artifacts {
22
display: flex;
33
width: 100%;
44
height: 100%;
@@ -23,7 +23,7 @@
2323
}
2424
}
2525

26-
.artifact-iframe {
26+
.artifacts-iframe {
2727
width: 100%;
2828
border: var(--border-in-light);
2929
border-radius: 6px;
Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { Modal, showToast } from "./ui-lib";
1313
import { copyToClipboard, downloadAs } from "../utils";
1414
import { Path, ApiPath, REPO_URL } from "@/app/constant";
1515
import { Loading } from "./home";
16-
import styles from "./artifact.module.scss";
16+
import styles from "./artifacts.module.scss";
1717

1818
export function HTMLPreview(props: {
1919
code: string;
@@ -72,7 +72,7 @@ export function HTMLPreview(props: {
7272

7373
return (
7474
<iframe
75-
className={styles["artifact-iframe"]}
75+
className={styles["artifacts-iframe"]}
7676
id={frameId.current}
7777
ref={ref}
7878
sandbox="allow-forms allow-modals allow-scripts"
@@ -83,7 +83,7 @@ export function HTMLPreview(props: {
8383
);
8484
}
8585

86-
export function ArtifactShareButton({
86+
export function ArtifactsShareButton({
8787
getCode,
8888
id,
8989
style,
@@ -98,13 +98,13 @@ export function ArtifactShareButton({
9898
const [name, setName] = useState(id);
9999
const [show, setShow] = useState(false);
100100
const shareUrl = useMemo(
101-
() => [location.origin, "#", Path.Artifact, "/", name].join(""),
101+
() => [location.origin, "#", Path.Artifacts, "/", name].join(""),
102102
[name],
103103
);
104104
const upload = (code: string) =>
105105
id
106106
? Promise.resolve({ id })
107-
: fetch(ApiPath.Artifact, {
107+
: fetch(ApiPath.Artifacts, {
108108
method: "POST",
109109
body: code,
110110
})
@@ -116,15 +116,15 @@ export function ArtifactShareButton({
116116
throw Error();
117117
})
118118
.catch((e) => {
119-
showToast(Locale.Export.Artifact.Error);
119+
showToast(Locale.Export.Artifacts.Error);
120120
});
121121
return (
122122
<>
123123
<div className="window-action-button" style={style}>
124124
<IconButton
125125
icon={loading ? <LoadingButtonIcon /> : <ExportIcon />}
126126
bordered
127-
title={Locale.Export.Artifact.Title}
127+
title={Locale.Export.Artifacts.Title}
128128
onClick={() => {
129129
if (loading) return;
130130
setLoading(true);
@@ -142,7 +142,7 @@ export function ArtifactShareButton({
142142
{show && (
143143
<div className="modal-mask">
144144
<Modal
145-
title={Locale.Export.Artifact.Title}
145+
title={Locale.Export.Artifacts.Title}
146146
onClose={() => setShow(false)}
147147
actions={[
148148
<IconButton
@@ -179,15 +179,15 @@ export function ArtifactShareButton({
179179
);
180180
}
181181

182-
export function Artifact() {
182+
export function Artifacts() {
183183
const { id } = useParams();
184184
const [code, setCode] = useState("");
185185
const [loading, setLoading] = useState(true);
186186
const [fileName, setFileName] = useState("");
187187

188188
useEffect(() => {
189189
if (id) {
190-
fetch(`${ApiPath.Artifact}?id=${id}`)
190+
fetch(`${ApiPath.Artifacts}?id=${id}`)
191191
.then((res) => {
192192
if (res.status > 300) {
193193
throw Error("can not get content");
@@ -197,21 +197,25 @@ export function Artifact() {
197197
.then((res) => res.text())
198198
.then(setCode)
199199
.catch((e) => {
200-
showToast(Locale.Export.Artifact.Error);
200+
showToast(Locale.Export.Artifacts.Error);
201201
});
202202
}
203203
}, [id]);
204204

205205
return (
206-
<div className={styles["artifact"]}>
207-
<div className={styles["artifact-header"]}>
206+
<div className={styles["artifacts"]}>
207+
<div className={styles["artifacts-header"]}>
208208
<a href={REPO_URL} target="_blank" rel="noopener noreferrer">
209209
<IconButton bordered icon={<GithubIcon />} shadow />
210210
</a>
211-
<div className={styles["artifact-title"]}>NextChat Artifact</div>
212-
<ArtifactShareButton id={id} getCode={() => code} fileName={fileName} />
211+
<div className={styles["artifacts-title"]}>NextChat Artifacts</div>
212+
<ArtifactsShareButton
213+
id={id}
214+
getCode={() => code}
215+
fileName={fileName}
216+
/>
213217
</div>
214-
<div className={styles["artifact-content"]}>
218+
<div className={styles["artifacts-content"]}>
215219
{loading && <Loading />}
216220
{code && (
217221
<HTMLPreview

app/components/chat.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -635,8 +635,8 @@ export function ChatActions(props: {
635635
defaultSelectedValue={chatStore.currentSession().mask?.plugin}
636636
items={[
637637
{
638-
title: Locale.Plugin.Artifact,
639-
value: Plugin.Artifact,
638+
title: Locale.Plugin.Artifacts,
639+
value: Plugin.Artifacts,
640640
},
641641
]}
642642
onClose={() => setShowPluginSelector(false)}

app/components/home.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export function Loading(props: { noLogo?: boolean }) {
3939
);
4040
}
4141

42-
const Artifact = dynamic(async () => (await import("./artifact")).Artifact, {
42+
const Artifacts = dynamic(async () => (await import("./artifacts")).Artifacts, {
4343
loading: () => <Loading noLogo />,
4444
});
4545

@@ -141,7 +141,7 @@ export function WindowContent(props: { children: React.ReactNode }) {
141141
function Screen() {
142142
const config = useAppConfig();
143143
const location = useLocation();
144-
const isArtifact = location.pathname.includes(Path.Artifact);
144+
const isArtifact = location.pathname.includes(Path.Artifacts);
145145
const isHome = location.pathname === Path.Home;
146146
const isAuth = location.pathname === Path.Auth;
147147
const isSd = location.pathname === Path.Sd;
@@ -158,7 +158,7 @@ function Screen() {
158158
if (isArtifact) {
159159
return (
160160
<Routes>
161-
<Route path="/artifact/:id" element={<Artifact />} />
161+
<Route path="/artifacts/:id" element={<Artifacts />} />
162162
</Routes>
163163
);
164164
}

app/components/markdown.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import LoadingIcon from "../icons/three-dots.svg";
1313
import React from "react";
1414
import { useDebouncedCallback } from "use-debounce";
1515
import { showImageModal, FullScreen } from "./ui-lib";
16-
import { ArtifactShareButton, HTMLPreview } from "./artifact";
16+
import { ArtifactsShareButton, HTMLPreview } from "./artifacts";
1717
import { Plugin } from "../constant";
1818
import { useChatStore } from "../store";
1919
export function Mermaid(props: { code: string }) {
@@ -92,7 +92,7 @@ export function PreCode(props: { children: any }) {
9292
}, [refText]);
9393

9494
const enableArtifacts = useMemo(
95-
() => plugins?.includes(Plugin.Artifact),
95+
() => plugins?.includes(Plugin.Artifacts),
9696
[plugins],
9797
);
9898

@@ -115,7 +115,7 @@ export function PreCode(props: { children: any }) {
115115
)}
116116
{htmlCode.length > 0 && enableArtifacts && (
117117
<FullScreen className="no-dark html" right={70}>
118-
<ArtifactShareButton
118+
<ArtifactsShareButton
119119
style={{ position: "absolute", right: 20, top: 10 }}
120120
getCode={() => htmlCode}
121121
/>

app/constant.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export enum Path {
3535
Auth = "/auth",
3636
Sd = "/sd",
3737
SdNew = "/sd-new",
38-
Artifact = "/artifact",
38+
Artifacts = "/artifacts",
3939
}
4040

4141
export enum ApiPath {
@@ -48,7 +48,7 @@ export enum ApiPath {
4848
ByteDance = "/api/bytedance",
4949
Alibaba = "/api/alibaba",
5050
Stability = "/api/stability",
51-
Artifact = "/api/artifact",
51+
Artifacts = "/api/artifacts",
5252
}
5353

5454
export enum SlotID {
@@ -62,7 +62,7 @@ export enum FileName {
6262
}
6363

6464
export enum Plugin {
65-
Artifact = "artifact",
65+
Artifacts = "artifacts",
6666
}
6767

6868
export enum StoreKey {

app/locales/cn.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ const cn = {
104104
Toast: "正在生成截图",
105105
Modal: "长按或右键保存图片",
106106
},
107-
Artifact: {
107+
Artifacts: {
108108
Title: "分享页面",
109109
Error: "分享失败",
110110
},
@@ -461,7 +461,7 @@ const cn = {
461461
},
462462
Plugin: {
463463
Name: "插件",
464-
Artifact: "Artifact",
464+
Artifacts: "Artifacts",
465465
},
466466
Discovery: {
467467
Name: "发现",

app/locales/en.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ const en: LocaleType = {
106106
Toast: "Capturing Image...",
107107
Modal: "Long press or right click to save image",
108108
},
109-
Artifact: {
110-
Title: "Share Artifact",
109+
Artifacts: {
110+
Title: "Share Artifacts",
111111
Error: "Share Error",
112112
},
113113
},
@@ -468,7 +468,7 @@ const en: LocaleType = {
468468
},
469469
Plugin: {
470470
Name: "Plugin",
471-
Artifact: "Artifact",
471+
Artifacts: "Artifacts",
472472
},
473473
Discovery: {
474474
Name: "Discovery",

0 commit comments

Comments
 (0)