feat: refactor sign-in prompts to use SignedOutPanel component

This commit is contained in:
Abhimanyu Saharan
2026-02-08 23:40:11 +05:30
parent 86d93d94fe
commit 840d5a050f
15 changed files with 117 additions and 191 deletions

View File

@@ -5,7 +5,7 @@ export const dynamic = "force-dynamic";
import { useState } from "react";
import { useRouter } from "next/navigation";
import { SignInButton, SignedIn, SignedOut, useAuth } from "@/auth/clerk";
import { SignedIn, SignedOut, useAuth } from "@/auth/clerk";
import { ApiError } from "@/api/mutator";
import {
@@ -18,6 +18,8 @@ import {
useGetMyMembershipApiV1OrganizationsMeMemberGet,
} from "@/api/generated/organizations/organizations";
import type { BoardRead } from "@/api/generated/model";
import { AdminOnlyNotice } from "@/components/auth/AdminOnlyNotice";
import { SignedOutPanel } from "@/components/auth/SignedOutPanel";
import { DashboardSidebar } from "@/components/organisms/DashboardSidebar";
import { DashboardShell } from "@/components/templates/DashboardShell";
import { Button } from "@/components/ui/button";
@@ -170,20 +172,11 @@ export default function NewAgentPage() {
return (
<DashboardShell>
<SignedOut>
<div className="col-span-2 flex min-h-[calc(100vh-64px)] items-center justify-center bg-slate-50 p-10 text-center">
<div className="rounded-xl border border-slate-200 bg-white px-8 py-6 shadow-sm">
<p className="text-sm text-slate-600">
Sign in to create an agent.
</p>
<SignInButton
mode="modal"
forceRedirectUrl="/agents/new"
signUpForceRedirectUrl="/agents/new"
>
<Button className="mt-4">Sign in</Button>
</SignInButton>
</div>
</div>
<SignedOutPanel
message="Sign in to create an agent."
forceRedirectUrl="/agents/new"
signUpForceRedirectUrl="/agents/new"
/>
</SignedOut>
<SignedIn>
<DashboardSidebar />
@@ -201,9 +194,7 @@ export default function NewAgentPage() {
<div className="p-8">
{!isAdmin ? (
<div className="rounded-xl border border-slate-200 bg-white px-6 py-5 text-sm text-slate-600 shadow-sm">
Only organization owners and admins can create agents.
</div>
<AdminOnlyNotice message="Only organization owners and admins can create agents." />
) : (
<form
onSubmit={handleSubmit}