-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
281 additions
and
243 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
"use client"; | ||
|
||
import React from "react"; | ||
import { useQuery, useMutation } from "convex/react"; | ||
import { useRouter } from "next/navigation"; | ||
import { Button } from "@/components/ui/button"; | ||
import { | ||
Select, | ||
SelectContent, | ||
SelectItem, | ||
SelectTrigger, | ||
SelectValue, | ||
} from "@/components/ui/select"; | ||
import { api } from "@/convex/_generated/api"; | ||
|
||
export default function TestPage() { | ||
const models = useQuery(api.models.getActiveModels); | ||
const testModel = useMutation(api.games.testModel); | ||
const [model, setModel] = React.useState(""); | ||
const router = useRouter(); | ||
|
||
React.useEffect(() => { | ||
if (models !== undefined && models.length !== 0) { | ||
setModel(models[0].slug); | ||
} | ||
}, [models]); | ||
|
||
const handleClick = async () => { | ||
await testModel({ | ||
modelId: model, | ||
}).then((gameId) => { | ||
router.push(`/games/${gameId}`); | ||
}); | ||
}; | ||
|
||
return ( | ||
<div className="container mx-auto min-h-screen flex flex-col items-center pt-12 gap-8"> | ||
<h1 className="text-4xl font-bold mb-8">Zombie Map Simulator</h1> | ||
|
||
<div className="flex justify-center gap-4"> | ||
<Select value={model} onValueChange={(value) => setModel(value)}> | ||
<SelectTrigger className="w-[180px]"> | ||
<SelectValue placeholder="Select model" /> | ||
</SelectTrigger> | ||
<SelectContent> | ||
{models !== undefined && | ||
models.map((model) => ( | ||
<SelectItem key={model._id} value={model.slug}> | ||
{model.name} | ||
</SelectItem> | ||
))} | ||
</SelectContent> | ||
</Select> | ||
<Button onClick={handleClick}>Test Model</Button> | ||
</div> | ||
</div> | ||
); | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { cronJobs } from "convex/server"; | ||
import { internal } from "./_generated/api"; | ||
|
||
const crons = cronJobs(); | ||
|
||
crons.interval( | ||
"run games for all active models", | ||
{ minutes: 60 }, | ||
internal.models.runActiveModelsGames, | ||
); | ||
|
||
export default crons; |
Oops, something went wrong.