diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index 5e23ccc0..40c3bc6d 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -27,7 +27,7 @@ A lot of components will have a worker (located in `worker.js` besides the `elem ## Other directories -- `src/common`: Common Javascript code shared by various components and/or themes. -- `src/styles`: Common CSS shared by themes, the index page or facets. -- `src/favicons`, `src/fonts`, `src/images` are binary assets for themes and the index page (`src/index.vto`) +- `src/common`: Common Javascript code shared by various components and/or pages. +- `src/styles`: Common CSS shared by pages or facets. +- `src/favicons`, `src/fonts`, `src/images` are binary assets for facets and pages. - `src/_components` and `src/_includes` are templates used in `.vto` templates. diff --git a/src/build.vto b/src/build.vto index 5f6bf1a4..394749a2 100644 --- a/src/build.vto +++ b/src/build.vto @@ -107,7 +107,6 @@ examples:

diff --git a/src/components/configurator/output/element.js b/src/components/configurator/output/element.js index dff1fd73..72c30e42 100644 --- a/src/components/configurator/output/element.js +++ b/src/components/configurator/output/element.js @@ -3,7 +3,7 @@ import { batch, computed, signal } from "~/common/signal.js"; /** * @import {DiffuseElement} from "~/common/element.js" - * @import {Facet, PlaylistItem, Theme, Track} from "~/definitions/types.d.ts" + * @import {Facet, PlaylistItem, Track} from "~/definitions/types.d.ts" * @import {OutputManagerDeputy, OutputElement} from "~/components/output/types.d.ts" * * @import {OutputConfiguratorElement} from "./types.d.ts" @@ -94,38 +94,6 @@ class OutputConfigurator extends BroadcastableDiffuseElement { this.#memory.playlistItems.value = newPlaylistItems; }, }, - themes: { - collection: computed(() => { - const out = this.#selected.value; - if (out) return out.themes.collection(); - - const def = this.#defaultOutput.value; - if (def) return def.themes.collection(); - if (this.hasDefault()) return { state: "loading" }; - - return this.#setupFinished.value - ? { state: "loaded", data: this.#memory.themes.value } - : { state: "loading" }; - }), - reload: () => { - const def = this.#defaultOutput.value; - if (def) def.themes.reload(); - - const out = this.#selected.value; - if (out) return out.themes.reload(); - - return Promise.resolve(); - }, - save: async (newThemes) => { - const out = this.#selected.value; - if (out) return await out.themes.save(newThemes); - - const def = this.#defaultOutput.value; - if (def) return await def.themes.save(newThemes); - - this.#memory.themes.value = newThemes; - }, - }, tracks: { collection: computed(() => { const out = this.#selected.value; @@ -174,7 +142,6 @@ class OutputConfigurator extends BroadcastableDiffuseElement { // Assign manager properties to class this.facets = manager.facets; this.playlistItems = manager.playlistItems; - this.themes = manager.themes; this.tracks = manager.tracks; this.ready = manager.ready; @@ -208,18 +175,6 @@ class OutputConfigurator extends BroadcastableDiffuseElement { else this.#memory.playlistItems.set(col.data); }); - this.effect(() => { - const out = this.#selected.value; - if (!out) return; - - const col = out.themes.collection(); - if (col.state !== "loaded") return; - - const def = this.#defaultOutput.value; - if (def) def.themes.save(col.data); - else this.#memory.themes.set(col.data); - }); - this.effect(() => { const out = this.#selected.value; if (!out) return; @@ -244,7 +199,6 @@ class OutputConfigurator extends BroadcastableDiffuseElement { #memory = { facets: signal(/** @type {Facet[]} */ ([])), playlistItems: signal(/** @type {PlaylistItem[]} */ ([])), - themes: signal(/** @type {Theme[]} */ ([])), tracks: signal(/** @type {Track[]} */ ([])), }; diff --git a/src/components/orchestrator/output/element.js b/src/components/orchestrator/output/element.js index 266842c9..8be921b2 100644 --- a/src/components/orchestrator/output/element.js +++ b/src/components/orchestrator/output/element.js @@ -65,10 +65,6 @@ class OutputOrchestrator extends DiffuseElement { return this.output.playlistItems; } - get themes() { - return this.output.themes; - } - get tracks() { return this.output.tracks; } diff --git a/src/components/orchestrator/path-collections/element.js b/src/components/orchestrator/path-collections/element.js index a00696b0..6c19b95e 100644 --- a/src/components/orchestrator/path-collections/element.js +++ b/src/components/orchestrator/path-collections/element.js @@ -37,7 +37,6 @@ class PathCollectionsOrchestrator extends OutputTransformer { ); }, }; - this.themes = base.themes; this.tracks = base.tracks; this.ready = base.ready; diff --git a/src/components/output/bytes/s3/element.js b/src/components/output/bytes/s3/element.js index 2b4d64b6..4d57630c 100644 --- a/src/components/output/bytes/s3/element.js +++ b/src/components/output/bytes/s3/element.js @@ -45,11 +45,6 @@ class S3Output extends BroadcastedOutputElement { get: () => this.#get("playlistItems"), put: (data) => this.#put("playlistItems", data), }, - themes: { - empty: () => undefined, - get: () => this.#get("themes"), - put: (data) => this.#put("themes", data), - }, tracks: { empty: () => undefined, get: () => this.#get("tracks"), @@ -59,7 +54,6 @@ class S3Output extends BroadcastedOutputElement { this.facets = this.#manager.facets; this.playlistItems = this.#manager.playlistItems; - this.themes = this.#manager.themes; this.tracks = this.#manager.tracks; } diff --git a/src/components/output/common.js b/src/components/output/common.js index f6be88e4..59f2c7cf 100644 --- a/src/components/output/common.js +++ b/src/components/output/common.js @@ -3,7 +3,7 @@ import { batch, computed, signal, untracked } from "~/common/signal.js"; import { strictEquality } from "~/common/compare.js"; /** - * @import {Facet, PlaylistItem, Theme, Track} from "~/definitions/types.d.ts" + * @import {Facet, PlaylistItem, Track} from "~/definitions/types.d.ts" * @import {SignalWriter} from "~/common/signal.d.ts"; * @import {OutputManager, OutputManagerProperties} from "./types.d.ts" */ @@ -33,7 +33,6 @@ export class BroadcastedOutputElement extends BroadcastableDiffuseElement { const ogFacetsSave = manager.facets.save.bind(this); const ogPlaylistItemsSave = manager.playlistItems.save.bind(this); - const ogThemesSave = manager.themes.save.bind(this); const ogTracksSave = manager.tracks.save.bind(this); const actions = this.broadcast(this.identifier, { @@ -48,10 +47,6 @@ export class BroadcastedOutputElement extends BroadcastableDiffuseElement { set: manager.signals.playlistItems.set, }), }, - saveThemes: { - strategy: "replicate", - fn: fn({ save: ogThemesSave, set: manager.signals.themes.set }), - }, saveTracks: { strategy: "replicate", fn: fn({ save: ogTracksSave, set: manager.signals.tracks.set }), @@ -61,7 +56,6 @@ export class BroadcastedOutputElement extends BroadcastableDiffuseElement { if (actions) { manager.facets.save = actions.saveFacets; manager.playlistItems.save = actions.savePlaylistItems; - manager.themes.save = actions.saveThemes; manager.tracks.save = actions.saveTracks; } } @@ -73,7 +67,7 @@ export class BroadcastedOutputElement extends BroadcastableDiffuseElement { * @returns {OutputManager} */ export function outputManager( - { init, facets, playlistItems, themes, tracks }, + { init, facets, playlistItems, tracks }, ) { const c = signal( /** @type {Encoding extends null ? Facet[] : Encoding} */ (facets @@ -93,14 +87,6 @@ export function outputManager( { compare: strictEquality }, ); - const th = signal( - /** @type {Encoding extends null ? Theme[] : Encoding} */ (themes.empty()), - ); - const ths = signal( - /** @type {"loading" | "loaded" | "sleeping"} */ ("sleeping"), - { compare: strictEquality }, - ); - const t = signal( /** @type {Encoding extends null ? Track[] : Encoding} */ (tracks.empty()), ); @@ -123,13 +109,6 @@ export function outputManager( pls.value = "loaded"; } - async function loadThemes() { - if (init && (await init()) === false) return; - ths.value = "loading"; - th.value = await themes.get(); - ths.value = "loaded"; - } - async function loadTracks() { if (init && (await init()) === false) return; ts.value = "loading"; @@ -170,22 +149,6 @@ export function outputManager( await playlistItems.put(newPlaylistItems); }, }, - themes: { - collection: computed(() => { - if (untracked(() => ths.value === "sleeping")) loadThemes(); - return ths.value === "loaded" - ? { state: "loaded", data: th.value } - : { state: "loading" }; - }), - reload: loadThemes, - save: async (newThemes) => { - batch(() => { - if (untracked(() => ths.value === "sleeping")) ths.value = "loaded"; - th.value = newThemes; - }); - await themes.put(newThemes); - }, - }, tracks: { collection: computed(() => { if (untracked(() => ts.value === "sleeping")) loadTracks(); @@ -205,7 +168,6 @@ export function outputManager( signals: { facets: c, playlistItems: pl, - themes: th, tracks: t, }, }; diff --git a/src/components/output/polymorphic/indexed-db/element.js b/src/components/output/polymorphic/indexed-db/element.js index c22d11a4..745f091d 100644 --- a/src/components/output/polymorphic/indexed-db/element.js +++ b/src/components/output/polymorphic/indexed-db/element.js @@ -37,11 +37,6 @@ class IndexedDBOutput extends BroadcastedOutputElement { get: () => this.#get("playlistItems"), put: (data) => this.#put("playlistItems", data), }, - themes: { - empty: () => undefined, - get: () => this.#get("themes"), - put: (data) => this.#put("themes", data), - }, tracks: { empty: () => undefined, get: () => this.#get("tracks"), @@ -51,7 +46,6 @@ class IndexedDBOutput extends BroadcastedOutputElement { this.facets = this.#manager.facets; this.playlistItems = this.#manager.playlistItems; - this.themes = this.#manager.themes; this.tracks = this.#manager.tracks; this.ready = () => true; diff --git a/src/components/output/raw/atproto/element.js b/src/components/output/raw/atproto/element.js index 21156787..b9c7c0ad 100644 --- a/src/components/output/raw/atproto/element.js +++ b/src/components/output/raw/atproto/element.js @@ -33,7 +33,6 @@ import { const WATCHED_COLLECTIONS = new Set([ "sh.diffuse.output.facet", "sh.diffuse.output.playlistItem", - "sh.diffuse.output.theme", "sh.diffuse.output.trackBundle", ]); @@ -76,11 +75,6 @@ class ATProtoOutput extends BroadcastedOutputElement { get: () => this.listRecords("sh.diffuse.output.playlistItem"), put: (data) => this.#putRecords("sh.diffuse.output.playlistItem", data), }, - themes: { - empty: () => [], - get: () => this.listRecords("sh.diffuse.output.theme"), - put: (data) => this.#putRecords("sh.diffuse.output.theme", data), - }, tracks: { empty: () => [], get: async () => { @@ -119,7 +113,6 @@ class ATProtoOutput extends BroadcastedOutputElement { this.facets = this.#manager.facets; this.playlistItems = this.#manager.playlistItems; - this.themes = this.#manager.themes; this.tracks = this.#manager.tracks; } @@ -330,7 +323,6 @@ class ATProtoOutput extends BroadcastedOutputElement { if (touched.has("sh.diffuse.output.playlistItem")) { this.#manager.playlistItems.reload(); } - if (touched.has("sh.diffuse.output.theme")) this.#manager.themes.reload(); if (touched.has("sh.diffuse.output.trackBundle")) { this.#manager.tracks.reload(); } diff --git a/src/components/output/types.d.ts b/src/components/output/types.d.ts index 5e0dc44f..9a7433df 100644 --- a/src/components/output/types.d.ts +++ b/src/components/output/types.d.ts @@ -3,7 +3,6 @@ import type { DiffuseElement } from "~/common/element.js"; import type { Facet, PlaylistItem, - Theme, Track, } from "~/definitions/types.d.ts"; @@ -39,19 +38,8 @@ export type OutputManager = { signals: { facets: Signal; playlistItems: Signal; - themes: Signal; tracks: Signal; }; - themes: { - collection: SignalReader< - | { state: "loading" } - | { state: "loaded"; data: Encoding extends null ? Theme[] : Encoding } - >; - reload: () => Promise; - save: ( - themes: Encoding extends null ? Theme[] : Encoding, - ) => Promise; - }; tracks: { collection: SignalReader< | { state: "loading" } @@ -78,13 +66,6 @@ export type OutputManagerProperties = { playlistItems: Encoding extends null ? PlaylistItem[] : Encoding, ): Promise; }; - themes: { - empty(): Encoding extends null ? Theme[] : Encoding; - get(): Promise; - put( - themes: Encoding extends null ? Theme[] : Encoding, - ): Promise; - }; tracks: { empty(): Encoding extends null ? Track[] : Encoding; get(): Promise; diff --git a/src/components/transformer/output/base.js b/src/components/transformer/output/base.js index 54a6b612..dd82d492 100644 --- a/src/components/transformer/output/base.js +++ b/src/components/transformer/output/base.js @@ -70,20 +70,6 @@ export class OutputTransformer extends BroadcastableDiffuseElement { await this.output.signal()?.playlistItems.save(newPlaylistItems); }, }, - themes: { - collection: computed(() => { - return this.output.signal()?.themes?.collection() ?? - { state: "loading" }; - }), - reload: () => { - return this.output.signal()?.themes?.reload() ?? - Promise.resolve(); - }, - save: async (newThemes) => { - await this.output.whenDefined; - await this.output.signal()?.themes.save(newThemes); - }, - }, tracks: { collection: computed(() => { return this.output.signal()?.tracks?.collection() ?? diff --git a/src/components/transformer/output/bytes/automerge/constants.js b/src/components/transformer/output/bytes/automerge/constants.js index e68474e2..ab27af9f 100644 --- a/src/components/transformer/output/bytes/automerge/constants.js +++ b/src/components/transformer/output/bytes/automerge/constants.js @@ -2,7 +2,7 @@ import * as Automerge from "@automerge/automerge"; import { base64 } from "iso-base/rfc4648"; /** - * @import { FacetsDocument, PlaylistItemsDocument, ThemesDocument, TracksDocument } from "./types.d.ts"; + * @import { FacetsDocument, PlaylistItemsDocument, TracksDocument } from "./types.d.ts"; */ /** @type {Automerge.Doc} */ @@ -19,13 +19,6 @@ export const INITIAL_PLAYLIST_ITEMS_DOCUMENT = Automerge.load( ), ); -/** @type {Automerge.Doc} */ -export const INITIAL_THEMES_DOCUMENT = Automerge.load( - base64.decode( - "hW9Kgw5i4LcAeAEQzljXzJAwgqwMkIT3CseCywF4jHbKg9Q2XqVU26bSDj0GtjkQq1HyriZedXU+vUt5wAYBAgMCEwIjBkACVgIHFQwhAiMCNAFCAlYCgAECfwB/AX8Bf8iTqcwGfwB/B38KY29sbGVjdGlvbn8AfwEBfwJ/AH8AAA", - ), -); - /** @type {Automerge.Doc} */ export const INITIAL_TRACKS_DOCUMENT = Automerge.load( base64.decode( diff --git a/src/components/transformer/output/bytes/automerge/element.js b/src/components/transformer/output/bytes/automerge/element.js index 78e30363..0e57458b 100644 --- a/src/components/transformer/output/bytes/automerge/element.js +++ b/src/components/transformer/output/bytes/automerge/element.js @@ -13,7 +13,6 @@ import { OutputTransformer } from "../../base.js"; import { INITIAL_FACETS_DOCUMENT, INITIAL_PLAYLIST_ITEMS_DOCUMENT, - INITIAL_THEMES_DOCUMENT, INITIAL_TRACKS_DOCUMENT, } from "./constants.js"; @@ -104,12 +103,6 @@ class AutomergeBytesOutputTransformer extends OutputTransformer { INITIAL_PLAYLIST_ITEMS_DOCUMENT, ); - const themes = state( - computed(() => local()?.themes?.collection() ?? { state: "loading" }), - remote.themes.collection, - INITIAL_THEMES_DOCUMENT, - ); - const tracks = state( computed(() => local()?.tracks?.collection() ?? { state: "loading" }), remote.tracks.collection, @@ -131,15 +124,6 @@ class AutomergeBytesOutputTransformer extends OutputTransformer { computed(() => playlistItems().doc), ); - this.themes = automergeEntry( - computed(() => local()?.themes), - remote.themes, - computed(() => themes().doc), - { - stripUndefined: true, - }, - ); - this.tracks = automergeEntry( computed(() => local()?.tracks), remote.tracks, @@ -173,16 +157,6 @@ class AutomergeBytesOutputTransformer extends OutputTransformer { } }); - this.effect(() => { - if (!themes().remoteLoaded) return; - const s = themes(); - if (s.diverged) { - const bytes = Automerge.save(s.doc); - if (l && s.local) l.themes.save(bytes); - if (s.remote) remote.themes.save(bytes); - } - }); - this.effect(() => { if (!tracks().remoteLoaded) return; const s = tracks(); diff --git a/src/components/transformer/output/bytes/automerge/types.d.ts b/src/components/transformer/output/bytes/automerge/types.d.ts index 9e1e929e..d1aa3e83 100644 --- a/src/components/transformer/output/bytes/automerge/types.d.ts +++ b/src/components/transformer/output/bytes/automerge/types.d.ts @@ -1,11 +1,9 @@ import type { Facet, PlaylistItem, - Theme, Track, } from "~/definitions/types.d.ts"; export type FacetsDocument = { collection: Facet[] }; export type PlaylistItemsDocument = { collection: PlaylistItem[] }; -export type ThemesDocument = { collection: Theme[] }; export type TracksDocument = { collection: Track[] }; diff --git a/src/components/transformer/output/bytes/dasl-sync/element.js b/src/components/transformer/output/bytes/dasl-sync/element.js index 919b7257..df4e605c 100644 --- a/src/components/transformer/output/bytes/dasl-sync/element.js +++ b/src/components/transformer/output/bytes/dasl-sync/element.js @@ -158,16 +158,6 @@ class DaslBytesSyncOutputTransformer extends OutputTransformer { }, ); - const themes = state( - "themes", - computed(() => local()?.themes.collection() ?? { state: "loading" }), - remote.themes.collection, - { - saveLocal: async (v) => local()?.themes.save(v), - saveRemote: remote.themes.save, - }, - ); - const tracks = state( "tracks", computed(() => local()?.tracks.collection() ?? { state: "loading" }), @@ -191,12 +181,6 @@ class DaslBytesSyncOutputTransformer extends OutputTransformer { playlistItems, ); - this.themes = this.managerProp( - { save: async (v) => local()?.themes.save(v) }, - remote.themes, - themes, - ); - this.tracks = this.managerProp( { save: async (v) => local()?.tracks.save(v) }, remote.tracks, diff --git a/src/components/transformer/output/bytes/json/element.js b/src/components/transformer/output/bytes/json/element.js index 3404ff6a..506ebb63 100644 --- a/src/components/transformer/output/bytes/json/element.js +++ b/src/components/transformer/output/bytes/json/element.js @@ -3,7 +3,7 @@ import { OutputTransformer } from "../../base.js"; /** * @import { OutputManagerDeputy } from "~/components/output/types.d.ts" - * @import { Facet, PlaylistItem, Theme, Track } from "~/definitions/types.d.ts" + * @import { Facet, PlaylistItem, Track } from "~/definitions/types.d.ts" */ /** @@ -49,22 +49,6 @@ class JsonStringOutputTransformer extends OutputTransformer { await base.playlistItems.save(bytes); }, }, - themes: { - ...base.themes, - collection: computed(() => { - const col = base.themes.collection(); - if (col.state !== "loaded") return col; - /** @type {Theme[]} */ - const data = parseArray(col.data); - return { state: "loaded", data }; - }), - save: async (newThemes) => { - const json = JSON.stringify(newThemes); - const encoder = new TextEncoder(); - const bytes = encoder.encode(json); - await base.themes.save(bytes); - }, - }, tracks: { ...base.tracks, collection: computed(() => { @@ -89,7 +73,6 @@ class JsonStringOutputTransformer extends OutputTransformer { // Assign manager properties to class this.facets = manager.facets; this.playlistItems = manager.playlistItems; - this.themes = manager.themes; this.tracks = manager.tracks; this.ready = manager.ready; } diff --git a/src/components/transformer/output/raw/atproto-sync/element.js b/src/components/transformer/output/raw/atproto-sync/element.js index ea6ff12f..6c6c7383 100644 --- a/src/components/transformer/output/raw/atproto-sync/element.js +++ b/src/components/transformer/output/raw/atproto-sync/element.js @@ -15,7 +15,6 @@ import * as Output from "~/common/output.js"; const COLLECTIONS = /** @type {const} */ ([ "facets", "playlistItems", - "themes", "tracks", ]); diff --git a/src/components/transformer/output/refiner/default/element.js b/src/components/transformer/output/refiner/default/element.js index 0071e995..eafa489f 100644 --- a/src/components/transformer/output/refiner/default/element.js +++ b/src/components/transformer/output/refiner/default/element.js @@ -74,14 +74,6 @@ class DefaultOutputRefinerTransformer extends OutputTransformer { await base.playlistItems.save(filtered); }, }, - themes: { - ...base.themes, - collection: computed(() => { - const col = base.themes.collection(); - if (col.state !== "loaded") return col; - return { state: "loaded", data: col.data }; - }), - }, tracks: { ...base.tracks, collection: computed(() => { @@ -119,7 +111,6 @@ class DefaultOutputRefinerTransformer extends OutputTransformer { // Assign manager properties to class this.facets = manager.facets; this.playlistItems = manager.playlistItems; - this.themes = manager.themes; this.tracks = manager.tracks; this.ready = manager.ready; } diff --git a/src/components/transformer/output/refiner/initial-contents/element.js b/src/components/transformer/output/refiner/initial-contents/element.js index 62c69ddd..71f64cd5 100644 --- a/src/components/transformer/output/refiner/initial-contents/element.js +++ b/src/components/transformer/output/refiner/initial-contents/element.js @@ -81,14 +81,12 @@ class InitialContentsTransformer extends OutputTransformer { }, playlistItems: base.playlistItems, - themes: base.themes, tracks: base.tracks, ready: base.ready, }; this.facets = manager.facets; this.playlistItems = manager.playlistItems; - this.themes = manager.themes; this.tracks = manager.tracks; this.ready = manager.ready; } diff --git a/src/components/transformer/output/refiner/track-uri-passkey/element.js b/src/components/transformer/output/refiner/track-uri-passkey/element.js index 7ad90f40..f19ebea0 100644 --- a/src/components/transformer/output/refiner/track-uri-passkey/element.js +++ b/src/components/transformer/output/refiner/track-uri-passkey/element.js @@ -45,7 +45,6 @@ class TrackUriPasskeyTransformer extends OutputTransformer { this.facets = base.facets; this.playlistItems = base.playlistItems; - this.themes = base.themes; this.ready = this.#keyReady.get; // Tracks diff --git a/src/components/transformer/output/string/json/element.js b/src/components/transformer/output/string/json/element.js index 265778c8..d1b5b317 100644 --- a/src/components/transformer/output/string/json/element.js +++ b/src/components/transformer/output/string/json/element.js @@ -46,21 +46,6 @@ class JsonStringOutputTransformer extends OutputTransformer { await base.playlistItems.save(json); }, }, - themes: { - ...base.themes, - collection: computed(() => { - const col = base.themes.collection(); - if (col.state !== "loaded") return col; - return { - state: "loaded", - data: typeof col.data === "string" ? parseArray(col.data) : [], - }; - }), - save: async (newThemes) => { - const json = JSON.stringify(newThemes); - await base.themes.save(json); - }, - }, tracks: { ...base.tracks, collection: computed(() => { @@ -84,7 +69,6 @@ class JsonStringOutputTransformer extends OutputTransformer { // Assign manager properties to class this.facets = manager.facets; this.playlistItems = manager.playlistItems; - this.themes = manager.themes; this.tracks = manager.tracks; this.ready = manager.ready; } diff --git a/src/elements.vto b/src/elements.vto index 61ff88f5..942022db 100644 --- a/src/elements.vto +++ b/src/elements.vto @@ -266,7 +266,7 @@ definitions: title: "Orchestrators", items: orchestrators, content: ` - These too are element compositions. However, unlike themes, these are purely logical. Mostly exist in order to construct sensible defaults to use across themes and other compositions. + These are element compositions, logic only. Mostly exist in order to construct sensible defaults. ` }) }} diff --git a/src/facets/data/export-import/index.html b/src/facets/data/export-import/index.html index 145525b3..ffee0529 100644 --- a/src/facets/data/export-import/index.html +++ b/src/facets/data/export-import/index.html @@ -33,11 +33,6 @@ Import facets -
- -
diff --git a/src/facets/data/export-import/index.inline.js b/src/facets/data/export-import/index.inline.js index b7e506a7..cb8f1bda 100644 --- a/src/facets/data/export-import/index.inline.js +++ b/src/facets/data/export-import/index.inline.js @@ -18,8 +18,6 @@ const importPlaylistItemsBtn = )); const importFacetsBtn = /** @type {HTMLButtonElement} */ (document.querySelector("#import-facets")); -const importThemesBtn = - /** @type {HTMLButtonElement} */ (document.querySelector("#import-themes")); const statusEl = /** @type {HTMLElement} */ (document.querySelector("#status")); /** @type {Record | null} */ @@ -45,14 +43,12 @@ effect(() => { exportBtn.onclick = async () => { const facets = await Output.data(output.facets); const playlistItems = await Output.data(output.playlistItems); - const themes = await Output.data(output.themes); const tracks = await Output.data(output.tracks); const data = { exportedAt: new Date().toISOString(), facets, playlistItems, - themes, tracks, }; @@ -80,7 +76,6 @@ fileInput.onchange = async () => { importTracksBtn.disabled = true; importPlaylistItemsBtn.disabled = true; importFacetsBtn.disabled = true; - importThemesBtn.disabled = true; if (!file) return; @@ -106,10 +101,6 @@ fileInput.onchange = async () => { if (Array.isArray(json?.facets) && json.facets.length > 0) { importFacetsBtn.disabled = false; } - - if (Array.isArray(json?.themes) && json.themes.length > 0) { - importThemesBtn.disabled = false; - } }; // Import tracks @@ -158,17 +149,3 @@ importFacetsBtn.onclick = async () => { } }; -// Import themes -importThemesBtn.onclick = async () => { - /** @type {any[]} */ - const themes = json?.themes; - if (!Array.isArray(themes) || themes.length === 0) return; - - try { - await output.themes.save(themes); - showStatus(`Imported ${themes.length} theme(s).`, "success"); - } catch (err) { - console.error("Import failed:", err); - showStatus(`Import failed: ${/** @type {Error} */ (err).message}`, "error"); - } -};