import { A } from "@solidjs/router";
import Game from "../components/Game";
import { createResource, For } from "solid-js";
import { db } from "../db";

export default () => {
	const [games] = createResource(() => db().then((data) => data.games));
	return (
		<div style={{ padding: "20px" }}>
			<For each={Object.entries(games() ?? {})}>
				{([gameId, game]) => <A href={`/${gameId}`}>{game.name}</A>}
			</For>
		</div>
	);
};
