Web app to Svelte5 (#540)

This commit is contained in:
Brahim Hadriche authored and GitHub committed 2025-01-09 21:22:34 -05:00
1 parent 9eeb9fcffe
commit c534c27ae3
35 files changed
+1724 -2331

No files matched your search

+6
View File
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
### Fixed
- Web app tech refresh
## [0.35.5] - 2025-01-09
### Added
+945 -1030
View File
File diff suppressed because it is too large. Load diff
+2 -2
View File
@@ -27,7 +27,7 @@
"semver": "^7.6.3",
"shelljs": "^0.8.5",
"ts-node": "^10.9.2",
"typescript": "5.7.2",
"typescript": "5.7.3",
"xml2js": "^0.6.2",
"yaml": "^2.7.0"
},
@@ -62,7 +62,7 @@
"generate-sponsorblock-config": "node tools/generate-sponsorblock-config.js",
"update-rale-component": "cd tools/RALE && rm TrackerTask.xml && curl -o TrackerTask.zip https://devtools.web.roku.com/roku-advanced-layout-editor/app/TrackerTask.zip && unzip TrackerTask.zip && rm TrackerTask.zip",
"postinstall": "cd playlet-lib && npm install && cd ../playlet-app && npm install && cd ../playlet-web && npm install",
"update-deps": "npx npm-check-updates --deep --upgrade --install always --reject @sveltejs/vite-plugin-svelte,svelte,vite,@vitejs/plugin-legacy",
"update-deps": "npx npm-check-updates --deep --upgrade --install always",
"registry:write": "node tools/registry.js --input registry.json",
"registry:read": "node tools/registry.js --output registry.json",
"registry:clear": "node tools/registry.js --clear",
+519 -1097
View File
File diff suppressed because it is too large. Load diff
+7 -7
View File
@@ -9,23 +9,23 @@
"check": "svelte-check --tsconfig ./tsconfig.json"
},
"devDependencies": {
"@sveltejs/vite-plugin-svelte": "3.1.2",
"@tailwindcss/typography": "^0.5.15",
"@sveltejs/vite-plugin-svelte": "^5.0.3",
"@tailwindcss/typography": "^0.5.16",
"@tsconfig/svelte": "^5.0.4",
"@vitejs/plugin-legacy": "^5.4.3",
"@vitejs/plugin-legacy": "^6.0.0",
"autoprefixer": "^10.4.20",
"daisyui": "^4.12.23",
"dotenv": "^16.4.7",
"ip": "^2.0.1",
"postcss": "^8.4.49",
"svelte": "4.2.19",
"svelte-check": "^4.1.1",
"svelte": "^5.17.3",
"svelte-check": "^4.1.3",
"svelte-preprocess": "^6.0.3",
"tailwindcss": "^3.4.17",
"terser": "^5.37.0",
"tslib": "^2.8.1",
"typescript": "^5.7.2",
"vite": "^5.4.11",
"typescript": "^5.7.3",
"vite": "^6.0.7",
"vite-plugin-compression": "^0.5.1",
"vite-tsconfig-paths": "^5.1.4"
}
+4 -4
View File
@@ -1,4 +1,4 @@
import { tr } from "lib/Stores";
import { translate } from "lib/Stores";
import { PlayletApi } from "./PlayletApi";
import { get } from "svelte/store";
@@ -31,14 +31,14 @@ export async function fetchLocale(locale: string) {
}
translations[source[0].textContent] = translation[0].textContent;
}
tr.set((s) => translations[s] || s);
translate.set((s) => translations[s] || s);
} catch (error) {
console.error(error);
}
}
export function getPluralString(c: number, zeroString: string, oneString: string, pluralString: string) {
const trFn = get(tr);
const trFn = get(translate);
c = c || 0;
if (c === 0) {
@@ -51,7 +51,7 @@ export function getPluralString(c: number, zeroString: string, oneString: string
}
export function getFormattedPluralString(c: number, zeroString: string, oneString: string, pluralString: string) {
const trFn = get(tr);
const trFn = get(translate);
c = c || 0;
if (c === 0) {
+7 -7
View File
@@ -6,7 +6,7 @@
import BookmarksIcon from "../assets/star-icon.svg.svelte";
import RemoteIcon from "../assets/remote-control.svg.svelte";
import { appStateStore, tr } from "lib/Stores";
import { appStateStore, translate } from "lib/Stores";
import { ScreenNames, type AppState } from "lib/Types";
import { onMount } from "svelte";
@@ -57,7 +57,7 @@
<div class="h-6">
<SearchIcon />
</div>
<span class="text-xs">{$tr("Search")}</span>
<span class="text-xs">{$translate("Search")}</span>
</button>
<button
on:click={() => setScreen("home")}
@@ -66,7 +66,7 @@
<div class="h-6">
<HomeIcon />
</div>
<span class="text-xs">{$tr("Home")}</span>
<span class="text-xs">{$translate("Home")}</span>
</button>
<button
on:click={() => setScreen("bookmarks")}
@@ -75,7 +75,7 @@
<div class="h-6">
<BookmarksIcon />
</div>
<span class="text-xs">{$tr("Bookmarks")}</span>
<span class="text-xs">{$translate("Bookmarks")}</span>
</button>
<button
on:click={() => setScreen("settings")}
@@ -84,7 +84,7 @@
<div class="h-6">
<SettingsIcon />
</div>
<span class="text-xs">{$tr("Settings")}</span>
<span class="text-xs">{$translate("Settings")}</span>
</button>
<button
on:click={() => setScreen("remote")}
@@ -93,7 +93,7 @@
<div class="h-6">
<RemoteIcon />
</div>
<span class="text-xs">{$tr("Remote")}</span>
<span class="text-xs">{$translate("Remote")}</span>
</button>
<button
on:click={() => setScreen("info")}
@@ -102,6 +102,6 @@
<div class="h-6">
<InfoIcon />
</div>
<span class="text-xs">{$tr("Info")}</span>
<span class="text-xs">{$translate("Info")}</span>
</button>
</div>
+5 -3
View File
@@ -1,6 +1,6 @@
<script lang="ts">
import { onDestroy, onMount } from "svelte";
import { playletStateStore, tr } from "lib/Stores";
import { playletStateStore, translate } from "lib/Stores";
import { InvidiousApi } from "lib/Api/InvidiousApi";
import { PlayletApi } from "./Api/PlayletApi";
import VideoCastDialog from "./VideoFeed/VideoCastDialog.svelte";
@@ -248,9 +248,11 @@
: 'hidden'} fixed w-full h-full bg-base-100/80 z-50 flex justify-center items-center"
>
{#if isDragging}
<div class="text-2xl font-bold">{$tr("Drop a YouTube link here")}</div>
<div class="text-2xl font-bold">
{$translate("Drop a YouTube link here")}
</div>
{:else if isLoading}
<span class="loading loading-spinner loading-md" />
<span class="loading loading-spinner loading-md"></span>
{/if}
</div>
+7 -7
View File
@@ -1,5 +1,5 @@
<script lang="ts">
import { playletStateStore, tr } from "lib/Stores";
import { playletStateStore, translate } from "lib/Stores";
import { PlayletApi } from "./Api/PlayletApi";
import { get } from "svelte/store";
@@ -69,7 +69,7 @@
<dialog bind:this={modal} class="modal" on:close={onClose}>
<form method="dialog" class="modal-box bg-base-100">
<div class="flex flex-col items-center">
<div class="text-xl font-medium m-4">{$tr("Profiles")}</div>
<div class="text-xl font-medium m-4">{$translate("Profiles")}</div>
{#each profiles as profile}
<div class="collapse collapse-arrow bg-base-300 m-1">
@@ -112,12 +112,12 @@
{#if profile.id !== currentProfile?.id}
<button
on:click={() => activate(profile.id)}
class="btn btn-primary m-1">{$tr("Activate")}</button
class="btn btn-primary m-1">{$translate("Activate")}</button
>
{/if}
<button
on:click={() => logout(profile.id)}
class="btn btn-primary m-1">{$tr("Logout")}</button
class="btn btn-primary m-1">{$translate("Logout")}</button
>
</div>
</div>
@@ -125,15 +125,15 @@
<div class="flex items-center">
<button class="btn btn-primary" on:click={login}>
<div class="">
<div class="text-m">{$tr("Login to Invidious")}</div>
<div class="text-m">{$translate("Login to Invidious")}</div>
<div class="text-xs font-light">{currentInstance}</div>
</div>
</button>
<button class="btn m-6">{$tr("Close")}</button>
<button class="btn m-6">{$translate("Close")}</button>
</div>
</div>
</form>
<form method="dialog" class="modal-backdrop">
<button>{$tr("Close")}</button>
<button>{$translate("Close")}</button>
</form>
</dialog>
@@ -1,6 +1,6 @@
<script lang="ts">
import VideoListRow from "lib/VideoFeed/VideoListRow.svelte";
import { bookmarksStore, tr } from "lib/Stores";
import { bookmarksStore, translate } from "lib/Stores";
export let visibility: boolean;
</script>
@@ -10,13 +10,15 @@
<div
class="flex flex-col items-center justify-start h-screen w-2/3 mx-auto"
>
<div class="text-2xl font-bold text-gray-500">{$tr("No Bookmarks")}</div>
<div class="text-2xl font-bold text-gray-500">
{$translate("No Bookmarks")}
</div>
<div class="text-gray-500 text-center">
{$tr("You currently have no bookmarks.")}<br />
{$tr(
{$translate("You currently have no bookmarks.")}<br />
{$translate(
"To add bookmarks, select a video, playlist or channel, and add a bookmark."
)}<br />
{$tr("Please note that Bookmarks is an experimental feature.")}
{$translate("Please note that Bookmarks is an experimental feature.")}
</div>
</div>
{:else}
@@ -1,7 +1,7 @@
<script lang="ts">
import { getHost } from "lib/Api/Host";
import { PlayletApi } from "lib/Api/PlayletApi";
import { playletStateStore, tr } from "lib/Stores";
import { playletStateStore, translate } from "lib/Stores";
export let visibility: boolean;
@@ -164,9 +164,9 @@ ${JSON.stringify(profilesInfo, null, 2)}
<div class={visibility ? "" : "hidden"}>
<div class="text-base text-center m-8">
{$tr("Thank you for using Playlet.")}
{$translate("Thank you for using Playlet.")}
<br />
{@html $tr(feedbackMessageRaw)
{@html $translate(feedbackMessageRaw)
.replace(
"%IssueStart%",
`<a class="link" href="${githubUrlIssue}" target="_blank" rel="noopener noreferrer">`
@@ -194,11 +194,9 @@ ${JSON.stringify(profilesInfo, null, 2)}
</tr>
{/each}
<thead>
<tr>
<th>App internal state</th>
</tr>
</thead>
<tr>
<th>App internal state</th>
</tr>
{#each internalStateLinks as item}
<tr>
@@ -1,5 +1,5 @@
<script lang="ts">
import { tr } from "lib/Stores";
import { translate } from "lib/Stores";
let modal;
@@ -11,7 +11,7 @@
modal.close();
}
export let label = $tr("Filters");
export let label = $translate("Filters");
export const filters = {
date: "",
@@ -38,7 +38,7 @@
count += filters.features.length;
count += filters.sort ? 1 : 0;
label = $tr("Filters") + `${count > 0 ? ` (${count})` : ""}`;
label = $translate("Filters") + `${count > 0 ? ` (${count})` : ""}`;
}
const options = {
@@ -181,37 +181,37 @@
<h2 class="text-xl font-bold mb-4">{label}</h2>
<div class="mb-4">
<h3 class="text-lg font-bold mb-2">{$tr("Upload date")}</h3>
<h3 class="text-lg font-bold mb-2">{$translate("Upload date")}</h3>
<select class="input input-bordered w-full" bind:value={filters.date}>
{#each options.date as { title, value }}
<option {value}>{$tr(title)}</option>
<option {value}>{$translate(title)}</option>
{/each}
</select>
</div>
<div class="mb-4">
<h3 class="text-lg font-bold mb-2">{$tr("Type")}</h3>
<h3 class="text-lg font-bold mb-2">{$translate("Type")}</h3>
<select class="input input-bordered w-full" bind:value={filters.type}>
{#each options.type as { title, value }}
<option {value}>{$tr(title)}</option>
<option {value}>{$translate(title)}</option>
{/each}
</select>
</div>
<div class="mb-4">
<h3 class="text-lg font-bold mb-2">{$tr("Duration")}</h3>
<h3 class="text-lg font-bold mb-2">{$translate("Duration")}</h3>
<select
class="input input-bordered w-full"
bind:value={filters.duration}
>
{#each options.duration as { title, value }}
<option {value}>{$tr(title)}</option>
<option {value}>{$translate(title)}</option>
{/each}
</select>
</div>
<div class="mb-4">
<h3 class="text-lg font-bold mb-2">{$tr("Features")}</h3>
<h3 class="text-lg font-bold mb-2">{$translate("Features")}</h3>
{#each options.features as { title, value }}
<label class="flex items-center">
<input
@@ -220,26 +220,26 @@
class="form-checkbox"
bind:checked={features_kv[value]}
/>
<span class="ml-2">{$tr(title)}</span>
<span class="ml-2">{$translate(title)}</span>
</label>
{/each}
</div>
<div class="mb-4">
<h3 class="text-lg font-bold mb-2">{$tr("Sort by")}</h3>
<h3 class="text-lg font-bold mb-2">{$translate("Sort by")}</h3>
<select class="input input-bordered w-full" bind:value={filters.sort}>
{#each options.sort as { title, value }}
<option {value}>{$tr(title)}</option>
<option {value}>{$translate(title)}</option>
{/each}
</select>
</div>
<div class="flex justify-end">
<button class="btn btn-outline">{$tr("Close")}</button>
<button class="btn btn-outline">{$translate("Close")}</button>
</div>
</div>
</form>
<form method="dialog" class="modal-backdrop">
<button>{$tr("Close")}</button>
<button>{$translate("Close")}</button>
</form>
</dialog>
@@ -5,7 +5,7 @@
import { InvidiousApi } from "lib/Api/InvidiousApi";
import { PlayletApi } from "lib/Api/PlayletApi";
import { playletStateStore, searchHistoryStore, tr } from "lib/Stores";
import { playletStateStore, searchHistoryStore, translate } from "lib/Stores";
import VideoCell from "lib/VideoFeed/VideoCell.svelte";
import PlaylistCell from "lib/VideoFeed/PlaylistCell.svelte";
import ChannelCell from "lib/VideoFeed/ChannelCell.svelte";
@@ -133,7 +133,7 @@
<input
type="search"
dir="auto"
placeholder="{$tr('Search')}..."
placeholder="{$translate('Search')}..."
class="join-item input w-full border border-neutral rounded-full"
bind:this={searchBox}
bind:value={searchBoxText}
@@ -213,14 +213,14 @@
await searchVideos(searchContinuation);
}}
>
{$tr("Load more")}
{$translate("Load more")}
</button>
</div>
{/if}
{#if isLoading}
<div class="w-full h-1/2 z-50 flex justify-center items-center">
<span class="loading loading-spinner loading-md" />
<span class="loading loading-spinner loading-md"></span>
</div>
{/if}
</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"];
@@ -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>
@@ -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>
@@ -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>
@@ -8,7 +8,7 @@
import NumberControl from "./SettingControls/NumberControl.svelte";
import ClearCacheControl from "./SettingControls/ClearCacheControl.svelte";
import EditQualityControl from "./SettingControls/EditQualityControl.svelte";
import { tr } from "lib/Stores";
import { translate } from "lib/Stores";
const textSizes = ["text-2xl", "text-lg", "text-base", "text-sm", "text-xs"];
@@ -58,8 +58,8 @@
/>
{:else}
<div class="m-5">
<div class={textSizes[level]}>{$tr(displayText)}</div>
<div class="text-xs text-gray-500">{$tr(description)}</div>
<div class={textSizes[level]}>{$translate(displayText)}</div>
<div class="text-xs text-gray-500">{$translate(description)}</div>
</div>
{/if}
@@ -10,7 +10,7 @@
{#if pref.visibility !== "tv"}
<SettingsNode {...pref} />
{#if i !== $preferencesModelStore.length - 1}
<div class="divider" />
<div class="divider"></div>
{/if}
{/if}
{/each}
+1 -1
View File
@@ -23,4 +23,4 @@ export const bookmarksStore = writable([] as any);
export const searchHistoryStore = writable([] as any);
export const tr = writable((s: string) => s as any);
export const translate = writable((s: string) => s as any);
@@ -1,6 +1,6 @@
<script lang="ts">
import { PlayletApi } from "lib/Api/PlayletApi";
import { playletStateStore, tr } from "lib/Stores";
import { playletStateStore, translate } from "lib/Stores";
import ChannelThumbnail from "./ChannelThumbnail.svelte";
export let author: string | undefined = undefined;
@@ -47,16 +47,18 @@
<div class="flex flex-col">
<div class="join join-vertical m-2">
<button class="btn join-item hover:btn-accent" on:click={openOnTv}>
{$tr("Open on %1").replace("%1", tvName)}
{$translate("Open on %1").replace("%1", tvName)}
</button>
<button class="btn join-item hover:btn-accent" on:click={openInvidious}>
{$tr("Open in Invidious")}
{$translate("Open in Invidious")}
</button>
<button class="btn join-item hover:btn-accent">{$tr("Cancel")}</button>
<button class="btn join-item hover:btn-accent"
>{$translate("Cancel")}</button
>
</div>
</div>
</form>
<form method="dialog" class="modal-backdrop">
<button>{$tr("Close")}</button>
<button>{$translate("Close")}</button>
</form>
</dialog>
@@ -41,7 +41,12 @@
}
</script>
<button class="w-60 p-2" on:click={modal.show()}>
<button
class="w-60 p-2"
on:click={() => {
modal.show();
}}
>
<div class="card card-compact bg-base-100 shadow-xl border border-neutral">
<ChannelThumbnail bind:author bind:authorThumbnails />
<div class="card-body">
@@ -1,6 +1,6 @@
<script lang="ts">
import { PlayletApi } from "lib/Api/PlayletApi";
import { playletStateStore, tr } from "lib/Stores";
import { playletStateStore, translate } from "lib/Stores";
import PlaylistThumbnail from "./PlaylistThumbnail.svelte";
export let title: string | undefined = undefined;
@@ -102,22 +102,24 @@
<div class="flex flex-col">
<div class="join join-vertical m-2">
<button class="btn join-item hover:btn-accent" on:click={playOnTv}>
{$tr("Play on %1").replace("%1", tvName)}
{$translate("Play on %1").replace("%1", tvName)}
</button>
<button class="btn join-item hover:btn-accent" on:click={queueOnTv}>
{$tr("Queue on %1").replace("%1", tvName)}
{$translate("Queue on %1").replace("%1", tvName)}
</button>
<button class="btn join-item hover:btn-accent" on:click={openOnTv}>
{$tr("Open on %1").replace("%1", tvName)}
{$translate("Open on %1").replace("%1", tvName)}
</button>
<button class="btn join-item hover:btn-accent" on:click={openInvidious}>
{$tr("Open in Invidious")}
{$translate("Open in Invidious")}
</button>
<button class="btn join-item hover:btn-accent">{$tr("Cancel")}</button>
<button class="btn join-item hover:btn-accent"
>{$translate("Cancel")}</button
>
</div>
</div>
</form>
<form method="dialog" class="modal-backdrop">
<button>{$tr("Close")}</button>
<button>{$translate("Close")}</button>
</form>
</dialog>
@@ -1,5 +1,5 @@
<script lang="ts">
import { playletStateStore, tr } from "lib/Stores";
import { playletStateStore, translate } from "lib/Stores";
import PlaylistCastDialog from "./PlaylistCastDialog.svelte";
import PlaylistThumbnail from "./PlaylistThumbnail.svelte";
import { get } from "svelte/store";
@@ -33,7 +33,7 @@
return "";
}
const trFn = get(tr);
const trFn = get(translate);
const totalDays = Math.floor(span / 86400);
if (totalDays > 365) {
@@ -79,7 +79,12 @@
}
</script>
<button class="w-80 p-2" on:click={modal.show()}>
<button
class="w-80 p-2"
on:click={() => {
modal.show();
}}
>
<div class="card card-compact bg-base-100 shadow-xl border border-neutral">
<PlaylistThumbnail
bind:title
@@ -1,6 +1,6 @@
<script lang="ts">
import { PlayletApi } from "lib/Api/PlayletApi";
import { playletStateStore, tr } from "lib/Stores";
import { playletStateStore, translate } from "lib/Stores";
import VideoStartAt from "./VideoStartAt.svelte";
import VideoThumbnail from "./VideoThumbnail.svelte";
@@ -116,19 +116,21 @@
/>
<div class="join join-vertical m-2">
<button class="btn join-item hover:btn-accent" on:click={playOnTv}>
{$tr("Play on %1").replace("%1", tvName)}
{$translate("Play on %1").replace("%1", tvName)}
</button>
<button class="btn join-item hover:btn-accent" on:click={queueOnTv}>
{$tr("Queue on %1").replace("%1", tvName)}
{$translate("Queue on %1").replace("%1", tvName)}
</button>
<button class="btn join-item hover:btn-accent" on:click={openInvidious}>
{$tr("Open in Invidious")}
{$translate("Open in Invidious")}
</button>
<button class="btn join-item hover:btn-accent">{$tr("Cancel")}</button>
<button class="btn join-item hover:btn-accent"
>{$translate("Cancel")}</button
>
</div>
</div>
</form>
<form method="dialog" class="modal-backdrop">
<button>{$tr("Close")}</button>
<button>{$translate("Close")}</button>
</form>
</dialog>
+20 -7
View File
@@ -1,5 +1,5 @@
<script lang="ts">
import { playletStateStore, tr } from "lib/Stores";
import { playletStateStore, translate } from "lib/Stores";
import VideoCastDialog from "./VideoCastDialog.svelte";
import VideoThumbnail from "./VideoThumbnail.svelte";
import ChannelCastDialog from "./ChannelCastDialog.svelte";
@@ -74,7 +74,7 @@
return "";
}
const trFn = get(tr);
const trFn = get(translate);
const currentTime = Math.floor(Date.now() / 1000);
let timeLeft = premiereTimestamp - currentTime;
@@ -126,7 +126,7 @@
if (isNaN(published)) {
return "";
}
const trFn = get(tr);
const trFn = get(translate);
const currentTime = Math.floor(Date.now() / 1000);
const span = currentTime - published;
if (span < 1) {
@@ -181,7 +181,12 @@
}
</script>
<button class="w-80 p-2" on:click={videoModal.show()}>
<button
class="w-80 p-2"
on:click={() => {
videoModal.show();
}}
>
<div class="card card-compact bg-base-100 shadow-xl border border-neutral">
<VideoThumbnail
bind:videoId
@@ -197,15 +202,23 @@
/>
<div class="card-body">
<h3 class="card-title text-base line-clamp-2 min-h-12">{title || ""}</h3>
<button
class="font-semibold link"
<span
class="font-semibold link cursor-pointer"
role="button"
tabindex="0"
on:click={(e) => {
e.stopPropagation();
channelModal.show();
}}
on:keydown={(e) => {
if (e.key === "Enter" || e.key === " ") {
e.preventDefault();
channelModal.show();
}
}}
>
{author || ""}
</button>
</span>
<div>{getViewCountDateText()}</div>
</div>
</div>
@@ -1,6 +1,10 @@
<script lang="ts">
import { InvidiousApi } from "lib/Api/InvidiousApi";
import { invidiousVideoApiStore, playletStateStore, tr } from "lib/Stores";
import {
invidiousVideoApiStore,
playletStateStore,
translate,
} from "lib/Stores";
import VideoCell from "./VideoCell.svelte";
import PlaylistCell from "./PlaylistCell.svelte";
import ChannelCell from "./ChannelCell.svelte";
@@ -268,7 +272,7 @@
-->
{#if feedLoadState !== FeedLoadState.Loaded || videos.length !== 0}
<div class="text-lg font-semibold ml-4">
{$tr(feed.title)}
{$translate(feed.title)}
</div>
<div
class="carousel carousel-center rounded-box w-full space-x-4"
@@ -1,5 +1,5 @@
<script lang="ts">
import { tr } from "lib/Stores";
import { translate } from "lib/Stores";
export let checked = false;
export let lengthSeconds = undefined;
@@ -67,7 +67,7 @@
<div class="flex flex-row items-center">
<label class="label justify-start cursor-pointer">
<input type="checkbox" bind:checked class="checkbox" />
<span class="label-text m-2">{$tr("Start at")}</span>
<span class="label-text m-2">{$translate("Start at")}</span>
</label>
<input
bind:this={textInputElemet}
@@ -1,5 +1,5 @@
<script lang="ts">
import { tr } from "lib/Stores";
import { translate } from "lib/Stores";
export let videoId: string | undefined = undefined;
export let title: string | undefined = undefined;
@@ -77,13 +77,13 @@
<div
class="absolute bottom-2 right-0 bg-black/70 text-white text-sm rounded-sm font-bold pt-1 pb-1 pr-2 pl-2"
>
{$tr("UPCOMING")}
{$translate("UPCOMING")}
</div>
{:else if isVideoLive()}
<div
class="absolute bottom-2 right-0 bg-red-500 text-white text-sm rounded-sm font-bold pt-1 pb-1 pr-2 pl-2"
>
{$tr("LIVE")}
{$translate("LIVE")}
</div>
{:else if lengthSeconds || lengthText}
<div
+4 -3
View File
@@ -1,8 +1,9 @@
import './app.css'
import App from './App.svelte'
import { mount } from 'svelte';
const app = new App({
target: document.getElementById('app')
})
const app = mount(App, {
target: document.getElementById('app')!
});
export default app