Files
spacedrive/interface/app/onboarding/Progress.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

53 lines
1.3 KiB
TypeScript

import clsx from 'clsx';
import { useEffect } from 'react';
import { useMatch, useNavigate } from 'react-router';
import { onboardingStore, unlockOnboardingScreen, useOnboardingStore } from '@sd/client';
import { useOperatingSystem } from '~/hooks';
export default function OnboardingProgress() {
const obStore = useOnboardingStore();
const navigate = useNavigate();
const os = useOperatingSystem();
const match = useMatch('/onboarding/:screen');
const currentScreen = match?.params?.screen;
useEffect(() => {
if (!currentScreen) return;
unlockOnboardingScreen(currentScreen, onboardingStore.unlockedScreens);
}, [currentScreen]);
const routes = [
'alpha',
'new-library',
os === 'macOS' && 'full-disk',
'locations',
'privacy',
'creating-library'
].filter(Boolean);
return (
<div className="flex w-full items-center justify-center">
<div className="flex items-center justify-center space-x-1">
{routes.map((path) => {
if (!path) return null;
return (
<button
key={path}
disabled={!obStore.unlockedScreens.includes(path)}
onClick={() => navigate(path, { replace: true })}
className={clsx(
'h-2 w-2 rounded-full transition hover:bg-ink disabled:opacity-10',
currentScreen === path ? 'bg-ink' : 'bg-ink-faint'
)}
/>
);
})}
</div>
</div>
);
}