UNPKG

alinea

Version:

[![npm](https://img.shields.io/npm/v/alinea.svg)](https://npmjs.org/package/alinea) [![install size](https://packagephobia.com/badge?p=alinea)](https://packagephobia.com/result?p=alinea)

43 lines (41 loc) 1.13 kB
import { atomFamily } from "../chunks/chunk-ZHH24SIG.js"; import { atom } from "../chunks/chunk-OBOPLPUQ.js"; import "../chunks/chunk-U5RRZUYZ.js"; // src/dashboard/Routes.tsx import { entryEditorAtoms } from "./atoms/EntryEditorAtoms.js"; import { entryLocationAtom, localeAtom } from "./atoms/NavigationAtoms.js"; import { Route, Router } from "./atoms/RouterAtoms.js"; import { ContentView } from "./pages/ContentView.js"; import { DraftsOverview } from "./pages/DraftsOverview.js"; var editorLoader = atomFamily(() => { return atom(async (get) => { const entryLocation = get(entryLocationAtom); const locale = get(localeAtom) ?? null; return { editor: await get( entryEditorAtoms({ locale, i18nId: entryLocation?.entryId }) ) }; }); }); var entryRoute = new Route({ path: "*", loader: editorLoader, component: ContentView }); var draftRoute = new Route({ path: "/draft/:workspace?/:root?/:id?", loader: editorLoader, component: DraftsOverview }); var routes = [draftRoute, entryRoute]; var router = new Router({ routes }); export { draftRoute, entryRoute, router };