feat: add desktop2

This commit is contained in:
2024-02-05 14:18:27 +07:00
parent 08fa7de01d
commit a21da11a91
16 changed files with 3107 additions and 230 deletions

View File

@@ -0,0 +1,12 @@
import { RemixBrowser } from "@remix-run/react";
import { startTransition, StrictMode } from "react";
import { hydrateRoot } from "react-dom/client";
startTransition(() => {
hydrateRoot(
document,
<StrictMode>
<RemixBrowser />
</StrictMode>
);
});

View File

@@ -0,0 +1,21 @@
import type { EntryContext } from "@remix-run/node";
import { RemixServer } from "@remix-run/react";
import { renderToString } from "react-dom/server";
export default function handleRequest(
request: Request,
responseStatusCode: number,
responseHeaders: Headers,
remixContext: EntryContext
) {
let html = renderToString(
<RemixServer context={remixContext} url={request.url} />
);
if (html.startsWith("<html")) {
html = "<!DOCTYPE html>\n" + html;
}
return new Response(html, {
headers: { "Content-Type": "text/html" },
status: responseStatusCode,
});
}

View File

@@ -0,0 +1,42 @@
import {
Links,
Meta,
Outlet,
Scripts,
ScrollRestoration,
} from "@remix-run/react";
export default function App() {
return (
<html lang="en">
<head>
<meta charSet="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<Meta />
<Links />
</head>
<body>
<Outlet />
<ScrollRestoration />
<Scripts />
</body>
</html>
);
}
export function HydrateFallback() {
return (
<html lang="en">
<head>
<meta charSet="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<Meta />
<Links />
</head>
<body>
<p>Loading...</p>
<Scripts />
</body>
</html>
);
}

View File

@@ -0,0 +1,32 @@
import type { MetaFunction } from "@remix-run/node";
export const meta: MetaFunction = () => {
return [
{ title: "New Remix SPA" },
{ name: "description", content: "Welcome to Remix (SPA Mode)!" },
];
};
export default function Index() {
return (
<div style={{ fontFamily: "system-ui, sans-serif", lineHeight: "1.8" }}>
<h1>Welcome to Remix (SPA Mode)</h1>
<ul>
<li>
<a
target="_blank"
href="https://remix.run/future/spa-mode"
rel="noreferrer"
>
SPA Mode Guide
</a>
</li>
<li>
<a target="_blank" href="https://remix.run/docs" rel="noreferrer">
Remix Docs
</a>
</li>
</ul>
</div>
);
}