()
| 3 | import { Card, CardContent, CardDescription, CardHeader, CardTitle, Button } from "@repo/ui"; |
| 4 | |
| 5 | const RedirectToLoginCard = () => { |
| 6 | const router = useRouter(); |
| 7 | const pathname = usePathname(); |
| 8 | const redirectToLogin = () => { |
| 9 | localStorage.setItem("loginRedirectUrl", pathname); |
| 10 | router.push("/auth"); |
| 11 | }; |
| 12 | return ( |
| 13 | <Card className="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 shadow-lg min-w-[340px]"> |
| 14 | <CardHeader> |
| 15 | <CardTitle>Login to access the content</CardTitle> |
| 16 | <CardDescription>You'll be redirected back to this page after login</CardDescription> |
| 17 | </CardHeader> |
| 18 | <CardContent className="px-4"> |
| 19 | <Button className="w-full mt-2" onClick={redirectToLogin}> |
| 20 | Go to Login Page |
| 21 | </Button> |
| 22 | </CardContent> |
| 23 | </Card> |
| 24 | ); |
| 25 | }; |
| 26 | |
| 27 | export default RedirectToLoginCard; |
nothing calls this directly
no outgoing calls
no test coverage detected