8
8
9
9
<div class =" flex items-center" >
10
10
<a
11
- v-if =" state === 'data' && showcase.isPublic"
11
+ v-if =" !isLoading && state === 'data' && showcase.isPublic"
12
12
:href =" `https://vuetelemetry.com/explore/${showcase.slug}`"
13
13
target =" _blank"
14
14
class =" mr-3"
15
15
>
16
- <AppButton size =" small" appearance =" primary" >Open</AppButton >
16
+ <AppButton size =" small" appearance =" primary" outlined >Open</AppButton >
17
17
</a >
18
- <AppButton v-else @click.native =" saveShowcase" size =" small" appearance =" primary" class =" mr-3" >Save</AppButton >
18
+ <AppButton v-else-if = " !isLoading && state === 'data' && !showcase.isPublic " @click.native =" saveShowcase" size =" small" appearance =" primary" class =" mr-3" >{{ saving ? 'Saving...' : ' Save' }} </AppButton >
19
19
20
20
<a href =" https://twitter.com/VueTelemetry" target =" _blank" class =" mr-3" >
21
21
<TwitterIcon class =" w-5 h-5 hover:text-primary-500" />
47
47
>
48
48
<img
49
49
class =" w-6 h-6 mr-2"
50
- :src =" getURL ('/vue.svg')"
50
+ :src =" iconURL ('/vue.svg')"
51
51
alt
52
52
/>
53
53
<div class =" text-base leading-base font-bold-body-weight" >
65
65
>
66
66
<img
67
67
class =" w-6 h-6 mr-2"
68
- :src =" getURL (showcase.framework.imgPath)"
68
+ :src =" iconURL (showcase.framework.imgPath)"
69
69
alt
70
70
/>
71
71
<div class =" text-base leading-seven font-bold-body-weight" >
83
83
>
84
84
<img
85
85
class =" w-6 h-6 mr-2"
86
- :src =" getURL (showcase.ui.imgPath)"
86
+ :src =" iconURL (showcase.ui.imgPath)"
87
87
alt
88
88
/>
89
89
<div class =" text-base leading-seven font-bold-body-weight" >
@@ -205,6 +205,11 @@ export default {
205
205
ExploreDataItem,
206
206
AppButton
207
207
},
208
+ data () {
209
+ return {
210
+ saving: false
211
+ }
212
+ },
208
213
computed: {
209
214
... mapGetters ([
210
215
' isLoading' ,
@@ -222,22 +227,23 @@ export default {
222
227
}
223
228
},
224
229
methods: {
225
- getURL (path ) {
230
+ iconURL (path ) {
226
231
return ` https://icons.vuetelemetry.com${ path} `
227
232
},
228
233
refresh () {
229
234
browser .runtime .sendMessage ({ msg: ' refresh' })
230
235
},
231
236
async saveShowcase () {
232
- const res = await fetch (` https://vuetelemetry.com/api/analyze?url=${ this .showcase .hostname } &isPublic=true` , {
237
+ this .saving = true
238
+ const res = await fetch (` https://vuetelemetry.com/api/analyze?url=${ this .showcase .url } &isPublic=true` , {
233
239
method: ' GET'
234
240
})
235
241
.then ((response ) => {
236
- this .pending = false
242
+ this .saving = false
237
243
return response .json ()
238
244
})
239
245
.catch ((err ) => {
240
- this .pending = false
246
+ this .saving = false
241
247
throw new Error (err)
242
248
})
243
249
this .$store .commit (' SET_SHOWCASE' , res .body )
0 commit comments