Skip to content

Commit

Permalink
refactor(explorer): move explorer routes into its own route group (#3100
Browse files Browse the repository at this point in the history
)
  • Loading branch information
holic authored Sep 2, 2024
1 parent a34a484 commit c716669
Show file tree
Hide file tree
Showing 20 changed files with 45 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { ReactNode } from "react";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { createConfig, http } from "@wagmi/core";
import { localhost } from "@wagmi/core/chains";
import { AppStoreProvider } from "../store";
import { AppStoreProvider } from "../../store";

const queryClient = new QueryClient();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import { ExternalLink, RefreshCwIcon } from "lucide-react";
import Link from "next/link";
import { Button } from "../components/ui/Button";
import { useWorldUrl } from "../hooks/useWorldUrl";
import { Button } from "../../components/ui/Button";
import { useWorldUrl } from "../../hooks/useWorldUrl";

type Props = {
error: Error & { digest?: string };
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import { ExternalLink } from "lucide-react";
import Link from "next/link";
import { Button } from "../components/ui/Button";
import { useWorldUrl } from "../hooks/useWorldUrl";
import { Button } from "../../components/ui/Button";
import { useWorldUrl } from "../../hooks/useWorldUrl";

export default function NotFound() {
const getUrl = useWorldUrl();
Expand Down
5 changes: 5 additions & 0 deletions packages/explorer/src/app/(explorer)/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { redirect } from "next/navigation";

export default async function IndexPage() {
redirect("/worlds");
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import { SchemaAbiType } from "@latticexyz/schema-type/internal";
import IBaseWorldAbi from "@latticexyz/world/out/IBaseWorld.sol/IBaseWorld.abi.json";
import { useMutation, useQueryClient } from "@tanstack/react-query";
import { waitForTransactionReceipt, writeContract } from "@wagmi/core";
import { Checkbox } from "../../../../components/ui/Checkbox";
import { ACCOUNT_PRIVATE_KEYS } from "../../../../consts";
import { camelCase, cn } from "../../../../lib/utils";
import { useAppStore } from "../../../../store";
import { Checkbox } from "../../../../../components/ui/Checkbox";
import { ACCOUNT_PRIVATE_KEYS } from "../../../../../consts";
import { camelCase, cn } from "../../../../../lib/utils";
import { useAppStore } from "../../../../../store";
import { TableConfig } from "../../../../api/table/route";
import { wagmiConfig } from "../../../Providers";
import { TableConfig } from "../../../api/table/route";

type Props = {
name: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Lock } from "lucide-react";
import { useParams } from "next/navigation";
import { internalTableNames } from "@latticexyz/store-sync/sqlite";
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../../../../components/ui/Select";
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../../../../../components/ui/Select";

type Props = {
value: string | undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ import {
getSortedRowModel,
useReactTable,
} from "@tanstack/react-table";
import { Button } from "../../../../components/ui/Button";
import { Checkbox } from "../../../../components/ui/Checkbox";
import { Input } from "../../../../components/ui/Input";
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "../../../../components/ui/Table";
import { Button } from "../../../../../components/ui/Button";
import { Checkbox } from "../../../../../components/ui/Checkbox";
import { Input } from "../../../../../components/ui/Input";
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "../../../../../components/ui/Table";
import { bufferToBigInt } from "../utils/bufferToBigInt";
import { EditableTableCell } from "./EditableTableCell";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
import { Coins, Eye, Send } from "lucide-react";
import { AbiFunction } from "viem";
import { useDeferredValue, useState } from "react";
import { Input } from "../../../../components/ui/Input";
import { Separator } from "../../../../components/ui/Separator";
import { Skeleton } from "../../../../components/ui/Skeleton";
import { useHashState } from "../../../../hooks/useHashState";
import { cn } from "../../../../lib/utils";
import { useAbiQuery } from "../../../../queries/useAbiQuery";
import { Input } from "../../../../../components/ui/Input";
import { Separator } from "../../../../../components/ui/Separator";
import { Skeleton } from "../../../../../components/ui/Skeleton";
import { useHashState } from "../../../../../hooks/useHashState";
import { cn } from "../../../../../lib/utils";
import { useAbiQuery } from "../../../../../queries/useAbiQuery";
import { FunctionField } from "./FunctionField";

export function Form() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import { z } from "zod";
import { useState } from "react";
import { useForm } from "react-hook-form";
import { zodResolver } from "@hookform/resolvers/zod";
import { Button } from "../../../../components/ui/Button";
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "../../../../components/ui/Form";
import { Input } from "../../../../components/ui/Input";
import { Separator } from "../../../../components/ui/Separator";
import { Button } from "../../../../../components/ui/Button";
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "../../../../../components/ui/Form";
import { Input } from "../../../../../components/ui/Input";
import { Separator } from "../../../../../components/ui/Separator";
import { useContractMutation } from "./useContractMutation";

export enum FunctionType {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { privateKeyToAccount } from "viem/accounts";
import { useChainId } from "wagmi";
import { useMutation, useQueryClient } from "@tanstack/react-query";
import { readContract, waitForTransactionReceipt, writeContract } from "@wagmi/core";
import { ACCOUNT_PRIVATE_KEYS } from "../../../../consts";
import { useAppStore } from "../../../../store";
import { ACCOUNT_PRIVATE_KEYS } from "../../../../../consts";
import { useAppStore } from "../../../../../store";
import { wagmiConfig } from "../../../Providers";
import { FunctionType } from "./FunctionField";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client";

import { Navigation } from "../../../components/Navigation";
import { Navigation } from "../../../../components/Navigation";

export default function WorldLayout({ children }: { children: React.ReactNode }) {
return (
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { redirect } from "next/navigation";

export default async function WorldPage({ params }: { params: { worldAddress: string } }) {
return redirect(`/worlds/${params.worldAddress}/explorer`);
}
7 changes: 7 additions & 0 deletions packages/explorer/src/app/(explorer)/worlds/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { notFound, redirect } from "next/navigation";

export default async function WorldsPage() {
const worldAddress = process.env.WORLD_ADDRESS;
if (worldAddress) return redirect(`/worlds/${worldAddress}`);
return notFound();
}
16 changes: 0 additions & 16 deletions packages/explorer/src/middleware.ts

This file was deleted.

0 comments on commit c716669

Please sign in to comment.