Terminal: Auth guard + logout redirects to landing page
Some checks failed
CI / Frontend Lint & Type Check (push) Has been cancelled
CI / Frontend Build (push) Has been cancelled
CI / Backend Lint (push) Has been cancelled
CI / Backend Tests (push) Has been cancelled
CI / Docker Build (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
Deploy / Build & Push Images (push) Has been cancelled
Deploy / Deploy to Server (push) Has been cancelled
Deploy / Notify (push) Has been cancelled

This commit is contained in:
2025-12-13 16:11:41 +01:00
parent 6a063bfe89
commit f4e4595cde
3 changed files with 71 additions and 4 deletions

View File

@ -706,10 +706,10 @@ export default function PortfolioPage() {
</span>
</div>
{valuation.valuation_formula && (
<div className="p-3 bg-foreground/5 rounded-lg">
<p className="text-foreground-muted mb-1">Valuation Formula</p>
<p className="text-foreground font-mono text-xs break-all">{valuation.valuation_formula}</p>
</div>
<div className="p-3 bg-foreground/5 rounded-lg">
<p className="text-foreground-muted mb-1">Valuation Formula</p>
<p className="text-foreground font-mono text-xs break-all">{valuation.valuation_formula}</p>
</div>
)}
<div className="p-3 bg-amber-400/10 border border-amber-400/20 rounded-lg text-xs text-amber-400">
<p>This is an algorithmic estimate based on domain length, TLD, and market patterns. Actual market value may vary.</p>

View File

@ -0,0 +1,63 @@
'use client'
import { useEffect, useState } from 'react'
import { useRouter, usePathname } from 'next/navigation'
import { useStore } from '@/lib/store'
import { Loader2 } from 'lucide-react'
export default function TerminalLayout({
children,
}: {
children: React.ReactNode
}) {
const router = useRouter()
const pathname = usePathname()
const { isAuthenticated, isLoading, checkAuth } = useStore()
const [isChecking, setIsChecking] = useState(true)
useEffect(() => {
const verify = async () => {
await checkAuth()
setIsChecking(false)
}
verify()
}, [checkAuth])
useEffect(() => {
// Once auth check is complete, redirect if not authenticated
if (!isChecking && !isLoading && !isAuthenticated) {
// Store the intended destination for after login
if (typeof window !== 'undefined') {
sessionStorage.setItem('redirectAfterLogin', pathname)
}
router.replace('/login')
}
}, [isChecking, isLoading, isAuthenticated, router, pathname])
// Show loading state while checking auth
if (isChecking || isLoading) {
return (
<div className="min-h-screen bg-[#020202] flex items-center justify-center">
<div className="flex flex-col items-center gap-4">
<Loader2 className="w-8 h-8 text-accent animate-spin" />
<p className="text-white/40 text-sm font-mono">Loading...</p>
</div>
</div>
)
}
// Don't render children if not authenticated (will redirect)
if (!isAuthenticated) {
return (
<div className="min-h-screen bg-[#020202] flex items-center justify-center">
<div className="flex flex-col items-center gap-4">
<Loader2 className="w-8 h-8 text-accent animate-spin" />
<p className="text-white/40 text-sm font-mono">Redirecting to login...</p>
</div>
</div>
)
}
return <>{children}</>
}

View File

@ -113,6 +113,10 @@ export const useStore = create<AppState>((set, get) => ({
domains: [],
subscription: null,
})
// Redirect to landing page
if (typeof window !== 'undefined') {
window.location.href = '/'
}
},
checkAuth: async () => {