diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 7c0a3bfea..a585dcfc6 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -37,7 +37,8 @@ "me-dutour-mathieu.vscode-github-actions", "eamodio.gitlens", "GitHub.copilot", - "GitHub.vscode-pull-request-github" + "GitHub.vscode-pull-request-github", + "medo64.render-crlf" ] } }, diff --git a/package.json b/package.json index ca02d2482..6200503d8 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "postinstall": "svelte-kit sync", "start": "svelte-kit start", "format": "prettier --write . && eslint . --fix", - "translations": "sh ./download_translations.sh" + "translations": "bash ./download_translations.sh" }, "dependencies": { "@felte/core": "^1.4.3", diff --git a/src/lib/components/mods/ModGrid.svelte b/src/lib/components/mods/ModGrid.svelte index 72b9ecf75..59485928b 100644 --- a/src/lib/components/mods/ModGrid.svelte +++ b/src/lib/components/mods/ModGrid.svelte @@ -45,12 +45,14 @@ let totalMods: number; let searchField = search; + $: searchDisabled = searchField.length < 3; + $: searchButtonClass = searchDisabled ? 'variant-filled-surface' : 'variant-filled-primary'; let timer: number; $: { clearTimeout(timer); timer = setTimeout(() => { - if (searchField && searchField.length > 2) { + if (searchField && !searchDisabled) { if ((search === '' || search === null) && searchField !== '' && searchField !== null) { orderBy = ModFields.Search; page = 0; @@ -70,11 +72,12 @@ $: if (browser) { const url = new URL(window.location.origin + window.location.pathname); url.searchParams.append('p', page.toString()); - searchField !== '' && searchField !== null && url.searchParams.append('q', searchField); + !searchDisabled && searchField !== '' && searchField !== null && url.searchParams.append('q', searchField); goto(url.toString(), { keepFocus: true }); } $: totalMods = $mods?.data?.getMods?.count || 0; + $: showPagination = ($mods && $mods.fetching) || ($mods && !$mods.fetching && totalMods > 0 && !$mods.error); $: gridClasses = colCount == 4 @@ -149,7 +152,10 @@ class="border-0 bg-transparent p-1.5 ring-0" name="search" placeholder={$t('search.placeholder-text')} /> - + {#if tagsOpen} @@ -178,16 +184,17 @@ {#if newMod && $user !== null} {$t('mods.new')} {/if} - -
- (page = p.detail)} - on:amount={(p) => (perPage = p.detail)} - controlVariant="variant-filled-surface" /> -
+ {#if showPagination} +
+ (page = p.detail)} + on:amount={(p) => (perPage = p.detail)} + controlVariant="variant-filled-surface" /> +
+ {/if} @@ -197,8 +204,12 @@ {/each} +{:else if $mods.error && $mods.error.message.includes("'Search' failed on the 'min' tag")} + {$t('search.failed.query-too-short')} {:else if $mods.error}

Oh no... {$mods.error.message}

+{:else if totalMods == 0} + {$t('search.results.empty')} {:else}
{#each $mods.data.getMods.mods as mod} @@ -207,17 +218,19 @@
{/if} -
-
- (page = p.detail)} - on:amount={(p) => (perPage = p.detail)} - controlVariant="variant-filled-surface" /> +{#if showPagination} +
+
+ (page = p.detail)} + on:amount={(p) => (perPage = p.detail)} + controlVariant="variant-filled-surface" /> +
-
+{/if}