2024-03-19 11:20:11 +00:00
|
|
|
import {Links, Meta, Outlet, Scripts, ScrollRestoration,} from "@remix-run/react";
|
2024-03-05 16:56:17 +00:00
|
|
|
|
|
|
|
import stylesheet from "./tailwind.css?url";
|
2024-03-19 11:20:11 +00:00
|
|
|
import type {LinksFunction} from "@remix-run/node";
|
2024-03-05 16:56:17 +00:00
|
|
|
|
|
|
|
// Supports weights 200-800
|
|
|
|
import '@fontsource-variable/manrope';
|
2024-03-13 13:38:01 +00:00
|
|
|
import {Refine} from "@refinedev/core";
|
|
|
|
import routerProvider from "@refinedev/remix-router";
|
2024-03-21 19:32:39 +00:00
|
|
|
import {notificationProvider} from "~/data/notification-provider";
|
|
|
|
import {SdkContextProvider, useSdk} from "~/components/lib/sdk-context";
|
|
|
|
import {Toaster} from "~/components/ui/toaster";
|
2024-03-19 11:20:11 +00:00
|
|
|
import {getProviders} from "~/data/providers.js";
|
|
|
|
import {Sdk} from "@lumeweb/portal-sdk";
|
|
|
|
import resources from "~/data/resources.js";
|
2024-03-22 03:15:56 +00:00
|
|
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
2024-03-21 19:32:39 +00:00
|
|
|
import {useMemo} from "react";
|
2024-03-05 16:56:17 +00:00
|
|
|
|
|
|
|
export const links: LinksFunction = () => [
|
2024-03-21 19:32:39 +00:00
|
|
|
{rel: "stylesheet", href: stylesheet},
|
2024-03-05 16:56:17 +00:00
|
|
|
];
|
|
|
|
|
2024-03-22 03:15:56 +00:00
|
|
|
const queryClient = new QueryClient();
|
|
|
|
|
2024-03-13 13:38:01 +00:00
|
|
|
export function Layout({children}: { children: React.ReactNode }) {
|
|
|
|
return (
|
|
|
|
<html lang="en">
|
|
|
|
<head>
|
|
|
|
<meta charSet="utf-8"/>
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
|
|
|
<Meta/>
|
|
|
|
<Links/>
|
|
|
|
</head>
|
2024-03-22 12:47:50 +00:00
|
|
|
<body className="overflow-hidden">
|
2024-03-05 16:56:17 +00:00
|
|
|
{children}
|
2024-03-21 19:32:39 +00:00
|
|
|
<Toaster/>
|
2024-03-13 13:38:01 +00:00
|
|
|
<ScrollRestoration/>
|
|
|
|
<Scripts/>
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
);
|
2024-03-05 16:56:17 +00:00
|
|
|
}
|
|
|
|
|
2024-03-21 19:32:39 +00:00
|
|
|
function App() {
|
|
|
|
const sdk = useSdk();
|
|
|
|
const providers = useMemo(() => getProviders(sdk as Sdk), [sdk]);
|
2024-03-13 13:38:01 +00:00
|
|
|
return (
|
2024-03-22 03:15:56 +00:00
|
|
|
<QueryClientProvider client={queryClient}>
|
|
|
|
<Refine
|
|
|
|
authProvider={providers.auth}
|
|
|
|
routerProvider={routerProvider}
|
|
|
|
notificationProvider={notificationProvider}
|
|
|
|
dataProvider={{
|
|
|
|
default: providers.default,
|
|
|
|
files: providers.files
|
|
|
|
}}
|
|
|
|
resources={resources}
|
|
|
|
options={{disableTelemetry: true}}
|
|
|
|
>
|
|
|
|
<SdkContextProvider sdk={sdk}>
|
|
|
|
<Outlet/>
|
|
|
|
</SdkContextProvider>
|
|
|
|
</Refine>
|
|
|
|
</QueryClientProvider>
|
2024-03-13 13:38:01 +00:00
|
|
|
);
|
2024-03-05 16:56:17 +00:00
|
|
|
}
|
|
|
|
|
2024-03-21 19:32:39 +00:00
|
|
|
export default function Root() {
|
|
|
|
const sdk = Sdk.create(import.meta.env.VITE_PORTAL_URL)
|
|
|
|
return (
|
|
|
|
<SdkContextProvider sdk={sdk}>
|
|
|
|
<App/>
|
|
|
|
</SdkContextProvider>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2024-03-05 16:56:17 +00:00
|
|
|
export function HydrateFallback() {
|
2024-03-13 13:38:01 +00:00
|
|
|
return <p>Loading...</p>;
|
2024-03-05 16:56:17 +00:00
|
|
|
}
|