Files
spacedrive/interface/app/onboarding/index.tsx
Oscar Beaumont f7cd96732f @sd/client SolidJS support - Part 1 (#1920)
* `createSolid` + `createPersistedMutable`

* Move all Valtio stores to SolidJS

* Remove Valtio from `@sd/client`

* Missed auth store

* wip

* `useSolidStore` allow mutable setting

* Restructure `@sd/client` a bit

* Add `WithSolid` + custom `useObserver`

* Parse props both ways

* Universal Context

* Solid to React context working

* Working universal context

* context inheritance

* whoops

* Make it clearer how the demo works

* wip: `useUniversalQuery`
2024-01-09 08:05:01 +00:00

47 lines
1.3 KiB
TypeScript

import { Navigate, redirect, RouteObject } from 'react-router';
import { onboardingStore } from '@sd/client';
import Alpha from './alpha';
import { useOnboardingContext } from './context';
import CreatingLibrary from './creating-library';
import { FullDisk } from './full-disk';
import { JoinLibrary } from './join-library';
import Locations from './locations';
import NewLibrary from './new-library';
import Privacy from './privacy';
const Index = () => {
const ctx = useOnboardingContext();
if (onboardingStore.lastActiveScreen && !ctx.library)
return <Navigate to={onboardingStore.lastActiveScreen} replace />;
return <Navigate to="alpha" replace />;
};
export default [
{
index: true,
loader: () => {
if (onboardingStore.lastActiveScreen)
return redirect(`/onboarding/${onboardingStore.lastActiveScreen}`, {
replace: true
});
return redirect(`/onboarding/alpha`, { replace: true });
},
element: <Index />
},
{ path: 'alpha', Component: Alpha },
// {
// element: <Login />,
// path: 'login'
// },
{ Component: NewLibrary, path: 'new-library' },
{ Component: JoinLibrary, path: 'join-library' },
{ Component: FullDisk, path: 'full-disk' },
{ Component: Locations, path: 'locations' },
{ Component: Privacy, path: 'privacy' },
{ Component: CreatingLibrary, path: 'creating-library' }
] satisfies RouteObject[];