e6ac6cd061
Each widget now has an independent enable/disable checkbox that gates its visibility in the sidebar (new global_settings.widgets columns + GET /api/widgets), and is collapsed by default behind a WidgetSection wrapper so the tab stays manageable as more widgets get added. The four existing tab components (WeatherTab/StocksTab/BookmarksTab/Poe2Tab) are reused unmodified as each section's expanded content.
34 lines
1.2 KiB
TypeScript
34 lines
1.2 KiB
TypeScript
import type { LayoutLoad } from './$types';
|
|
import { getCategories, getEvents, getWeather, getStocks, getBookmarks, getPoe2, getWidgetsEnabled } from '$lib/api';
|
|
import { getPrivateAccessStatus } from '$lib/privateAccess';
|
|
|
|
// Named so the layout can be re-fetched on its own (see +layout.svelte's periodic
|
|
// invalidate('app:sidebar')) without disturbing page-level loads — e.g. the home feed's
|
|
// own pagination state, which a blanket invalidateAll() would reset every refresh.
|
|
export const load: LayoutLoad = async ({ fetch, data, depends }) => {
|
|
depends('app:sidebar');
|
|
const [categories, events, privateAccess, weather, stocks, bookmarks, poe2, widgetsEnabled] = await Promise.all([
|
|
getCategories(fetch),
|
|
getEvents(fetch),
|
|
getPrivateAccessStatus(fetch),
|
|
getWeather(fetch),
|
|
getStocks(fetch),
|
|
getBookmarks(fetch),
|
|
getPoe2(fetch),
|
|
getWidgetsEnabled(fetch)
|
|
]);
|
|
// Tracked events are a displayed category like any other (see MergeTab/EventsTab) —
|
|
// only active ones show up as browsable, same as a paused/disabled category wouldn't.
|
|
return {
|
|
...data,
|
|
categories,
|
|
events: events.filter((e) => e.active),
|
|
privateAccess,
|
|
weather,
|
|
stocks,
|
|
bookmarks,
|
|
poe2,
|
|
widgetsEnabled
|
|
};
|
|
};
|