Web app to Svelte5 (#540)
This commit is contained in:
1 parent
9eeb9fcffe
commit
c534c27ae3
35 files changed
+1724
-2331
No files matched your search
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { PlayletApi } from "lib/Api/PlayletApi";
|
||||
import { tr, userPreferencesStore } from "lib/Stores";
|
||||
import { translate, userPreferencesStore } from "lib/Stores";
|
||||
|
||||
const textSizes = ["text-2xl", "text-lg", "text-base", "text-sm", "text-xs"];
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
<div class="form-control m-5">
|
||||
<label class="label p-0 cursor-pointer">
|
||||
<div class="label-text {textSizes[level]}">{$tr(displayText)}</div>
|
||||
<div class="label-text {textSizes[level]}">{$translate(displayText)}</div>
|
||||
<input
|
||||
type="checkbox"
|
||||
name={key}
|
||||
@@ -32,5 +32,5 @@
|
||||
class="checkbox"
|
||||
/>
|
||||
</label>
|
||||
<div class="text-xs text-gray-500">{@html $tr(description)}</div>
|
||||
<div class="text-xs text-gray-500">{@html $translate(description)}</div>
|
||||
</div>
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { InvidiousApi } from "lib/Api/InvidiousApi";
|
||||
import { PlayletApi } from "lib/Api/PlayletApi";
|
||||
import { tr } from "lib/Stores";
|
||||
import { translate } from "lib/Stores";
|
||||
import { get } from "svelte/store";
|
||||
|
||||
const textSizes = ["text-2xl", "text-lg", "text-base", "text-sm", "text-xs"];
|
||||
@@ -16,12 +16,14 @@
|
||||
await PlayletApi.clearCache();
|
||||
InvidiousApi.clearCache();
|
||||
|
||||
alert(get(tr)("Cache cleared."));
|
||||
alert(get(translate)("Cache cleared."));
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="m-5">
|
||||
<div class={textSizes[level]}>{$tr(displayText)}</div>
|
||||
<div class="text-xs text-gray-500">{@html $tr(description)}</div>
|
||||
<button class="btn m-1" on:click={clearCache}>{$tr("Clear cache")}</button>
|
||||
<div class={textSizes[level]}>{$translate(displayText)}</div>
|
||||
<div class="text-xs text-gray-500">{@html $translate(description)}</div>
|
||||
<button class="btn m-1" on:click={clearCache}
|
||||
>{$translate("Clear cache")}</button
|
||||
>
|
||||
</div>
|
||||
+5
-5
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { PlayletApi } from "lib/Api/PlayletApi";
|
||||
import { searchHistoryStore, tr } from "lib/Stores";
|
||||
import { searchHistoryStore, translate } from "lib/Stores";
|
||||
import { get } from "svelte/store";
|
||||
|
||||
const textSizes = ["text-2xl", "text-lg", "text-base", "text-sm", "text-xs"];
|
||||
@@ -15,14 +15,14 @@
|
||||
await PlayletApi.clearSearchHistory();
|
||||
searchHistoryStore.set([]);
|
||||
|
||||
alert(get(tr)("Search history cleared."));
|
||||
alert(get(translate)("Search history cleared."));
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="m-5">
|
||||
<div class={textSizes[level]}>{$tr(displayText)}</div>
|
||||
<div class="text-xs text-gray-500">{@html $tr(description)}</div>
|
||||
<div class={textSizes[level]}>{$translate(displayText)}</div>
|
||||
<div class="text-xs text-gray-500">{@html $translate(description)}</div>
|
||||
<button class="btn m-1" on:click={clearSeachHistory}
|
||||
>{$tr("Clear search history")}</button
|
||||
>{$translate("Clear search history")}</button
|
||||
>
|
||||
</div>
|
||||
@@ -2,7 +2,7 @@
|
||||
import {
|
||||
homeLayoutFileStore,
|
||||
homeLayoutStore,
|
||||
tr,
|
||||
translate,
|
||||
userPreferencesStore,
|
||||
} from "lib/Stores";
|
||||
import ArrowUpIcon from "assets/remote-control/arrow-up.svg.svelte";
|
||||
@@ -89,10 +89,10 @@
|
||||
</script>
|
||||
|
||||
<div class="m-5">
|
||||
<div class={textSizes[level]}>{$tr(displayText)}</div>
|
||||
<div class="text-xs text-gray-500">{@html $tr(description)}</div>
|
||||
<div class={textSizes[level]}>{$translate(displayText)}</div>
|
||||
<div class="text-xs text-gray-500">{@html $translate(description)}</div>
|
||||
<button class="btn m-1" on:click={openHomeScreenEditor}
|
||||
>{$tr("Edit home screen")}</button
|
||||
>{$translate("Edit home screen")}</button
|
||||
>
|
||||
</div>
|
||||
|
||||
@@ -100,51 +100,57 @@
|
||||
<div class="modal-box bg-base-100">
|
||||
{#if value && homeLayout}
|
||||
<table class="w-full">
|
||||
{#each value as item, i (i)}
|
||||
<tr>
|
||||
<td>
|
||||
<div class="tooltip" data-tip="Move up">
|
||||
<button
|
||||
class="btn btn-outline btn-sm"
|
||||
on:click={() => moveUp(i)}
|
||||
disabled={i === 0}
|
||||
>
|
||||
<ArrowUpIcon />
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<label class="label p-0 cursor-pointer">
|
||||
<div class="label-text">{$tr(homeLayout[item.id].title)}</div>
|
||||
<input
|
||||
type="checkbox"
|
||||
name={item.id}
|
||||
bind:checked={item.enabled}
|
||||
class="toggle toggle-primary"
|
||||
/>
|
||||
</label>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<div class="tooltip" data-tip="Move down">
|
||||
<button
|
||||
class="btn btn-outline btn-sm m-2"
|
||||
on:click={() => moveDown(i)}
|
||||
disabled={i === value.length - 1}
|
||||
>
|
||||
<ArrowDownIcon />
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/each}
|
||||
<tbody>
|
||||
{#each value as item, i (i)}
|
||||
<tr>
|
||||
<td>
|
||||
<div class="tooltip" data-tip="Move up">
|
||||
<button
|
||||
class="btn btn-outline btn-sm"
|
||||
on:click={() => moveUp(i)}
|
||||
disabled={i === 0}
|
||||
>
|
||||
<ArrowUpIcon />
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<label class="label p-0 cursor-pointer">
|
||||
<div class="label-text">
|
||||
{$translate(homeLayout[item.id].title)}
|
||||
</div>
|
||||
<input
|
||||
type="checkbox"
|
||||
name={item.id}
|
||||
bind:checked={item.enabled}
|
||||
class="toggle toggle-primary"
|
||||
/>
|
||||
</label>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<div class="tooltip" data-tip="Move down">
|
||||
<button
|
||||
class="btn btn-outline btn-sm m-2"
|
||||
on:click={() => moveDown(i)}
|
||||
disabled={i === value.length - 1}
|
||||
>
|
||||
<ArrowDownIcon />
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/each}
|
||||
</tbody>
|
||||
</table>
|
||||
<form method="dialog" class="flex justify-center space-x-2">
|
||||
<button class="btn btn-primary" on:click={save}>{$tr("Save")}</button>
|
||||
<button class="btn btn-primary">{$tr("Close")}</button>
|
||||
<button class="btn btn-primary" on:click={save}
|
||||
>{$translate("Save")}</button
|
||||
>
|
||||
<button class="btn btn-primary">{$translate("Close")}</button>
|
||||
</form>
|
||||
{/if}
|
||||
</div>
|
||||
<form method="dialog" class="modal-backdrop">
|
||||
<button>{$tr("Close")}</button>
|
||||
<button>{$translate("Close")}</button>
|
||||
</form>
|
||||
</dialog>
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { PlayletApi } from "lib/Api/PlayletApi";
|
||||
import { tr, userPreferencesStore } from "lib/Stores";
|
||||
import { translate, userPreferencesStore } from "lib/Stores";
|
||||
|
||||
const textSizes = ["text-2xl", "text-lg", "text-base", "text-sm", "text-xs"];
|
||||
const qualityLabels = {
|
||||
@@ -37,7 +37,7 @@
|
||||
}, {});
|
||||
displayValue = originalValue
|
||||
.split(",")
|
||||
.map((item) => $tr(qualityLabels[item] || item))
|
||||
.map((item) => $translate(qualityLabels[item] || item))
|
||||
.join(", ");
|
||||
}
|
||||
}
|
||||
@@ -117,38 +117,42 @@
|
||||
</script>
|
||||
|
||||
<div class="m-5">
|
||||
<div class={textSizes[level]}>{$tr(displayText)}</div>
|
||||
<div class="text-xs text-gray-500">{@html $tr(description)}</div>
|
||||
<div class={textSizes[level]}>{$translate(displayText)}</div>
|
||||
<div class="text-xs text-gray-500">{@html $translate(description)}</div>
|
||||
<button class="btn m-1" on:click={openQualitySelector}>{displayValue}</button>
|
||||
</div>
|
||||
|
||||
<dialog bind:this={modal} class="modal" on:close={onClose}>
|
||||
<div class="modal-box bg-base-100">
|
||||
<table class="w-full">
|
||||
{#each Object.keys(qualityLabels) as quality}
|
||||
<tr>
|
||||
<td>
|
||||
<label class="label p-0 cursor-pointer">
|
||||
<div class="label-text text-lg">
|
||||
{$tr(qualityLabels[quality])}
|
||||
</div>
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={valueCheckedStates[quality]}
|
||||
on:change={(e) => onChange(e, quality)}
|
||||
class="toggle toggle-primary"
|
||||
/>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
{/each}
|
||||
<tbody>
|
||||
{#each Object.keys(qualityLabels) as quality}
|
||||
<tr>
|
||||
<td>
|
||||
<label class="label p-0 cursor-pointer">
|
||||
<div class="label-text text-lg">
|
||||
{$translate(qualityLabels[quality])}
|
||||
</div>
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={valueCheckedStates[quality]}
|
||||
on:change={(e) => onChange(e, quality)}
|
||||
class="toggle toggle-primary"
|
||||
/>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
{/each}
|
||||
</tbody>
|
||||
</table>
|
||||
<form method="dialog" class="flex justify-center space-x-2">
|
||||
<button class="btn btn-primary" on:click={save}>{$tr("Save")}</button>
|
||||
<button class="btn btn-primary">{$tr("Close")}</button>
|
||||
<button class="btn btn-primary" on:click={save}
|
||||
>{$translate("Save")}</button
|
||||
>
|
||||
<button class="btn btn-primary">{$translate("Close")}</button>
|
||||
</form>
|
||||
</div>
|
||||
<form method="dialog" class="modal-backdrop">
|
||||
<button>{$tr("Close")}</button>
|
||||
<button>{$translate("Close")}</button>
|
||||
</form>
|
||||
</dialog>
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { PlayletApi } from "lib/Api/PlayletApi";
|
||||
import { tr, userPreferencesStore } from "lib/Stores";
|
||||
import { translate, userPreferencesStore } from "lib/Stores";
|
||||
const textSizes = ["text-2xl", "text-lg", "text-base", "text-sm", "text-xs"];
|
||||
export let displayText: string = "";
|
||||
export let key: string = "";
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
<div class="form-control m-5">
|
||||
<label class="label p-0 cursor-pointer">
|
||||
<div class="label-text {textSizes[level]}">{$tr(displayText)}</div>
|
||||
<div class="label-text {textSizes[level]}">{$translate(displayText)}</div>
|
||||
<div class="join mt-2 mb-2">
|
||||
<button
|
||||
class="join-item btn btn-sm btn-primary"
|
||||
@@ -52,5 +52,5 @@
|
||||
</button>
|
||||
</div>
|
||||
</label>
|
||||
<div class="text-xs text-gray-500">{@html $tr(description)}</div>
|
||||
<div class="text-xs text-gray-500">{@html $translate(description)}</div>
|
||||
</div>
|
||||
+7
-6
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from "svelte";
|
||||
import { PlayletApi } from "lib/Api/PlayletApi";
|
||||
import { playletStateStore, tr } from "lib/Stores";
|
||||
import { playletStateStore, translate } from "lib/Stores";
|
||||
import { ExternalControlProtocol } from "lib/Api/ExternalControlProtocol";
|
||||
import { get } from "svelte/store";
|
||||
|
||||
@@ -81,7 +81,7 @@
|
||||
version = "latest";
|
||||
}
|
||||
|
||||
const trFn = get(tr);
|
||||
const trFn = get(translate);
|
||||
|
||||
if (
|
||||
confirm(
|
||||
@@ -100,9 +100,9 @@
|
||||
</script>
|
||||
|
||||
<div class="m-5">
|
||||
<div class="text-lg">{$tr("Playlet Library version")}</div>
|
||||
<div class="text-lg">{$translate("Playlet Library version")}</div>
|
||||
<div class="text-xs text-gray-500">
|
||||
{$tr(
|
||||
{$translate(
|
||||
"The version of Playlet Lib to use. These correspond to tagged releases on Github. Releases that do not have a playlet-lib.zip file are disabled."
|
||||
)}
|
||||
</div>
|
||||
@@ -112,13 +112,14 @@
|
||||
bind:value={selectedRelease}
|
||||
class="select select-bordered join-item w-full mr-1"
|
||||
>
|
||||
<option selected value="">{$tr("Latest (default)")}</option>
|
||||
<option selected value="">{$translate("Latest (default)")}</option>
|
||||
{#each releases as release}
|
||||
<option disabled={!release.enabled} value={release.name}
|
||||
>{release.name}</option
|
||||
>
|
||||
{/each}
|
||||
</select>
|
||||
<button class="join-item btn" on:click={apply}>{$tr("Apply")}</button>
|
||||
<button class="join-item btn" on:click={apply}>{$translate("Apply")}</button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { PlayletApi } from "lib/Api/PlayletApi";
|
||||
import { tr, userPreferencesStore } from "lib/Stores";
|
||||
import { translate, userPreferencesStore } from "lib/Stores";
|
||||
|
||||
const textSizes = ["text-2xl", "text-lg", "text-base", "text-sm", "text-xs"];
|
||||
|
||||
@@ -24,13 +24,13 @@
|
||||
</script>
|
||||
|
||||
<div class="m-5">
|
||||
<div class={textSizes[level]}>{$tr(displayText)}</div>
|
||||
<div class="text-xs text-gray-500">{@html $tr(description)}</div>
|
||||
<div class={textSizes[level]}>{$translate(displayText)}</div>
|
||||
<div class="text-xs text-gray-500">{@html $translate(description)}</div>
|
||||
|
||||
{#each options as option}
|
||||
<div class="form-control">
|
||||
<label class="label cursor-pointer">
|
||||
<span class="label-text">{$tr(option.displayText)}</span>
|
||||
<span class="label-text">{$translate(option.displayText)}</span>
|
||||
<input
|
||||
type="radio"
|
||||
name={key}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { PlayletApi } from "lib/Api/PlayletApi";
|
||||
import { tr, userPreferencesStore } from "lib/Stores";
|
||||
import { translate, userPreferencesStore } from "lib/Stores";
|
||||
|
||||
const textSizes = ["text-2xl", "text-lg", "text-base", "text-sm", "text-xs"];
|
||||
const invidiousPublicInstancesLink = `<a class="link" href="https://api.invidious.io" target="_blank" rel="noopener noreferrer">https://api.invidious.io</a>`;
|
||||
@@ -27,10 +27,10 @@
|
||||
</script>
|
||||
|
||||
<div class="m-5">
|
||||
<div class={textSizes[level]}>{$tr(displayText)}</div>
|
||||
<div class={textSizes[level]}>{$translate(displayText)}</div>
|
||||
<div class="text-xs text-gray-500">
|
||||
<!-- TODO:P2 this should not be hardcoded here -->
|
||||
{@html $tr(description).replace(
|
||||
{@html $translate(description).replace(
|
||||
"%INVIDIOUS_PUBLIC_INSTANCES%",
|
||||
invidiousPublicInstancesLink
|
||||
)}
|
||||
@@ -45,7 +45,8 @@
|
||||
class="join-item input w-full mr-1"
|
||||
/>
|
||||
{#if inputValue !== currentValue}
|
||||
<button class="join-item btn" on:click={save}>{$tr("Save")}</button>
|
||||
<button class="join-item btn" on:click={save}>{$translate("Save")}</button
|
||||
>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
Reference in new issue
Block a user