All files / src/components SignInRequired.tsx

100% Statements 5/5
100% Branches 2/2
100% Functions 2/2
100% Lines 5/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 312x                       3x 3x 3x               1x                
"use client";
 
import { signIn } from "next-auth/react";
import { useT } from "@/lib/i18n/translate";
 
export function SignInRequired({
  title,
  description,
}: {
  title?: string;
  description: string;
}) {
  const tc = useT("common");
  const tn = useT("nav");
  return (
    <div className="flex flex-col items-center justify-center gap-4 py-16 text-center">
      <p className="text-lg font-semibold text-(--text-primary)">
        {title ?? tc("Sign in required")}
      </p>
      <p className="max-w-md text-sm text-(--text-secondary)">{description}</p>
      <button
        type="button"
        onClick={() => signIn("keycloak")}
        className="rounded-sm bg-(--accent) px-4 py-2 text-sm font-medium text-white hover:opacity-90"
      >
        {tn("Sign in")}
      </button>
    </div>
  );
}