fix: router.push

This commit is contained in:
hamster1963 2024-10-19 17:48:47 +08:00
parent 3e6e1f1e8a
commit 6be6e30fd7

View File

@ -36,35 +36,32 @@ export default function ServerCard({
"flex flex-col items-center justify-start gap-3 p-3 md:px-5 lg:flex-row" "flex flex-col items-center justify-start gap-3 p-3 md:px-5 lg:flex-row"
} }
> >
<Popover> <section
<PopoverTrigger asChild> className="grid items-center gap-2 lg:w-28 cursor-pointer"
<section style={{ gridTemplateColumns: "auto auto 1fr" }}
className="grid items-center gap-2 lg:w-28" onClick={() => {
style={{ gridTemplateColumns: "auto auto 1fr" }} router.push(`/${locale}/detail/${id}`);
> }}
<span className="h-2 w-2 shrink-0 rounded-full bg-green-500 self-center"></span> >
<div <span className="h-2 w-2 shrink-0 rounded-full bg-green-500 self-center"></span>
className={cn( <div
"flex items-center justify-center", className={cn(
showFlag ? "min-w-[17px]" : "min-w-0", "flex items-center justify-center",
)} showFlag ? "min-w-[17px]" : "min-w-0",
> )}
{showFlag ? <ServerFlag country_code={country_code} /> : null} >
</div> {showFlag ? <ServerFlag country_code={country_code} /> : null}
<p </div>
className={cn( <p
"break-all font-bold tracking-tight", className={cn(
showFlag ? "text-xs" : "text-sm", "break-all font-bold tracking-tight",
)} showFlag ? "text-xs" : "text-sm",
> )}
{name} >
</p> {name}
</section> </p>
</PopoverTrigger>
<PopoverContent side="top"> </section>
<ServerCardPopover status={props.status} host={props.host} />
</PopoverContent>
</Popover>
<div <div
onClick={() => { onClick={() => {
router.push(`/${locale}/network/${id}`); router.push(`/${locale}/network/${id}`);