Scrapboard.org client

refactor: move useAuth and use loading in home page

TurtlePaw 56767de3 2988dc3c

+19 -19
+1 -1
src/app/[did]/[uri]/page.tsx
··· 4 4 import { SaveButton } from "@/components/SaveButton"; 5 5 import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"; 6 6 import { Button } from "@/components/ui/button"; 7 - import { useAuth } from "@/lib/useAuth"; 7 + import { useAuth } from "@/lib/hooks/useAuth"; 8 8 import { paramAsString } from "@/lib/utils/params"; 9 9 import { $Typed, AtUri } from "@atproto/api"; 10 10 import { AppBskyEmbedImages, AppBskyFeedPost } from "@atproto/api/dist/client";
+1 -1
src/app/board/[did]/[rkey]/page.tsx
··· 4 4 import { useBoardItemsStore } from "@/lib/stores/boardItems"; 5 5 import { useBoardsStore } from "@/lib/stores/boards"; 6 6 import { useCurrentBoard } from "@/lib/stores/useCurrentBoard"; 7 - import { useAuth } from "@/lib/useAuth"; 7 + import { useAuth } from "@/lib/hooks/useAuth"; 8 8 import { AtUri } from "@atproto/api"; 9 9 import { PostView } from "@atproto/api/dist/client/types/app/bsky/feed/defs"; 10 10 import { useParams } from "next/navigation";
+1 -1
src/app/boards/page.tsx
··· 1 1 "use client"; 2 2 import { useBoardsStore } from "@/lib/stores/boards"; 3 - import { useAuth } from "@/lib/useAuth"; 3 + import { useAuth } from "@/lib/hooks/useAuth"; 4 4 import { $Typed } from "@atproto/api"; 5 5 import { AppBskyEmbedImages } from "@atproto/api/dist/client"; 6 6 import { LoaderCircle } from "lucide-react";
+1 -1
src/app/layout.tsx
··· 3 3 import "./globals.css"; 4 4 import { ThemeProvider } from "next-themes"; 5 5 import { Navbar } from "@/nav/navbar"; 6 - import { AuthProvider } from "@/lib/useAuth"; 6 + import { AuthProvider } from "@/lib/hooks/useAuth"; 7 7 import { ProfileProvider } from "@/lib/useProfile"; 8 8 import { Toaster } from "sonner"; 9 9 import { BoardsProvider } from "@/lib/hooks/useBoards";
+3 -3
src/app/page.tsx
··· 9 9 import { LoaderCircle } from "lucide-react"; 10 10 import { useFeedDefsStore } from "@/lib/stores/feedDefs"; 11 11 import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area"; 12 - import { useAuth } from "@/lib/useAuth"; 12 + import { useAuth } from "@/lib/hooks/useAuth"; 13 13 import { useBoards } from "@/lib/hooks/useBoards"; 14 14 15 15 export default function Home() { ··· 17 17 const feedStore = useFeedStore(); 18 18 const { isLoading } = useFeeds(); 19 19 const { feeds, defaultFeed, setDefaultFeed } = useFeedDefsStore(); 20 - const { session } = useAuth(); 20 + const { session, loading } = useAuth(); 21 21 const sentinelRef = useRef<HTMLDivElement>(null); 22 22 const [feed, setFeed] = useState<"timeline" | string>( 23 23 defaultFeed ?? "timeline" ··· 55 55 ); 56 56 } 57 57 58 - if (isLoading) 58 + if (isLoading || loading) 59 59 return ( 60 60 <div className="flex justify-center py-6 text-sm text-black/70 dark:text-white/70"> 61 61 <LoaderCircle className="animate-spin" />
+1 -1
src/components/EditButton.tsx
··· 7 7 DialogTitle, 8 8 DialogTrigger, 9 9 } from "@/components/ui/dialog"; 10 - import { useAuth } from "@/lib/useAuth"; 10 + import { useAuth } from "@/lib/hooks/useAuth"; 11 11 import { useState } from "react"; 12 12 import { Button } from "./ui/button"; 13 13 import { PostView } from "@atproto/api/dist/client/types/app/bsky/feed/defs";
+1 -1
src/components/Feed.tsx
··· 1 1 "use client"; 2 2 import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"; 3 - import { useAuth } from "@/lib/useAuth"; 3 + import { useAuth } from "@/lib/hooks/useAuth"; 4 4 import { 5 5 AppBskyEmbedImages, 6 6 AppBskyFeedDefs,
+1 -1
src/components/LikeButton.tsx
··· 1 - import { useAuth } from "@/lib/useAuth"; 1 + import { useAuth } from "@/lib/hooks/useAuth"; 2 2 import { Button } from "./ui/button"; 3 3 import { PostView } from "@atproto/api/dist/client/types/app/bsky/feed/defs"; 4 4 import { useState } from "react";
+1 -1
src/components/SaveButton.tsx
··· 7 7 DialogTitle, 8 8 DialogTrigger, 9 9 } from "@/components/ui/dialog"; 10 - import { useAuth } from "@/lib/useAuth"; 10 + import { useAuth } from "@/lib/hooks/useAuth"; 11 11 import { useState } from "react"; 12 12 import { Button } from "./ui/button"; 13 13 import { PostView } from "@atproto/api/dist/client/types/app/bsky/feed/defs";
+1 -1
src/components/UnsaveButton.tsx
··· 8 8 DialogTitle, 9 9 DialogTrigger, 10 10 } from "@/components/ui/dialog"; 11 - import { useAuth } from "@/lib/useAuth"; 11 + import { useAuth } from "@/lib/hooks/useAuth"; 12 12 import { useState } from "react"; 13 13 import { Button } from "./ui/button"; 14 14 import { PostView } from "@atproto/api/dist/client/types/app/bsky/feed/defs";
+1 -1
src/components/ui/login.tsx
··· 1 1 // components/LoginButton.tsx 2 2 "use client"; 3 - import { useAuth } from "@/lib/useAuth"; 3 + import { useAuth } from "@/lib/hooks/useAuth"; 4 4 5 5 export default function LoginButton() { 6 6 const { login, loading, session } = useAuth();
+1 -1
src/lib/hooks/useBoardItems.tsx
··· 1 1 "use client"; 2 2 import { PropsWithChildren, useEffect, useState } from "react"; 3 - import { useAuth } from "@/lib/useAuth"; 3 + import { useAuth } from "@/lib/hooks/useAuth"; 4 4 import { useFeedDefsStore } from "../stores/feedDefs"; 5 5 import { AtUri } from "@atproto/api"; 6 6 import { Board, useBoardsStore } from "../stores/boards";
+1 -1
src/lib/hooks/useBoards.tsx
··· 1 1 "use client"; 2 2 import { PropsWithChildren, useEffect, useState } from "react"; 3 - import { useAuth } from "@/lib/useAuth"; 3 + import { useAuth } from "@/lib/hooks/useAuth"; 4 4 import { useFeedDefsStore } from "../stores/feedDefs"; 5 5 import { AtUri } from "@atproto/api"; 6 6 import { Board, useBoardsStore } from "../stores/boards";
+1 -1
src/lib/hooks/useFeeds.tsx
··· 1 1 import { useEffect, useState } from "react"; 2 - import { useAuth } from "@/lib/useAuth"; 2 + import { useAuth } from "@/lib/hooks/useAuth"; 3 3 import { useFeedDefsStore } from "../stores/feedDefs"; 4 4 import { AtUri } from "@atproto/api"; 5 5
+1 -1
src/lib/hooks/useTimeline.tsx
··· 1 1 // lib/hooks/useFetchTimeline.ts 2 2 import { useEffect, useRef, useCallback, Ref } from "react"; 3 3 import { AppBskyEmbedImages, AtUri } from "@atproto/api"; 4 - import { useAuth } from "@/lib/useAuth"; 4 + import { useAuth } from "@/lib/hooks/useAuth"; 5 5 import { useFeedStore } from "../stores/feeds"; 6 6 import { FeedViewPost } from "@atproto/api/dist/client/types/app/bsky/feed/defs"; 7 7
src/lib/useAuth.tsx src/lib/hooks/useAuth.tsx
+1 -1
src/lib/useProfile.tsx
··· 8 8 ReactNode, 9 9 } from "react"; 10 10 import { AppBskyActorDefs } from "@atproto/api"; 11 - import { useAuth } from "./useAuth"; 11 + import { useAuth } from "./hooks/useAuth"; 12 12 13 13 type Profile = AppBskyActorDefs.ProfileViewDetailed; 14 14
+1 -1
src/nav/navbar.tsx
··· 5 5 import { ModeToggle } from "./ModeToggle"; // for dark mode toggle 6 6 import { LoaderCircle, Menu, X } from "lucide-react"; 7 7 import { useState } from "react"; 8 - import { useAuth } from "@/lib/useAuth"; 8 + import { useAuth } from "@/lib/hooks/useAuth"; 9 9 import { 10 10 Dialog, 11 11 DialogContent,