Nothing it carried is gone -- the two commits before this put all of it somewhere the work is already being done. A retired destination is the one shape #25's storage decision does not make free. A visibility entry is a map key and an unknown key is dropped on load; a launch page is a *value*, and an unknown one fails validation -- which on the load path means the app refuses to start for whoever had Jobs selected. `RetiredViews` is that list, read by `ApplyDefaults`, which treats a retired name as a zero value. An unknown-but-not-retired name still errors, because that is a typo and saying so is the useful answer.
65 lines
2.3 KiB
TypeScript
65 lines
2.3 KiB
TypeScript
import {
|
|
ICON_PLAYLIST,
|
|
ICON_AUTOTAG,
|
|
ICON_REQUESTED,
|
|
} from '@utils/icon-language';
|
|
|
|
/** A primary destination. Mirrors `backend/config.View`. */
|
|
export type View =
|
|
| 'home'
|
|
| 'playlists'
|
|
| 'artists'
|
|
| 'genres'
|
|
| 'albums'
|
|
| 'tracks'
|
|
| 'explore'
|
|
| 'downloads'
|
|
| 'autotag'
|
|
| 'settings';
|
|
|
|
export interface ViewMeta {
|
|
id: View;
|
|
label: string;
|
|
icon: string;
|
|
/**
|
|
* Views that are never offered as a toggle. Settings alone, because
|
|
* a user who hides it cannot get back to unhide it.
|
|
*
|
|
* This is the *affordance*; the rule is `backend/config.ViewSpec`'s
|
|
* `Hideable`, which refuses at the setter and drops the key on load.
|
|
* `config.toml` is hand-editable, so the checkbox being absent is
|
|
* not what makes this safe — it is only what stops the question
|
|
* being asked.
|
|
*/
|
|
alwaysShown?: boolean;
|
|
}
|
|
|
|
/**
|
|
* The app's primary destinations, in the order the navigation draws
|
|
* them and Settings lists them.
|
|
*
|
|
* It is here rather than inside `app-sidebar` because #25 gave it a
|
|
* second reader: Settings renders a toggle per view and needs the same
|
|
* labels in the same order. Same shape as `services/shortcut-meta.ts`,
|
|
* which moved out of `config-page` for the same reason -- a private
|
|
* static that two surfaces need is a private static that is about to be
|
|
* copied.
|
|
*
|
|
* The labels and icons deliberately do not exist in Go. Which views
|
|
* exist and what an unconfigured install shows is `backend/config.Views`
|
|
* and is asked for over the binding; how they are *drawn* is the
|
|
* frontend's, and lives beside the rest of the icon vocabulary.
|
|
*/
|
|
export const VIEW_META: ViewMeta[] = [
|
|
{ id: 'home', label: 'Home', icon: 'house' },
|
|
{ id: 'playlists', label: 'Playlists', icon: ICON_PLAYLIST },
|
|
{ id: 'artists', label: 'Artists', icon: 'user-group' },
|
|
{ id: 'genres', label: 'Genres', icon: 'masks-theater' },
|
|
{ id: 'albums', label: 'Albums', icon: 'compact-disc' },
|
|
{ id: 'tracks', label: 'Tracks', icon: 'music' },
|
|
{ id: 'explore', label: 'Explore', icon: 'globe' },
|
|
{ id: 'downloads', label: 'Downloads', icon: ICON_REQUESTED },
|
|
{ id: 'autotag', label: 'Autotag', icon: ICON_AUTOTAG },
|
|
{ id: 'settings', label: 'Settings', icon: 'gear', alwaysShown: true },
|
|
];
|