diff options
Diffstat (limited to 'packages/meshbay-hub/src/meshbay_hub/static/group-page.js')
| -rw-r--r-- | packages/meshbay-hub/src/meshbay_hub/static/group-page.js | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/group-page.js b/packages/meshbay-hub/src/meshbay_hub/static/group-page.js index 0a43724..6f41426 100644 --- a/packages/meshbay-hub/src/meshbay_hub/static/group-page.js +++ b/packages/meshbay-hub/src/meshbay_hub/static/group-page.js @@ -9,7 +9,7 @@ import { HUB, session, cacheGroupIndex, hubFetch, ensureFreshToken, _loadBundleKey, _loadRecoveryKey, _storeBundleKey, } from './hub-client.js'; -import { visibleApps } from './apps.js'; +import { APPS, visibleApps } from './apps.js'; import { GroupName } from './group-name.js'; import { FilePreview } from './files-app.js'; import { VideoPlayer } from './video-player.js'; @@ -654,10 +654,19 @@ function GroupPage({ groupId, group, token, username, userId, userPrefs, // `group-settings.js` untouched — that page renders the panes without // knowing what any of them is for, which is what makes adding an app a // registry entry rather than an edit to the page. + // `<key>Directories` for every registered app, derived from the registry + // rather than written out. Naming them here would mean adding an app + // required editing this file, which is the one thing the plugin + // architecture is supposed to have removed — and the reference app + // (docs/refactor-groups.md §4.1) is what made the difference visible. + const perAppDirectories = useMemo(() => { + const out = {}; + for (const app of APPS) out[`${app.key}Directories`] = appDirs(app.key); + return out; + }, [appDirs]); + const appSettings = useMemo(() => ({ - videoDirectories: appDirs('video'), - musicDirectories: appDirs('music'), - photoDirectories: appDirs('photo'), + ...perAppDirectories, chatDirectory, chatLinkPreview, tmdbEnabled: tmdbConfig ? tmdbConfig.enabled !== false : true, @@ -665,7 +674,8 @@ function GroupPage({ groupId, group, token, username, userId, userPrefs, tmdbTokenCustomized: Boolean(tmdbConfig && tmdbConfig.tokenCustomized), musicbrainzEnabled: musicbrainzConfig ? musicbrainzConfig.enabled !== false : true, - }), [appDirs, chatDirectory, chatLinkPreview, tmdbConfig, musicbrainzConfig]); + }), [perAppDirectories, chatDirectory, chatLinkPreview, tmdbConfig, + musicbrainzConfig]); const commonProps = { groupId, transportRef, gekRef, status, username, @@ -676,9 +686,7 @@ function GroupPage({ groupId, group, token, username, userId, userPrefs, // Plural everywhere: Videos and Music read a list now, and Photos always // did. The scalar `videoRoot`/`audioRoot` shapes survive only on the wire, // for a node that speaks MNP 1.0 — nothing in the client carries them. - videoDirectories: appDirs('video'), - musicDirectories: appDirs('music'), - photoDirectories: appDirs('photo'), + ...perAppDirectories, tmdbConfig, musicbrainzConfig, onPlayQueue, }; |