🐜 fix(www): Uncomment the SST parts

This commit is contained in:
Wanjohi
2025-05-17 23:32:15 +03:00
parent baf178afc5
commit 14e4176344
2 changed files with 56 additions and 57 deletions

View File

@@ -8,7 +8,6 @@ import '@fontsource/geist-sans/800.css';
import '@fontsource/geist-sans/900.css';
import { Text } from '@nestri/www/ui/text';
import { styled } from "@macaron-css/solid";
import { Screen as FullScreen } from '@nestri/www/ui/layout';
import { TeamRoute } from '@nestri/www/pages/team';
import { OpenAuthProvider } from "@openauthjs/solid";
import { NotFound } from '@nestri/www/pages/not-found';
@@ -16,6 +15,7 @@ import { Navigate, Route, Router } from "@solidjs/router";
import { globalStyle, macaron$ } from "@macaron-css/core";
import { useStorage } from '@nestri/www/providers/account';
import { CreateTeamComponent } from '@nestri/www/pages/new';
import { Screen as FullScreen } from '@nestri/www/ui/layout';
import { darkClass, lightClass, theme } from '@nestri/www/ui/theme';
import { AccountProvider, useAccount } from '@nestri/www/providers/account';
import { Component, createSignal, Match, onCleanup, Switch } from 'solid-js';
@@ -92,24 +92,23 @@ export const App: Component = () => {
const storage = useStorage();
return (
// <OpenAuthProvider
// issuer={import.meta.env.VITE_AUTH_URL}
// clientID="web"
// >
<OpenAuthProvider
issuer={import.meta.env.VITE_AUTH_URL}
clientID="web"
>
<Root class={theme() === "light" ? lightClass : darkClass} id="styled">
<Router>
<Route
path="*"
component={(props) => (
// <AccountProvider
// loadingUI={
// <FullScreen>
// <Text weight='semibold' spacing='xs' size="3xl" font="heading" >Confirming your identity&hellip;</Text>
// </FullScreen>
// }>
// {props.children}
props.children
// </AccountProvider>
<AccountProvider
loadingUI={
<FullScreen>
<Text weight='semibold' spacing='xs' size="3xl" font="heading" >Confirming your identity&hellip;</Text>
</FullScreen>
}>
{props.children}
</AccountProvider>
)}
>
<Route path=":teamSlug">{TeamRoute}</Route>

View File

@@ -11,53 +11,53 @@ import { useAccount, useStorage } from "@nestri/www/providers/account";
export const TeamRoute = (
<Route
// component={(props) => {
// const params = useParams();
// const account = useAccount();
// const storage = useStorage();
// const openauth = useOpenAuth();
component={(props) => {
const params = useParams();
const account = useAccount();
const storage = useStorage();
const openauth = useOpenAuth();
// const team = createMemo(() =>
// account.current.teams.find(
// (item) => item.slug === params.teamSlug,
// ),
// );
const team = createMemo(() =>
account.current.teams.find(
(item) => item.slug === params.teamSlug,
),
);
// createEffect(() => {
// const t = team();
// if (!t) return;
// storage.set("team", t.id);
// });
createEffect(() => {
const t = team();
if (!t) return;
storage.set("team", t.id);
});
// createEffect(() => {
// const teamSlug = params.teamSlug;
// for (const item of Object.values(account.all)) {
// for (const team of item.teams) {
// if (team.slug === teamSlug && item.id !== openauth.subject!.id) {
// openauth.switch(item.email);
// }
// }
// }
// })
createEffect(() => {
const teamSlug = params.teamSlug;
for (const item of Object.values(account.all)) {
for (const team of item.teams) {
if (team.slug === teamSlug && item.id !== openauth.subject!.id) {
openauth.switch(item.email);
}
}
}
})
// return (
// <Switch>
// <Match when={!team()}>
// {/* TODO: Add a public page for (other) teams */}
// <NotAllowed header />
// </Match>
// <Match when={team()}>
// <TeamContext.Provider value={() => team()!}>
// <ZeroProvider>
// <ApiProvider>
// {props.children}
// </ApiProvider>
// </ZeroProvider>
// </TeamContext.Provider>
// </Match>
// </Switch>
// )
// }}
return (
<Switch>
<Match when={!team()}>
{/* TODO: Add a public page for (other) teams */}
<NotAllowed header />
</Match>
<Match when={team()}>
<TeamContext.Provider value={() => team()!}>
<ZeroProvider>
<ApiProvider>
{props.children}
</ApiProvider>
</ZeroProvider>
</TeamContext.Provider>
</Match>
</Switch>
)
}}
>
<Route path="" component={HomeRoute} />
<Route path="library" component={LibraryRoute} />