Files
spacedrive/packages/interface/src/AppRouter.tsx
Jamie Pine f47a2d58e5 [ENG 239] Onboarding Flow & Location Settings (#529)
* begin better onboarding

* added input and altered text

* better router & text + database icon

Co-authored-by: maxichrome <maxichrome@users.noreply.github.com>

* work on privacy screen + radio buttons

* fix video extension bug and alter screens

* add pending schema and location manager helper

* functional onboarding

* added secure temp store and started creating library loading screen

* fix secure temp keystore + api

* better onboarding

* added location settings and some overview concept, all WIP

* fix switch

* prep

* fix location router

* added backend settings

* attempted to fix form

* begin indexer rules editor, plus tweaks

* indexer rules coming soon

* fix onboarding img size

* cleanup

* clone is needed here, but clippy no like

* sike

* whole bunch of fixes

* clippy + ts

* Removing some TODOs from api/libraries.rs and fixing db size calculation

* moved object kind to client, added half functionality for appearance settings

* fix RadioGroup helper

* fix type issues

* cargo fmt

* fix creating library error handling + invalidate location list on update

* forgot to switch back to onError

* Invalidating getStatistics query on library creation and introducing the concept of waiting for a job on FileCopierJob

* F* cargo fmt

* fix RadioGroup interactivity

* wipe all migrations

* put back COLLATE NOCASE on extension columns

* update core.ts

* remove unused device component

* fix typeerror in mobile

---------

Co-authored-by: maxichrome <maxichrome@users.noreply.github.com>
Co-authored-by: Brendan Allan <brendonovich@outlook.com>
Co-authored-by: Ericson Soares <ericson.ds999@gmail.com>
Co-authored-by: Utku Bakir <74243531+utkubakir@users.noreply.github.com>
2023-02-10 14:08:13 -08:00

45 lines
1.3 KiB
TypeScript

import { Navigate, Route, Routes } from 'react-router-dom';
import { useCurrentLibrary, useInvalidateQuery } from '@sd/client';
import { AppLayout } from '~/AppLayout';
import { useKeybindHandler } from '~/hooks/useKeyboardHandler';
import screens from '~/screens';
import { lazyEl } from '~/util';
import OnboardingRoot, { ONBOARDING_SCREENS } from './components/onboarding/OnboardingRoot';
const NotFound = lazyEl(() => import('./NotFound'));
export function AppRouter() {
const { library } = useCurrentLibrary();
useKeybindHandler();
useInvalidateQuery();
return (
<Routes>
<Route path="onboarding" element={<OnboardingRoot />}>
<Route index element={<Navigate to="start" />} />
{ONBOARDING_SCREENS.map(({ key, component: ScreenComponent }, index) => (
<Route key={key} path={key} element={<ScreenComponent />} />
))}
</Route>
<Route element={<AppLayout />}>
{/* As we are caching the libraries in localStore so this *shouldn't* result is visual problems unless something else is wrong */}
{library === undefined ? (
<Route
path="*"
element={
<h1 className="p-4 text-white">Please select or create a library in the sidebar.</h1>
}
/>
) : (
<>
{screens}
<Route path="*" element={NotFound} />
</>
)}
</Route>
</Routes>
);
}