73 lines
2.9 KiB
TypeScript
73 lines
2.9 KiB
TypeScript
// Copyright (c) 2025-2026 Probo Inc <hello@probo.com>.
|
|
//
|
|
// Permission to use, copy, modify, and/or distribute this software for any
|
|
// purpose with or without fee is hereby granted, provided that the above
|
|
// copyright notice and this permission notice appear in all copies.
|
|
//
|
|
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
// AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
// PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
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 { Outlet } from "react-router";
|
|
|
|
import { OrganizationSidebar } from "#/components/OrganizationSidebar";
|
|
import { useRequestAccessCallback } from "#/hooks/useRequestAccessCallback";
|
|
import { TrustCenterProvider } from "#/providers/TrustCenterProvider";
|
|
import type { TrustGraphCurrentQuery } from "#/queries/__generated__/TrustGraphCurrentQuery.graphql";
|
|
import { currentTrustGraphQuery } from "#/queries/TrustGraph";
|
|
|
|
type Props = {
|
|
queryRef: PreloadedQuery<TrustGraphCurrentQuery>;
|
|
};
|
|
|
|
export function MainLayout(props: Props) {
|
|
const { __ } = useTranslate();
|
|
const data = usePreloadedQuery(currentTrustGraphQuery, props.queryRef);
|
|
const trustCenter = data.currentTrustCenter;
|
|
const isAuthenticated = data.viewer != null;
|
|
|
|
const theme = useSystemTheme();
|
|
|
|
useFavicon(
|
|
theme === "dark"
|
|
? (trustCenter?.darkLogoFileUrl ?? trustCenter?.logoFileUrl)
|
|
: trustCenter?.logoFileUrl,
|
|
);
|
|
useRequestAccessCallback();
|
|
|
|
return (
|
|
<TrustCenterProvider trustCenter={trustCenter}>
|
|
<div className="grid grid-cols-1 max-w-[1280px] mx-4 pt-6 gap-4 lg:mx-auto lg:gap-10 lg:pt-20 lg:grid-cols-[400px_1fr] lg:items-start ">
|
|
<OrganizationSidebar trustCenter={trustCenter} isAuthenticated={isAuthenticated} />
|
|
<main>
|
|
<Tabs className="mb-8">
|
|
<TabLink to="/overview">{__("Overview")}</TabLink>
|
|
<TabLink to="/documents">{__("Documents")}</TabLink>
|
|
{trustCenter.subprocessorInfo.totalCount > 0
|
|
&& <TabLink to="/subprocessors">{__("Subprocessors")}</TabLink>}
|
|
<TabLink to="/updates">{__("Updates")}</TabLink>
|
|
</Tabs>
|
|
<Outlet context={{ trustCenter }} />
|
|
</main>
|
|
</div>
|
|
|
|
<a
|
|
href="https://www.getprobo.com/"
|
|
className="flex gap-2 text-sm font-medium text-txt-tertiary items-center w-max mx-auto my-10"
|
|
>
|
|
{__("Powered by")}
|
|
{" "}
|
|
<Logo withPicto className="h-6" />
|
|
</a>
|
|
</TrustCenterProvider>
|
|
);
|
|
}
|