Harden form auth and submission handling

This commit is contained in:
2026-07-09 23:53:40 +07:00 Unverified
parent 2c82d55839
commit 8c0cc4492b
43 changed files with 747 additions and 534 deletions
+12 -17
View File
@@ -1,6 +1,6 @@
"use client";
import { useState, useMemo } from "react";
import { useState } from "react";
import { usePathname } from "next/navigation";
import Image from "next/image";
import { LogOut } from "lucide-react";
@@ -12,7 +12,7 @@ import {
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
import { Button } from "@/components/ui/button";
import { DiscordRole } from "@/app/actions/discord";
import type { DiscordRole } from "@/lib/discord";
export interface DiscordMemberProfile {
id: string;
@@ -60,20 +60,15 @@ export function DropdownMenuAvatar({
const displayName = profile?.globalName || userName;
const username = profile?.username || userName;
const bannerStyle = useMemo(
() => ({
height: 100,
backgroundColor: profile?.accentColor
? toHex(profile.accentColor)
: "hsl(var(--muted))",
backgroundImage: profile?.bannerUrl
? `url(${profile.bannerUrl})`
: "none",
backgroundSize: "cover" as const,
backgroundPosition: "center" as const,
}),
[profile?.accentColor, profile?.bannerUrl]
);
const bannerStyle = {
height: 100,
backgroundColor: profile?.accentColor
? toHex(profile.accentColor)
: "hsl(var(--muted))",
backgroundImage: profile?.bannerUrl ? `url(${profile.bannerUrl})` : "none",
backgroundSize: "cover" as const,
backgroundPosition: "center" as const,
};
return (
<DropdownMenu>
@@ -163,4 +158,4 @@ export function DropdownMenuAvatar({
</DropdownMenuContent>
</DropdownMenu>
);
}
}