Files
homefeed/frontend/src/routes/+layout.ts
T
Claude e6ac6cd061 Consolidate Weather/Stocks/Bookmarks/PoE2 into a single admin "Widgets" tab
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.
2026-07-26 17:09:26 +00:00

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
};
};