this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add ability to log out

modamo-gh 541c4a87 eab7b7c0

+64 -14
app.db-shm

This is a binary file and will not be displayed.

app.db-wal

This is a binary file and will not be displayed.

+1 -1
app/components/Footer/index.tsx
··· 5 5 6 6 const Footer = () => { 7 7 return ( 8 - <div className="gap-2 grid grid-cols-3 p-2"> 8 + <div className="gap-2 grid grid-cols-3"> 9 9 <ExternalLink 10 10 href="https://aturi.to/did:plc:rapcmhxajpxqgvx5mmza6ubh" 11 11 Icon={FaAt}
+29 -10
app/components/Header/components/User.tsx
··· 2 2 3 3 import Image from "next/image"; 4 4 import Link from "next/link"; 5 + import { useRouter } from "next/navigation"; 5 6 import { useEffect, useRef, useState } from "react"; 6 7 import { RxAvatar } from "react-icons/rx"; 7 8 8 9 const User = ({ avi }: { avi: string }) => { 9 10 const ref = useRef<HTMLDivElement | null>(null); 11 + const router = useRouter(); 10 12 const [showSettings, setShowSettings] = useState(false); 11 13 12 14 useEffect(() => { ··· 24 26 }, []); 25 27 26 28 return ( 27 - <div className="flex-1"> 29 + <div 30 + className="flex-1" 31 + onClick={() => setShowSettings((s) => !s)} 32 + > 28 33 {avi ? ( 29 34 <Image 30 35 alt={""} 31 - className="rounded-full" 36 + className="hover:cursor-pointer rounded-full" 32 37 height={48} 33 38 src={avi} 34 39 width={48} ··· 36 41 ) : ( 37 42 <RxAvatar 38 43 className="hover:cursor-pointer text-[#FF6A00]" 39 - onClick={() => setShowSettings((s) => !s)} 40 44 size={48} 41 45 /> 42 46 )} 43 47 {showSettings && ( 44 48 <div 45 - className="absolute bg-[#30255C] flex h-24 items-center justify-center mt-2 right-0 rounded-lg top-full w-full" 49 + className="absolute bg-[#30255C] border-2 flex h-24 items-center justify-center mt-2 right-0 rounded-lg top-full w-full" 46 50 ref={ref} 47 51 > 48 - <Link 49 - className="hover:underline text-xl" 50 - href="/login" 51 - > 52 - Log In 53 - </Link> 52 + {!avi ? ( 53 + <Link 54 + className="hover:underline text-xl" 55 + href={"/login"} 56 + > 57 + Log In 58 + </Link> 59 + ) : ( 60 + <button 61 + className="hover:underline text-xl" 62 + onClick={async () => { 63 + await fetch("/oauth/logout", { 64 + method: "POST" 65 + }); 66 + 67 + router.replace("/") 68 + }} 69 + > 70 + Log Out 71 + </button> 72 + )} 54 73 </div> 55 74 )} 56 75 </div>
+1 -1
app/components/Header/index.tsx
··· 18 18 } 19 19 20 20 return ( 21 - <div className="flex p-2 justify-between"> 21 + <div className="flex justify-between"> 22 22 <div className="bg-[#30255C] flex flex-col gap-2 justify-center px-4 rounded-lg"> 23 23 <h1 className="semibold text-3xl w-fit">Bmore Today</h1> 24 24 <h2 className="text-lg">Go Outside and B(e)More</h2>
+28
app/oauth/logout/route.ts
··· 1 + import { getOAuthClient } from "@/app/lib/auth/client"; 2 + import { cookies } from "next/headers"; 3 + import { NextResponse } from "next/server"; 4 + 5 + export const POST = async () => { 6 + try { 7 + const cookieStore = await cookies(); 8 + const did = cookieStore.get("did")?.value; 9 + 10 + if (did) { 11 + const client = await getOAuthClient(); 12 + 13 + await client.revoke(did); 14 + } 15 + 16 + cookieStore.delete("did"); 17 + 18 + return NextResponse.json({ success: true }); 19 + } catch (error) { 20 + console.error("Logout error:", error); 21 + 22 + const cookieStore = await cookies(); 23 + 24 + cookieStore.delete("did"); 25 + 26 + return NextResponse.json({ success: true }); 27 + } 28 + };
+5 -2
app/page.tsx
··· 3 3 4 4 const App = () => { 5 5 return ( 6 - <div className="bg-[#1C1A29] h-screen grid grid-rows-10"> 6 + <div className="bg-[#1C1A29] h-screen gap-2 grid grid-rows-10 p-2"> 7 7 <Header /> 8 - <div className="row-span-8"></div> 8 + <div className="gap-2 grid grid-cols-4 grid-rows-6 row-span-8"> 9 + <div className="bg-[#30255C] col-span-1 rounded-lg row-span-6"></div> 10 + <div className="bg-[#30255C] col-span-3 rounded-lg row-span-6"></div> 11 + </div> 9 12 <Footer /> 10 13 </div> 11 14 );