A music player that connects to your cloud/distributed storage.
5
fork

Configure Feed

Select the types of activity you want to include in your feed.

chore: sort by created at in descending order by default

+9 -7
+9 -7
src/components/engine/scope/element.js
··· 13 13 #groupBy = signal(/** @type {string | undefined} */ (undefined)); 14 14 #playlist = signal(/** @type {string | undefined} */ (undefined)); 15 15 #searchTerm = signal(/** @type {string | undefined} */ (undefined)); 16 - #sortBy = signal(/** @type {string[]} */ ([])); 17 - #sortDirection = signal(/** @type {string | undefined} */ (undefined)); 16 + #sortBy = signal(/** @type {string[]} */ (["createdAt"])); 17 + #sortDirection = signal(/** @type {"asc" | "desc" | undefined} */ ("desc")); 18 18 19 19 groupBy = this.#groupBy.get; 20 20 playlist = this.#playlist.get; ··· 54 54 const storagePrefix = 55 55 `${this.constructor.prototype.constructor.NAME}/${this.group}`; 56 56 57 - this.#groupBy.value = 58 - localStorage.getItem(`${storagePrefix}/groupBy`) ?? undefined; 57 + this.#groupBy.value = localStorage.getItem(`${storagePrefix}/groupBy`) ?? 58 + undefined; 59 59 this.#playlist.value = 60 60 localStorage.getItem(`${storagePrefix}/playlistId`) ?? undefined; 61 61 this.#searchTerm.value = 62 62 localStorage.getItem(`${storagePrefix}/searchTerm`) ?? undefined; 63 63 this.#sortBy.value = JSON.parse( 64 - localStorage.getItem(`${storagePrefix}/sortBy`) ?? "[]", 64 + localStorage.getItem(`${storagePrefix}/sortBy`) ?? `["createdAt"]`, 65 65 ); 66 66 this.#sortDirection.value = 67 - localStorage.getItem(`${storagePrefix}/sortDirection`) ?? undefined; 67 + /** @type {"desc" | "asc"} */ (localStorage.getItem( 68 + `${storagePrefix}/sortDirection`, 69 + ) ?? "desc"); 68 70 69 71 // Effects 70 72 this.effect(() => { ··· 122 124 /** @param {string[]} val */ 123 125 setSortBy = async (val) => this.#sortBy.value = val; 124 126 125 - /** @param {string | undefined} val */ 127 + /** @param {"asc" | "desc" | undefined} val */ 126 128 setSortDirection = async (val) => this.#sortDirection.value = val; 127 129 } 128 130