22 lines
711 B
TypeScript
22 lines
711 B
TypeScript
"use client";
|
|
|
|
import dynamic from "next/dynamic";
|
|
import { usePathname } from "next/navigation";
|
|
import { useSession } from "next-auth/react";
|
|
|
|
const FeedbackDialog = dynamic(
|
|
() => import("@/components/canvas/CanvasFeedbackDialog").then((module) => module.CanvasFeedbackDialog),
|
|
{ ssr: false },
|
|
);
|
|
|
|
export function PageFeedback() {
|
|
const pathname = usePathname();
|
|
const { data: session } = useSession();
|
|
|
|
if (!session?.user?.id || session.user.type === "guest" || !pathname) return null;
|
|
if (/^\/canvas\/[0-9a-f-]{36}\/?$/i.test(pathname) || /^\/(?:feedback|login|register)(?:\/|$)/.test(pathname)) {
|
|
return null;
|
|
}
|
|
return <FeedbackDialog key={pathname} pagePath={pathname} floating />;
|
|
}
|