Move app to apps/web-react in pnpm workspace layout

This commit is contained in:
Kalle
2026-08-16 09:20:33 +03:00
parent 7e365ccfcf
commit bbc8ea57af
2913 changed files with 227 additions and 250 deletions

View File

@@ -0,0 +1,18 @@
import type { AuthenticatedUser } from "~/features/auth/core/user.server";
import { resolveSidebarData } from "~/features/sidebar/core/sidebar.server";
import { GIT_COMMIT } from "~/utils/git-commit";
/**
* The parts of the app shell that go stale on their own while a page sits open.
* Served both by the root loader and by the resource route `LayoutDataProvider`
* polls, so the two payloads can't drift apart. Notifications are not part of
* this: they live in their own resource route refetched when skalop pings that
* they changed (see `NotificationsProvider`).
*/
export async function resolveLayoutData(user: AuthenticatedUser | undefined) {
return {
loggedInUserId: user?.id ?? null,
sidebar: await resolveSidebarData(user?.id ?? null),
buildCommit: GIT_COMMIT,
};
}

View File

@@ -0,0 +1,28 @@
import { createCookieSessionStorage } from "react-router";
import { ServerConfig } from "~/config.server";
import { IS_E2E_TEST_RUN } from "~/utils/e2e";
const TEN_YEARS_IN_SECONDS = 315_360_000;
const sidenavStorage = createCookieSessionStorage({
cookie: {
name: "sidenav",
secure: ServerConfig.isProduction && !IS_E2E_TEST_RUN,
secrets: [ServerConfig.sessionSecret],
sameSite: "lax",
path: "/",
httpOnly: true,
maxAge: TEN_YEARS_IN_SECONDS,
},
});
export async function getSidenavSession(request: Request) {
const session = await sidenavStorage.getSession(
request.headers.get("Cookie"),
);
return {
getCollapsed: () => session.get("collapsed") === true,
setCollapsed: (collapsed: boolean) => session.set("collapsed", collapsed),
commit: () => sidenavStorage.commitSession(session),
};
}