add homepage
This commit is contained in:
parent
2712285a35
commit
0dcc2450a2
2 changed files with 21 additions and 26 deletions
|
@ -1,37 +1,30 @@
|
||||||
import type { V2_MetaFunction } from "@remix-run/cloudflare";
|
import { json, type V2_MetaFunction } from "@remix-run/cloudflare";
|
||||||
|
import { useLoaderData } from "@remix-run/react";
|
||||||
|
import type { IndexResponse } from "~/utils/saerro";
|
||||||
|
import { indexQuery } from "~/utils/saerro";
|
||||||
|
|
||||||
|
export const loader = async () => {
|
||||||
|
return json(await indexQuery());
|
||||||
|
};
|
||||||
|
|
||||||
export const meta: V2_MetaFunction = () => {
|
export const meta: V2_MetaFunction = () => {
|
||||||
return [{ title: "New Remix App" }];
|
return [{ title: "PS2.LIVE" }];
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function Index() {
|
export default function Index() {
|
||||||
|
const data = useLoaderData<typeof loader>();
|
||||||
return (
|
return (
|
||||||
<div style={{ fontFamily: "system-ui, sans-serif", lineHeight: "1.4" }}>
|
<div style={{ fontFamily: "system-ui, sans-serif", lineHeight: "1.4" }}>
|
||||||
<h1>Welcome to Remix</h1>
|
<h1>PS2.LIVE</h1>
|
||||||
|
<h2>Worlds</h2>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
{data.allWorlds.map((world) => (
|
||||||
<a
|
<li key={world.id}>
|
||||||
target="_blank"
|
<a href={`/worlds/${world.id}`}>{world.name}</a> -{" "}
|
||||||
href="https://remix.run/tutorials/blog"
|
{world.population.total} players ({world.population.vs} VS,{" "}
|
||||||
rel="noreferrer"
|
{world.population.nc} NC, {world.population.tr} TR)
|
||||||
>
|
</li>
|
||||||
15m Quickstart Blog Tutorial
|
))}
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a
|
|
||||||
target="_blank"
|
|
||||||
href="https://remix.run/tutorials/jokes"
|
|
||||||
rel="noreferrer"
|
|
||||||
>
|
|
||||||
Deep Dive Jokes App Tutorial
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a target="_blank" href="https://remix.run/docs" rel="noreferrer">
|
|
||||||
Remix Docs
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
@ -91,6 +91,8 @@ export const indexQuery = async (): Promise<IndexResponse> => {
|
||||||
|
|
||||||
indexData.allWorlds.sort((a, b) => a.id - b.id);
|
indexData.allWorlds.sort((a, b) => a.id - b.id);
|
||||||
|
|
||||||
|
console.log(indexData);
|
||||||
|
|
||||||
return indexData;
|
return indexData;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue