Skip to content

Commit

Permalink
Move components to components folder
Browse files Browse the repository at this point in the history
  • Loading branch information
delasy committed Oct 17, 2024
1 parent 266f7fa commit 91d931f
Show file tree
Hide file tree
Showing 13 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions app/games/[gameId]/result.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import { Doc } from "@/convex/_generated/dataModel";
import { api } from "@/convex/_generated/api";
import { useQuery } from "convex/react";
import { ResultStatus } from "@/app/result-status";
import { Visualizer } from "../../visualizer";
import { ResultStatus } from "@/components/ResultStatus";
import { Visualizer } from "@/components/Visualizer";
import Link from "next/link";

export const Result = ({ result }: { result: Doc<"results"> }) => {
Expand Down
8 changes: 4 additions & 4 deletions app/maps/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default function AddMapPage() {
var flag = false;
map.forEach((row, y) => {
row.forEach((cell, x) => {
if (map[y][x] == " ") {
if (map[y][x] === " ") {
flag = true;
}
});
Expand All @@ -46,14 +46,14 @@ export default function AddMapPage() {
};
const setCell = (y: number, x: number, z: boolean) => {
var cell = " ";
if (z == true) {
if (map[y][x] == "Z") {
if (z === true) {
if (map[y][x] === "Z") {
cell = " ";
} else {
cell = "Z";
}
} else {
if (map[y][x] == "B") {
if (map[y][x] === "B") {
cell = " ";
} else {
cell = "R";
Expand Down
4 changes: 2 additions & 2 deletions app/play/[level]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { useEffect, useState } from "react";
import { useMutation, useQuery, Authenticated } from "convex/react";
import { api } from "@/convex/_generated/api";
import { Button } from "@/components/ui/button";
import { Visualizer } from "../../visualizer";
import { Map } from "@/app/map";
import { Visualizer } from "@/components/Visualizer";
import { Map } from "@/components/Map";
import Link from "next/link";
import { ChevronLeftIcon } from "@radix-ui/react-icons";
import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs";
Expand Down
4 changes: 2 additions & 2 deletions app/play/[level]/test-mode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { useState } from "react";
import { useAction } from "convex/react";
import { api } from "@/convex/_generated/api";
import { Button } from "@/components/ui/button";
import { Visualizer } from "../../visualizer";
import { Map } from "@/app/map";
import { Visualizer } from "@/components/Visualizer";
import { Map } from "@/components/Map";
import { ReloadIcon } from "@radix-ui/react-icons";
import {
Select,
Expand Down
2 changes: 1 addition & 1 deletion app/play/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { Authenticated, Unauthenticated, useQuery } from "convex/react";
import { api } from "@/convex/_generated/api";
import { Map as GameMap } from "@/app/map";
import { Map as GameMap } from "@/components/Map";
import { Button } from "@/components/ui/button";
import Link from "next/link";
import {
Expand Down
4 changes: 2 additions & 2 deletions app/result.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"use client";

import { ResultStatus } from "./result-status";
import { ResultStatus } from "@/components/ResultStatus";
import { type ResultWithGame } from "@/convex/results";
import { Visualizer } from "./visualizer";
import { Visualizer } from "@/components/Visualizer";
import { format } from "date-fns";
import Link from "next/link";
import { Card } from "@/components/ui/card";
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions components/ThemeToggle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ export function ThemeToggle() {
size="sm"
value={theme}
onValueChange={(e) => setTheme(e)}
className={`${"flex px-1 py-1 rounded-md"} ${theme == "light" || (theme == "system" && darkMode == "light") ? "bg-blue-200" : "bg-slate-700"}`}
className={`${"flex px-1 py-1 rounded-md"} ${theme === "light" || (theme === "system" && darkMode === "light") ? "bg-blue-200" : "bg-slate-700"}`}
>
{theme == "light" || (theme == "system" && darkMode == "light") ? (
{theme === "light" || (theme === "system" && darkMode === "light") ? (
<ToggleGroupItem value="dark" aria-label="Dark">
<MoonIcon />
</ToggleGroupItem>
Expand Down
2 changes: 1 addition & 1 deletion app/visualizer.tsx → components/Visualizer.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Button } from "@/components/ui/button";
import { EntityType, ZombieSurvival } from "@/simulators/zombie-survival";
import { useEffect, useRef, useState } from "react";
import { getCellImage } from "./map";
import { getCellImage } from "@/components/Map";

const AUTO_REPLAY_SPEED = 1_500;
const REPLAY_SPEED = 600;
Expand Down
2 changes: 1 addition & 1 deletion convex/playerresults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export const updateUserResult = mutation({
handler: async (ctx, { mapId, hasWon, placedGrid }) => {
const userId = await getAuthUserId(ctx);

if (userId == null) {
if (userId === null) {
throw new Error("Not signed in");
}

Expand Down
2 changes: 1 addition & 1 deletion simulators/zombie-survival/ZombieSurvival.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class ZombieSurvival {
}

public constructor(config: string[][]) {
if (config.length === 0 || config[0].length == 0) {
if (config.length === 0 || config[0].length === 0) {
throw new Error("Config is empty");
}

Expand Down
2 changes: 1 addition & 1 deletion simulators/zombie-survival/lib/pathfinder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export function pathfinder(
}
visited.add(positionKey);

if (player?.getPosition().x === x && player?.getPosition().y === y) {
if (player.getPosition().x === x && player.getPosition().y === y) {
return path;
}

Expand Down

0 comments on commit 91d931f

Please sign in to comment.