Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions apps/frontend/src/app/app.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { createEffect, createMemo } from "solid-js";
import { Router, Route, useNavigate, useSearchParams } from "@solidjs/router";
import { games } from "@/features/games/registry";
import { getHomeGamePath } from "@/features/games/utils";
import { games } from "@/features/games/core/registry";
import { getHomeGamePath } from "@/features/games/core/utils";
import AboutPage from "@/app/pages/about";
import AdminPage from "@/app/pages/admin";
import HomePage from "@/app/pages/home";
import Layout from "@/app/layout";
import LeaderboardPage from "@/app/pages/leaderboard";
import ProfilePage from "@/app/pages/profile";
import type { GameId } from "@/features/games/types";
import type { GameId } from "@/features/games/core/types";
import type { WordBankId } from "@/features/content/word-banks/types";

function App() {
Expand Down
6 changes: 3 additions & 3 deletions apps/frontend/src/app/pages/home.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { createMemo } from "solid-js";
import { Dynamic } from "solid-js/web";

import GameSelector from "@/features/games/components/game-selector";
import GameSelector from "@/features/games/core/components/game-selector";
import { FeedbackFeed } from "@/features/feedback/components/feedback-feed";
import { games } from "@/features/games/registry";
import type { GameId } from "@/features/games/types";
import { games } from "@/features/games/core/registry";
import type { GameId } from "@/features/games/core/types";
import type { WordBankId } from "@/features/content/word-banks/types";

type HomeProps = {
Expand Down
6 changes: 3 additions & 3 deletions apps/frontend/src/app/pages/leaderboard.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { For, createSignal } from "solid-js";

import { gameRegistry } from "@/features/games/registry";
import { gameRegistry } from "@/features/games/core/registry";
import type { LeaderboardDifficulty } from "@/features/leaderboard/types";
import { LeaderboardTable } from "@/features/leaderboard/components/leaderboard-table";
import { getGameName } from "@/features/games/utils";
import type { GameId } from "@/features/games/types";
import { getGameName } from "@/features/games/core/utils";
import type { GameId } from "@/features/games/core/types";

const difficulties: LeaderboardDifficulty[] = ["easy", "medium", "hard"];

Expand Down
6 changes: 3 additions & 3 deletions apps/frontend/src/features/commandline/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import { useNavigate, useLocation, useSearchParams } from "@solidjs/router";
import { themes } from "@/features/content/themes/registry";
import { wordBanks } from "@/features/content/word-banks/registry";
import type { WordBankId } from "@/features/content/word-banks/types";
import { gameRegistry } from "@/features/games/registry";
import { getHomeGamePath } from "@/features/games/utils";
import { gameRegistry } from "@/features/games/core/registry";
import { getHomeGamePath } from "@/features/games/core/utils";
import type { ThemeName } from "@/features/content/themes/types";
import type {
CommandlineItem,
CommandlineScope,
} from "@/features/commandline/types";
import type { GameId } from "@/features/games/types";
import type { GameId } from "@/features/games/core/types";
import { themeManager } from "@/features/content/themes/manager";
import { useAuthSession } from "@/features/auth/hooks";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ArrowRight } from "lucide-solid";
import type { GameId } from "@/features/games/types";

import type { GameId } from "../types";

type GameCardProps = {
name: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { For } from "solid-js";
import { gameRegistry } from "@/features/games/registry";
import type { GameId } from "@/features/games/types";

import { gameRegistry } from "../registry";
import type { GameId } from "../types";
import { GameCard } from "./game-card";

type GameSelectorProps = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useAuthSession } from "@/features/auth/hooks";
import { useCreateResultMutation } from "@/features/users/results/api";
import { toast } from "@/lib/toast";
import type { DifficultyKey } from "@/features/games/types";
import type { DifficultyKey } from "./types";

export function useSubmitGameResult(minScores: Record<DifficultyKey, number>) {
const auth = useAuthSession();
Expand Down
10 changes: 10 additions & 0 deletions apps/frontend/src/features/games/core/registry.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { meta as fallingWordsGame } from "../falling-words";
import { meta as survivalGame } from "../survival";
import type { GameId, GameModule } from "./types";

export const games: Record<GameId, GameModule> = {
"falling-words": fallingWordsGame,
survival: survivalGame,
};

export const gameRegistry = Object.values(games);
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { For } from "solid-js";

import { Kbd } from "@/components/ui/kbd";
import type { GamePhase } from "@/features/games/types";

import type { GamePhase } from "../../core/types";
import type { FallingWord } from "../types";

type FallingWordsFieldProps = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { GameStat } from "@/features/games/components/game-stat";
import { GameStat } from "../../core/components/game-stat";

export type FallingWordsHudProps = {
score: number;
Expand Down
2 changes: 1 addition & 1 deletion apps/frontend/src/features/games/falling-words/meta.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { GameModule } from "@/features/games/types";
import type { GameModule } from "../core/types";
import FallingWordsView from "./view";

export const meta: GameModule = {
Expand Down
2 changes: 1 addition & 1 deletion apps/frontend/src/features/games/falling-words/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { DifficultyKey } from "@/features/games/types";
import type { DifficultyKey } from "../core/types";

export type DifficultyConfig = {
spawnIntervalMs: number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ import {
onCleanup,
onMount,
} from "solid-js";

import { getWordBank } from "@/features/content/word-banks/manager";
import type { WordBankId } from "@/features/content/word-banks/types";
import type { DifficultyKey, GamePhase } from "@/features/games/types";

import type { DifficultyKey, GamePhase } from "../core/types";
import type {
DifficultyConfig,
FallingWord,
Expand Down
8 changes: 5 additions & 3 deletions apps/frontend/src/features/games/falling-words/view.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { Show } from "solid-js";

import { useAuthSession } from "@/features/auth/hooks";
import type { GameViewProps } from "@/features/games/types";
import { useCreateResultMutation } from "@/features/users/results/api";
import { toast } from "@/lib/toast";
import { DifficultySelector } from "../components/difficulty-selector";
import { GameMeta } from "../components/game-meta";

import type { GameViewProps } from "../core/types";
import { DifficultySelector } from "../core/components/difficulty-selector";
import { GameMeta } from "../core/components/game-meta";
import FallingWordsField from "./components/falling-words-field";
import { FallingWordsHud as Hud } from "./components/falling-words-hud";
import { useFallingWordsGame } from "./use-falling-words-game";
Expand Down
10 changes: 0 additions & 10 deletions apps/frontend/src/features/games/registry.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Index } from "solid-js";
import { Heart } from "./heart";
import { GameStat } from "@/features/games/components/game-stat";
import { GameStat } from "../../core/components/game-stat";

export type SurvivalHudProps = {
health: number;
Expand Down
8 changes: 5 additions & 3 deletions apps/frontend/src/features/games/survival/engine.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { createMemo, onCleanup, createEffect } from "solid-js";
import { createStore } from "solid-js/store";

import { getWordBank } from "@/features/content/word-banks/manager";
import type { WordBankId } from "@/features/content/word-banks/types";
import type { DifficultyKey, GamePhase } from "@/features/games/types";
import { getMetrics } from "@/features/games/metrics";
import { randomWord } from "@/features/games/utils";

import type { DifficultyKey, GamePhase } from "../core/types";
import { getMetrics } from "../core/metrics";
import { randomWord } from "../core/utils";

const WORD_BATCH = 50;
const WORD_REFILL_THRESHOLD = 20;
Expand Down
2 changes: 1 addition & 1 deletion apps/frontend/src/features/games/survival/meta.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { GameModule } from "@/features/games/types";
import type { GameModule } from "../core/types";
import View from "./view";

export const meta: GameModule = {
Expand Down
13 changes: 7 additions & 6 deletions apps/frontend/src/features/games/survival/view.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { Show } from "solid-js";
import type { GameViewProps } from "@/features/games/types";

import type { GameViewProps } from "../core/types";
import { useSubmitGameResult } from "../core/hooks";
import { DifficultySelector } from "../core/components/difficulty-selector";
import { GameOver } from "../core/components/game-over";
import { GameInput } from "../core/components/game-input";
import { GameMeta } from "../core/components/game-meta";
import { meta } from "./meta";
import { useEngine } from "./engine";
import { useSubmitGameResult } from "@/features/games/hooks";
import { DifficultySelector } from "../components/difficulty-selector";
import { SurvivalHud as Hud } from "./components/survival-hud";
import { Words } from "./components/words";
import { GameOver } from "@/features/games/components/game-over";
import { GameInput } from "../components/game-input";
import { GameMeta } from "../components/game-meta";

import "./animations.css";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { For } from "solid-js";

import { gameRegistry } from "@/features/games/registry";
import type { DifficultyKey } from "@/features/games/types";
import { gameRegistry } from "@/features/games/core/registry";
import type { DifficultyKey } from "@/features/games/core/types";
import { formatDateTime } from "@/lib/utils";
import type { UserPBs } from "../types";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Table, type TableColumn } from "@/components/table";
import { getGameName } from "@/features/games/utils";
import { getGameName } from "@/features/games/core/utils";
import type { Result } from "../types";

function formatResultsDateTime(value: string | Date) {
Expand Down
Loading