624644619c
- Character sheets gain structured combat_stats, abilities (name + plain-language explanation), and equipment fields, populated by the upsert_character_sheet tool; the detail page renders them as their own sections instead of one prose block, with a player-card-style attribute grid (full ability names + modifiers). - Fix double-escaped unicode occasionally left in tool-call JSON arguments (a model quirk) and stop the app's own json.dumps calls from re-introducing it (ensure_ascii=False). - Render chat messages as markdown (react-markdown + Tailwind typography) instead of raw text, and widen the games/characters/ chat layout to use more of the screen on desktop. - Sharpen the DM system prompt: state the ability + DC for each offered action option before the player commits, and narrate rolls as DC → result → pass/fail before the story consequence; also stop re-asking Session-0 questions already answered in the game's name/description. - Make the DM's LLM provider configurable (xai default, lmstudio for a local OpenAI-compatible server via host.docker.internal) instead of hardcoded to x.ai. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
57 lines
1.6 KiB
TypeScript
57 lines
1.6 KiB
TypeScript
import { useEffect, useState } from "react";
|
|
import { useNavigate } from "react-router-dom";
|
|
|
|
import { Game, listGames } from "../api/games";
|
|
import GameCard from "../components/GameCard";
|
|
import GameSetupChat from "../components/GameSetupChat";
|
|
|
|
export default function GamesList() {
|
|
const navigate = useNavigate();
|
|
const [games, setGames] = useState<Game[]>([]);
|
|
const [loading, setLoading] = useState(true);
|
|
const [showCreate, setShowCreate] = useState(false);
|
|
|
|
async function load() {
|
|
setLoading(true);
|
|
try {
|
|
setGames(await listGames());
|
|
} finally {
|
|
setLoading(false);
|
|
}
|
|
}
|
|
|
|
useEffect(() => {
|
|
load();
|
|
}, []);
|
|
|
|
return (
|
|
<div className="mx-auto max-w-6xl px-4 py-8">
|
|
<div className="mb-6 flex items-center justify-between">
|
|
<h1 className="text-2xl font-bold text-amber-400">Spiele</h1>
|
|
<div className="flex gap-2">
|
|
<button
|
|
onClick={() => setShowCreate((v) => !v)}
|
|
className="rounded bg-amber-500 px-3 py-2 text-sm font-semibold text-slate-950 hover:bg-amber-400"
|
|
>
|
|
Neues Spiel
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
{showCreate && <GameSetupChat onCreated={(game) => navigate(`/games/${game.id}`)} />}
|
|
|
|
{loading ? (
|
|
<p className="text-slate-400">Lädt…</p>
|
|
) : games.length === 0 ? (
|
|
<p className="text-slate-400">Noch keine Spiele vorhanden.</p>
|
|
) : (
|
|
<div className="grid gap-3 sm:grid-cols-2 xl:grid-cols-3">
|
|
{games.map((game) => (
|
|
<GameCard key={game.id} game={game} />
|
|
))}
|
|
</div>
|
|
)}
|
|
</div>
|
|
);
|
|
}
|