save artifact content to cloudflare workers kv

This commit is contained in:
lloydzhou
2024-07-24 20:02:37 +08:00
parent 1ecefd88f7
commit 421bf33c0e
8 changed files with 289 additions and 52 deletions

View File

@@ -39,6 +39,10 @@ export function Loading(props: { noLogo?: boolean }) {
);
}
const Artifact = dynamic(async () => (await import("./artifact")).Artifact, {
loading: () => <Loading noLogo />,
});
const Settings = dynamic(async () => (await import("./settings")).Settings, {
loading: () => <Loading noLogo />,
});
@@ -125,6 +129,7 @@ const loadAsyncGoogleFont = () => {
function Screen() {
const config = useAppConfig();
const location = useLocation();
const isArtifact = location.pathname.includes(Path.Artifact);
const isHome = location.pathname === Path.Home;
const isAuth = location.pathname === Path.Auth;
const isMobileScreen = useMobileScreen();
@@ -135,6 +140,14 @@ function Screen() {
loadAsyncGoogleFont();
}, []);
if (isArtifact) {
return (
<Routes>
<Route exact path="/artifact/:id" element={<Artifact />} />
</Routes>
);
}
return (
<div
className={