@@ -13,7 +13,7 @@ import { Modal, showToast } from "./ui-lib";
1313import { copyToClipboard , downloadAs } from "../utils" ;
1414import { Path , ApiPath , REPO_URL } from "@/app/constant" ;
1515import { Loading } from "./home" ;
16- import styles from "./artifact .module.scss" ;
16+ import styles from "./artifacts .module.scss" ;
1717
1818export 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
0 commit comments