A Prediction Market on the AT Protocol

refactor(web/hooks): move hooks here

Ciaran cd988b6e 61334480

+20 -20
+4 -4
src/web/app.tsx
··· 1 - import { useCumulus } from "./providers/useCumulus"; 2 - import { Spinner } from "./components/ui/spinner"; 3 - import Market from "./components/market"; 4 - import { AddMarket } from "./components/add-market"; 1 + import { useCumulus } from "@/web/hooks/useCumulus"; 2 + import { Spinner } from "@/web/components/ui/spinner"; 3 + import Market from "@/web/components/market"; 4 + import { AddMarket } from "@/web/components/add-market"; 5 5 6 6 7 7 export default function App() {
+6 -6
src/web/components/add-market.tsx
··· 1 1 import { ChartLine } from "lucide-react"; 2 - import { DrawerTitle, Drawer, DrawerContent, DrawerHeader, DrawerTrigger, DrawerFooter } from "./ui/drawer"; 3 - import { Button } from "./ui/button"; 4 - import { Input } from "./ui/input"; 2 + import { DrawerTitle, Drawer, DrawerContent, DrawerHeader, DrawerTrigger, DrawerFooter } from "@/web/components/ui/drawer"; 3 + import { Button } from "@/web/components/ui/button"; 4 + import { Input } from "@/web/components/ui/input"; 5 5 import { useState } from "react"; 6 - import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "./ui/select"; 7 - import { Spinner } from "./ui/spinner"; 8 - import { useAuth } from "../providers/useAuth"; 6 + import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/web/components/ui/select"; 7 + import { Spinner } from "@/web/components/ui/spinner"; 8 + import { useAuth } from "@/web/hooks/useAuth"; 9 9 import { createMarket } from "@/core/atproto-api"; 10 10 import { toast } from "sonner"; 11 11 import { useQueryClient } from "@tanstack/react-query";
+4 -4
src/web/components/market.tsx
··· 1 1 import { useMemo, useState } from "react"; 2 - import type { Market } from "../providers/cumulus-provider" 2 + import type { Market } from "@/web/providers/cumulus-provider" 3 3 import { createBet } from "@/core/atproto-api"; 4 4 import type { ResourceUri } from "@atcute/lexicons"; 5 5 import { toast } from "sonner"; 6 - import { useAuth } from "../providers/useAuth"; 7 - import { ChartContainer } from "./ui/chart"; 6 + import { useAuth } from "@/web/hooks/useAuth"; 7 + import { ChartContainer } from "@/web/components/ui/chart"; 8 8 import { Line, LineChart, Tooltip } from "recharts"; 9 - import { Button } from "./ui/button"; 9 + import { Button } from "@/web/components/ui/button"; 10 10 import { useQueryClient } from "@tanstack/react-query"; 11 11 import { CheckCircle2Icon, XCircleIcon } from "lucide-react"; 12 12 import { parseMarket } from "@/core/markets";
+4 -4
src/web/providers/cumulus-provider.tsx
··· 3 3 import { useQuery, type UseQueryResult } from "@tanstack/react-query"; 4 4 import { type CumulusServer } from "@/server/types"; 5 5 import type { InferSelectModel } from "drizzle-orm"; 6 - import * as schema from "../../db/schema" 6 + import type { betsTable, marketsTable, resolutionsTable } from "@/db"; 7 7 8 8 9 - export type Market = InferSelectModel<typeof schema.marketsTable> & { 10 - bets?: InferSelectModel<typeof schema.betsTable>[], 11 - resolution?: InferSelectModel<typeof schema.resolutionsTable>, 9 + export type Market = InferSelectModel<typeof marketsTable> & { 10 + bets?: InferSelectModel<typeof betsTable>[], 11 + resolution?: InferSelectModel<typeof resolutionsTable>, 12 12 } 13 13 14 14 export interface CumulusContext {
+1 -1
src/web/providers/useAuth.tsx src/web/hooks/useAuth.tsx
··· 1 1 import { useContext } from "react"; 2 - import { AuthContext } from "./auth-context-provider"; 2 + import { AuthContext } from "@/web/providers/auth-context-provider"; 3 3 4 4 export function useAuth() { 5 5 const value = useContext(AuthContext);
+1 -1
src/web/providers/useCumulus.tsx src/web/hooks/useCumulus.tsx
··· 1 1 import { useContext } from "react"; 2 - import { CumulusContext } from "./cumulus-provider"; 2 + import { CumulusContext } from "@/web/providers/cumulus-provider"; 3 3 4 4 export function useCumulus() { 5 5 const value = useContext(CumulusContext)