@@ -32,15 +32,10 @@ const installing = ref(false)
32
32
33
33
const installed: Ref <boolean > = ref (false )
34
34
35
- checkInstallStatus ()
36
-
37
35
function checkInstallStatus() {
38
36
if (props .instanceContent ) {
39
- installed .value = Object .values (props .instanceContent ).some ((content ) => {
40
- if (content .metadata ?.project_id === projectId .value ) {
41
- return true
42
- }
43
- })
37
+ installed .value = Object .values (props .instanceContent )
38
+ .some ((content ) => content .metadata ?.project_id === projectId .value )
44
39
}
45
40
}
46
41
@@ -64,7 +59,9 @@ async function install(toInstance: boolean) {
64
59
65
60
const modpack = computed (() => props .project .project_type === ' modpack' )
66
61
67
- const projectWebUrl = computed (() => ` https://modrinth.com/${props .project .project_type }/${props .project .slug } ` )
62
+ const projectWebUrl = computed (
63
+ () => ` https://modrinth.com/${props .project .project_type }/${props .project .slug } ` ,
64
+ )
68
65
69
66
const tooltip = defineMessages ({
70
67
installing: {
@@ -88,23 +85,41 @@ const messages = defineMessages({
88
85
},
89
86
})
90
87
91
- const projectId = computed (() => isSearchResult (props .project ) ? props .project .project_id : props .project .id )
88
+ const projectId = computed (() =>
89
+ isSearchResult (props .project ) ? props .project .project_id : props .project .id ,
90
+ )
92
91
93
92
const copyText = (text : string ) => {
94
- navigator .clipboard .writeText (text );
93
+ navigator .clipboard .writeText (text )
95
94
}
95
+
96
+ checkInstallStatus ()
96
97
</script >
97
98
98
99
<template >
99
100
<ButtonStyled color =" brand" >
100
- <button v-tooltip =" installing ? formatMessage(tooltip.installing) : installed ? formatMessage(tooltip.installed) : null" :disabled =" installing || installed" @click =" () => install(true)" >
101
+ <button
102
+ v-tooltip ="
103
+ installing
104
+ ? formatMessage(tooltip.installing)
105
+ : installed
106
+ ? formatMessage(tooltip.installed)
107
+ : null
108
+ "
109
+ :disabled =" installing || installed"
110
+ @click =" () => install(true)"
111
+ >
101
112
<SpinnerIcon v-if =" installing" />
102
113
<CheckIcon v-else-if =" installed" />
103
114
<DownloadIcon v-else />
104
- {{ formatMessage(
105
- installing ? commonMessages.installingButton :
106
- installed ? commonMessages.installedButton :
107
- commonMessages.installButton)
115
+ {{
116
+ formatMessage(
117
+ installing
118
+ ? commonMessages.installingButton
119
+ : installed
120
+ ? commonMessages.installedButton
121
+ : commonMessages.installButton,
122
+ )
108
123
}}
109
124
</button >
110
125
</ButtonStyled >
@@ -164,12 +179,8 @@ const copyText = (text: string) => {
164
179
<template #install-elsewhere >
165
180
<DownloadIcon /> {{ formatMessage(commonMessages.installToButton) }}
166
181
</template >
167
- <template #versions >
168
- <VersionIcon /> {{ formatMessage(messages.viewVersions) }}
169
- </template >
170
- <template #gallery >
171
- <ImageIcon /> {{ formatMessage(messages.viewGallery) }}
172
- </template >
182
+ <template #versions > <VersionIcon /> {{ formatMessage(messages.viewVersions) }} </template >
183
+ <template #gallery > <ImageIcon /> {{ formatMessage(messages.viewGallery) }} </template >
173
184
<template #open-link >
174
185
<ExternalIcon /> {{ formatMessage(commonMessages.openInBrowserButton) }}
175
186
</template >
0 commit comments