1010 <div class =" sidebar-text" >
1111 <p class =" text-muted small mt-2 mb-2 help-text" >
1212 <span v-if =" props.public" >
13- You are viewing a public project in read-only mode .
13+ You are viewing a shared project, which cannot be edited .
1414 Click on <em >Open this project</em > to make changes.
1515 </span >
1616 <template v-else >
127127 </div >
128128 <Modal id =" confirmOpenModal" v-model =" openProjectModalOpen" >
129129 <template v-if =" props .public " >
130- Opening this public project will delete your own project's content.
130+ Opening this project will <strong >overwrite</strong > your own project's content with the
131+ content of this shared project.
131132 </template >
132- <template v-else >Opening a file will delete the current project's content.</template >
133+ <template v-else >Opening a file will <strong >overwrite</strong > your project's content with the
134+ content of the opened project file.</template >
133135 <Alert type =" danger" >All unsaved changes in your project will be lost.</Alert >
134136 <template v-slot :title >
135- <template v-if =" props .public " >Open public project</template >
136- <template v-else >Open file</template >
137+ <template v-if =" props .public " >Open shared project</template >
138+ <template v-else >Open project file</template >
137139 </template >
138140 <template v-slot :footer >
139- <button type =" button" class =" btn btn-danger"
140- @click =" doOpenProject" >Delete and open project</button >
141+ <button v-if =" props.public" type =" button" class =" btn btn-danger"
142+ @click =" doOpenProject" >Overwrite your project</button >
143+ <button v-else type =" button" class =" btn btn-danger"
144+ @click =" doOpenProject" >Select file and overwrite your project</button >
141145 </template >
142146 </Modal >
143147 <Modal id =" confirmResetModal" v-model =" resetProjectModalOpen" >
153157 </template >
154158 </Modal >
155159 <Modal id =" publishModal" class =" modal-lg" v-model =" publishModalOpen" >
156- Make this project accessible to others by following these steps:
160+ Share this project with others by generating a sharable project link. The shared
161+ project cannot be edited by others. Follow these steps:
157162 <ol class =" steps" >
158- <li >Save your project file and upload it to a public place . You can
159- use the cloud storage provider of your choice to create a public link to the
163+ <li >Save your project file and upload it to a storage provider . You can
164+ use the cloud storage provider of your choice to create an access link to the
160165 file. You can also use your own web server to host the file.
161166 <div class =" mt-2" >
162167 <button class =" btn btn-success" type =" button" @click =" saveProjectFile" >
235240 </ol >
236241 </p >
237242 </li >
238- <li >Paste the public link:</li >
243+ <li >Paste the access link:</li >
239244 <input type =" text" class =" form-control mt-2" v-model =" publicFileUrl"
240245 placeholder =" " >
241- <div class =" form-text" >
242- This link will not be shared. If you delete the source file, the public project will also be deleted.
243- </div >
246+ <div class =" form-text" >
247+ This link will not be shared. If you delete the source file, the shared project will also be deleted.
248+ </div >
244249 </ol >
245250 <Alert v-if =" publishErrorText" type =" danger" >{{ publishErrorText }}</Alert >
246251 <template v-slot :title >
247- Publish project
252+ Share project
248253 </template >
249254 <template v-slot :footer >
250255 <button type =" button" class =" btn btn-primary"
251- @click =" doPublish" >Publish </button >
256+ @click =" doPublish" >Generate project link </button >
252257 </template >
253258 </Modal >
254259 <Modal id =" publisedhModal" class =" modal-lg" v-model =" publishedModalOpen" cancel-text =" Close" >
255- <Alert type =" success" styles =" margin-top: 0 !important;" >Your project was published .</Alert >
256- <p >Everyone can access the project with the following link:</p >
260+ <Alert type =" success" styles =" margin-top: 0 !important;" >Your shared project was created .</Alert >
261+ <p >This project can be viewed by others with the following link:</p >
257262 <div class =" input-group mt-2" >
258263 <input type =" text" class =" form-control" disabled :value =" publicUrl"
259264 id =" publicUrl" >
260265 <button class =" btn btn-success" type =" button" @click =" copyUrl" >
261266 <Ico :name =" copyIcon" class =" me-2" />{{ copyText }}
262267 </button >
263268 </div >
269+ <div class =" form-text" >
270+ Copy the link before you close this window.
271+ </div >
264272 <p class =" mt-3" >You can
265273 <ul >
266274 <li >Change or replace the source file on your storage provider to update
267- the published project.</li >
275+ the shared project.</li >
268276 <li >Delete the source file on your storage provider to delete
269- the published project.</li >
277+ the shared project.</li >
270278 </ul >
271279 </p >
272280 <template v-slot :footer >
273281 <NuxtLink class =" btn btn-primary"
274- :to =" publicUrl" >Show published project</NuxtLink >
282+ :to =" publicUrl" >Go to shared project</NuxtLink >
275283 </template >
276284 <template v-slot :title >
277- Project was published
285+ Shared project created
278286 </template >
279287 </Modal >
280288</template >
@@ -505,11 +513,11 @@ function loadLocalStorage() {
505513 }
506514}
507515
508- function handleNavbarButtonClick(button : " open" | " save" | " publish " | " reset" ) {
516+ function handleNavbarButtonClick(button : " open" | " save" | " share " | " reset" ) {
509517 const functions = {
510518 " open" : openProjectFile ,
511519 " save" : saveProjectFile ,
512- " publish " : publishProject ,
520+ " share " : publishProject ,
513521 " reset" : resetProject ,
514522 " toggle-sidebar" : toggleSidebar ,
515523 " open-public" : openPublicProject ,
@@ -603,7 +611,8 @@ async function loadProjectFromFile() {
603611}
604612
605613function loadPublicProject() {
606- alert (" Not implememted." )
614+ localStorage .setItem (" project" , JSON .stringify (props .publicProjectData ))
615+ navigateTo (' /' )
607616}
608617
609618function readFileAsString(file : File ): Promise <string > {
@@ -674,7 +683,7 @@ async function doPublish() {
674683 result = await res .json ()
675684 } else {
676685 if (res .status == 422 ) {
677- publishErrorText .value = " Error: Bad API request ."
686+ publishErrorText .value = " Validation error: Make sure you entered a valid link ."
678687 } else {
679688 const d = await res .json ()
680689 publishErrorText .value = d .detail .message
@@ -686,12 +695,11 @@ async function doPublish() {
686695 if (! publishErrorText .value ) {
687696 finishPublish (result .id )
688697 }
689-
690698}
691699
692700function finishPublish(id : string ) {
693701 const rootUrl = ` ${location .protocol }//${location .host } ` ;
694- publicUrl .value = ` ${rootUrl }/public /${id } `
702+ publicUrl .value = ` ${rootUrl }/projects /${id } `
695703 publishModalOpen .value = false
696704 publishedModalOpen .value = true
697705}
0 commit comments