Implement nda check as a directive

Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
Émile Ré
2026-03-03 14:42:17 +04:00
parent 23491a7976
commit 823fc64c37
9 changed files with 427 additions and 245 deletions

View File

@@ -2,14 +2,14 @@ import { useFavicon, useSystemTheme } from "@probo/hooks";
import { useTranslate } from "@probo/i18n";
import { Logo, TabLink, Tabs } from "@probo/ui";
import { type PreloadedQuery, usePreloadedQuery } from "react-relay";
import { Navigate, Outlet } from "react-router";
import { Outlet } from "react-router";
import { OrganizationSidebar } from "#/components/OrganizationSidebar";
import { useRequestAccessCallback } from "#/hooks/useRequestAccessCallback";
import { TrustCenterProvider } from "#/providers/TrustCenterProvider";
import { Viewer } from "#/providers/Viewer";
import { currentTrustGraphQuery } from "#/queries/TrustGraph";
import type { TrustGraphCurrentQuery } from "#/queries/__generated__/TrustGraphCurrentQuery.graphql";
import { currentTrustGraphQuery } from "#/queries/TrustGraph";
type Props = {
queryRef: PreloadedQuery<TrustGraphCurrentQuery>;
@@ -29,16 +29,6 @@ export function MainLayout(props: Props) {
);
useRequestAccessCallback();
const hasPendingNDA
= data.viewer
&& trustCenter.nonDisclosureAgreement
&& trustCenter.nonDisclosureAgreement.viewerSignature
&& trustCenter.nonDisclosureAgreement.viewerSignature.status !== "COMPLETED";
if (hasPendingNDA) {
return <Navigate to="/nda" replace />;
}
return (
<Viewer value={data.viewer}>
<TrustCenterProvider trustCenter={trustCenter}>

View File

@@ -67,7 +67,7 @@ export function ConnectPage(props: {
safeContinueUrl = window.location.origin + continueUrl.pathname + continueUrl.search;
} else {
const pathPrefix = getPathPrefix();
safeContinueUrl = window.location.origin + pathPrefix ? getPathPrefix() : "/";
safeContinueUrl = window.location.origin + (pathPrefix ? getPathPrefix() : "/");
}
useEffect(() => {