Fix ad warning, add snapshot search

This commit is contained in:
Jai A 2020-11-05 18:00:40 -07:00
parent 7445f43b1b
commit 8ca09f6384
No known key found for this signature in database
GPG Key ID: E8B7DFB8C62797AC
4 changed files with 34 additions and 7 deletions

View File

@ -130,7 +130,9 @@
<DownloadIcon />
</nuxt-link>
</div>
<EthicalAd type="image" />
<client-only>
<EthicalAd type="image" />
</client-only>
</div>
</section>
</div>

View File

@ -54,7 +54,9 @@
</tr>
</tbody>
</table>
<EthicalAd />
<client-only>
<EthicalAd />
</client-only>
</div>
</template>

View File

@ -54,7 +54,9 @@
></pagination>
</section>
<div class="results column-grow-4">
<EthicalAd type="text" />
<client-only>
<EthicalAd type="text" />
</client-only>
<SearchResult
v-for="(result, index) in results"
:id="result.mod_id"
@ -233,6 +235,13 @@
>
</SearchFilter>
<h3>Versions</h3>
<SearchFilter
:active-filters="showVersions"
display-name="Snapshots"
facet-name="snapshots"
style="margin-bottom: 10px"
@toggle="fillInitialVersions"
/>
</section>
<multiselect
v-model="selectedVersions"
@ -327,6 +336,7 @@ export default {
data() {
return {
query: '',
showVersions: [],
selectedVersions: [],
versions: [],
facets: [],
@ -344,11 +354,22 @@ export default {
}
},
methods: {
async fillInitialVersions() {
async fillInitialVersions(x) {
try {
const res = await axios.get(
let url =
'https://api.modrinth.com/api/v1/tag/game_version?type=release'
)
if (x !== null) {
if (!this.showVersions.length > 0) {
this.showVersions.push('snapshots')
url = 'https://api.modrinth.com/api/v1/tag/game_version'
} else {
this.showVersions = []
}
}
const res = await axios.get(url)
this.versions = res.data
} catch (err) {

View File

@ -11,7 +11,9 @@
<p v-if="user.role === 'developer'" class="badge green">Developer</p>
</div>
</div>
<EthicalAd />
<client-only>
<EthicalAd />
</client-only>
<div class="user-mods">
<SearchResult
v-for="result in mods"