Scrapboard.org client

fix: likes and add oauth spinner

TurtlePaw bedd6088 dd6090cc

+21 -5
+15 -2
src/app/page.tsx
··· 18 18 const [timeline, setTimeline] = useState<AppBskyFeedDefs.FeedViewPost[]>([]); 19 19 const [cursor, setCursor] = useState<string | null>(null); 20 20 const [loading, setLoading] = useState(false); 21 - const { agent } = useAuth(); 21 + const { agent, session } = useAuth(); 22 22 const sentinelRef = useRef<HTMLDivElement>(null); 23 23 24 24 const seenImageUrls = new Set<string>(); ··· 127 127 768: 1, 128 128 }; 129 129 130 + console.log(session); 131 + 132 + if (session == null) { 133 + return ( 134 + <div className="items-center justify-items-center text-center"> 135 + <h1 className="text-lg mb-0.5 font-medium"> 136 + You&apos;re not logged in 137 + </h1> 138 + <p>Log in to see your feeds</p> 139 + </div> 140 + ); 141 + } 142 + 130 143 return ( 131 144 <div className="items-center justify-items-center"> 132 145 <div className="h-5" /> 133 - <main className=""> 146 + <main className="px-5"> 134 147 <Masonry 135 148 breakpointCols={breakpointColumnsObj} 136 149 className="flex -mx-2 w-auto"
+2 -2
src/components/LikeCounter.tsx
··· 47 47 > 48 48 {/* Old number (what we're transitioning FROM) */} 49 49 <div className="flex items-center justify-center h-[1.2em]"> 50 - {String(previousCount)} 50 + {String(direction == "down" ? displayCount : previousCount)} 51 51 </div> 52 52 {/* New number (what we're transitioning TO) */} 53 53 <div className="flex items-center justify-center h-[1.2em]"> 54 - {String(displayCount)} 54 + {String(direction == "up" ? displayCount : previousCount)} 55 55 </div> 56 56 </motion.div> 57 57 </div>
+4 -1
src/nav/navbar.tsx
··· 3 3 import Link from "next/link"; 4 4 import { Button } from "@/components/ui/button"; 5 5 import { ModeToggle } from "./ModeToggle"; // for dark mode toggle 6 - import { Menu, X } from "lucide-react"; 6 + import { LoaderCircle, Menu, X } from "lucide-react"; 7 7 import { useState } from "react"; 8 8 import { useAuth } from "@/lib/useAuth"; 9 9 import { ··· 118 118 function LoginButton() { 119 119 const { login } = useAuth(); 120 120 const [handle, setHandle] = useState(""); 121 + const [isLoading, setLoading] = useState(false); 121 122 return ( 122 123 <Dialog> 123 124 <DialogTrigger> ··· 140 141 <DialogFooter> 141 142 <Button 142 143 onClick={() => { 144 + setLoading(true); 143 145 login(handle); 144 146 }} 145 147 disabled={!handle} 146 148 className="cursor-pointer" 147 149 > 150 + {isLoading && <LoaderCircle className="animate-spin ml-2" />} 148 151 Sign In 149 152 </Button> 150 153 </DialogFooter>