The weeb for the next gen discord boat - Wamellow wamellow.com
bot discord
3
fork

Configure Feed

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

lb add %-toggle

Luna 3efc0b5e d72c12d7

+49 -16
+7 -2
app/leaderboard/[guildId]/layout.tsx
··· 1 + import { Image } from "@nextui-org/react"; 1 2 import { Metadata } from "next"; 2 - import Image from "next/image"; 3 + import { cookies } from "next/headers"; 4 + import NextImage from "next/image"; 3 5 import { HiUsers } from "react-icons/hi"; 4 6 5 7 import ImageReduceMotion from "@/components/image-reduce-motion"; ··· 63 65 const backgroundRgb = decimalToRgb(design?.backgroundColor || 0); 64 66 const intl = new Intl.NumberFormat("en", { notation: "standard" }); 65 67 68 + const cookieStore = cookies(); 69 + const currentCircular = cookieStore.get("lbc")?.value; 70 + 66 71 return ( 67 72 <div className="w-full"> 68 73 ··· 125 130 </div> 126 131 127 132 <div className="md:w-1/4 mt-8 md:mt-0"> 128 - <Side guildId={params.guildId} design={design} pagination={pagination} /> 133 + <Side guildId={params.guildId} design={design} pagination={pagination} currentCircular={currentCircular as undefined} /> 129 134 </div> 130 135 131 136 </div>
+36 -13
app/leaderboard/[guildId]/page.tsx
··· 1 1 import { CircularProgress } from "@nextui-org/react"; 2 + import { cookies } from "next/headers"; 2 3 import { HiHome } from "react-icons/hi"; 3 4 4 5 import ImageReduceMotion from "@/components/image-reduce-motion"; ··· 46 47 47 48 const candisplay = guild?.name && (searchParams.type === "messages" || searchParams.type === "voiceminutes" || searchParams.type === "invites") && pagination[searchParams.type].pages >= parseInt(searchParams.page || "0"); 48 49 49 - const intl = new Intl.NumberFormat("en", { notation: "standard" }); 50 - 51 50 if (!candisplay) { 52 51 return ( 53 52 <ScreenMessage ··· 71 70 ); 72 71 } 73 72 73 + const intl = new Intl.NumberFormat("en", { notation: "standard" }); 74 + const key = "lbc"; 75 + 76 + async function publish() { 77 + "use server"; 78 + 79 + const cookieStore = cookies(); 80 + const currentCircular = cookieStore.get(key)?.value; 81 + 82 + cookies().set(key, currentCircular !== "server" ? "server" : "next"); 83 + } 84 + 85 + const cookieStore = cookies(); 86 + const currentCircular = cookieStore.get(key)?.value; 87 + 74 88 return ( 75 89 <> 76 90 {members.sort((a, b) => (b.activity[searchParams.type] ?? 0) - (a.activity[searchParams.type] ?? 0)).map((member, i) => ··· 102 116 103 117 </div> 104 118 105 - <CircularProgress 106 - className="ml-4" 107 - aria-label="progress" 108 - size="lg" 109 - color="secondary" 110 - classNames={{ 111 - svg: "drop-shadow-md" 112 - }} 113 - value={(member.activity[searchParams.type || "messages"] * 100) / members[i - 1]?.activity[searchParams.type || "messages"] || 100} 114 - showValueLabel={true} 115 - /> 119 + <form action={publish}> 120 + <CircularProgress 121 + as="button" 122 + type="submit" 123 + className="ml-4" 124 + aria-label="progress" 125 + size="lg" 126 + color="secondary" 127 + classNames={{ 128 + svg: "drop-shadow-md" 129 + }} 130 + value={ 131 + currentCircular === "server" 132 + ? (member.activity[searchParams.type || "messages"] * 100) / parseInt(pagination[searchParams.type || "messages"].total.toString()) 133 + : (member.activity[searchParams.type || "messages"] * 100) / members[i - 1]?.activity[searchParams.type || "messages"] 134 + || 100 135 + } 136 + showValueLabel={true} 137 + /> 138 + </form> 116 139 117 140 </div> 118 141 )}
+6 -1
app/leaderboard/[guildId]/side.component.tsx
··· 18 18 export default function Side({ 19 19 guildId, 20 20 design, 21 - pagination 21 + pagination, 22 + currentCircular 22 23 }: { 23 24 guildId: string; 24 25 design: ApiV1GuildsModulesLeaderboardGetResponse; 25 26 pagination: ApiV1GuildsTopmembersPaginationGetResponse; 27 + currentCircular: "next" | "server" | undefined; 26 28 }) { 27 29 const web = webStore((w) => w); 28 30 const router = useRouter(); ··· 81 83 classNames={{ content: "mb-2" }} 82 84 > 83 85 Users are sorted from most to least active for each category, updates once per minute. 86 + <br /> 87 + <br /> 88 + The percentage {currentCircular !== "server" ? "indicates the gap in messages needed to surpass the next user" : "reflects the contribution of server activity from that user"}. 84 89 </AccordionItem> 85 90 86 91 <AccordionItem