Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export function PolicyPageEditor({
};

return (
<div className="flex flex-col h-full border p-2">
<div className="flex flex-col h-full border">
<PolicyEditor
content={formattedContent}
onSave={handleSavePolicy}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,35 +10,22 @@ import { TrustPortalSwitch } from "./components/TrustPortalSwitch";
export default async function TrustPortalSettings({
params,
}: {
params: Promise<{ locale: string }>;
params: Promise<{ locale: string; orgId: string }>;
}) {
const { locale } = await params;
const { locale, orgId } = await params;
setStaticParamsLocale(locale);
const t = await getI18n();

const trustPortal = await getTrustPortal();
const trustPortal = await getTrustPortal(orgId);

return (
<div className="mx-auto max-w-7xl">
<TrustPortalSwitch enabled={trustPortal?.enabled ?? false} slug={trustPortal?.slug ?? ""} />
<TrustPortalSwitch enabled={trustPortal?.enabled ?? false} slug={orgId} />
</div>
);
}

export async function generateMetadata({
params,
}: {
params: Promise<{ locale: string }>;
}): Promise<Metadata> {
const { locale } = await params;
setStaticParamsLocale(locale);
const t = await getI18n();

return {
title: "Trust Portal",
};
}
const getTrustPortal = cache(async () => {
const getTrustPortal = cache(async (orgId: string) => {
const session = await auth.api.getSession({
headers: await headers(),
});
Expand All @@ -47,31 +34,34 @@ const getTrustPortal = cache(async () => {
return null;
}

const slug = await db.organization.findUnique({
where: {
id: session.session.activeOrganizationId,
},
select: {
slug: true,
},
});

const trustPortal = await db.trust.findUnique({
where: {
organizationId: session.session.activeOrganizationId,
organizationId: orgId,
status: "published",
},
});

if (!trustPortal) {
return {
enabled: false,
slug: slug?.slug,
};
}

return {
enabled: true,
slug: slug?.slug,
};
});
});

export async function generateMetadata({
params,
}: {
params: Promise<{ locale: string }>;
}): Promise<Metadata> {
const { locale } = await params;
setStaticParamsLocale(locale);
const t = await getI18n();

return {
title: "Trust Portal",
};
}
6 changes: 3 additions & 3 deletions apps/app/src/components/editor/advanced-editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const AdvancedEditor = ({
if (!initialContent) return null;

return (
<div className="relative w-full max-w-screen-lg">
<div className="relative w-full bg-background p-4">
<div className="flex absolute right-5 top-5 z-10 mb-5 gap-2">
<div className="bg-accent px-2 py-1 text-sm text-muted-foreground">
{saveStatus}
Expand All @@ -96,14 +96,14 @@ const AdvancedEditor = ({
immediatelyRender={false}
initialContent={initialContent}
extensions={extensions}
className="relative min-h-[500px] w-full max-w-screen-lg bg-background sm:mb-[calc(20vh)] p-2"
className="relative min-h-[500px] max-h-[500px] w-full bg-bakground p-2 overflow-y-auto overflow-x-hidden"
editorProps={{
handleDOMEvents: {
keydown: (_view, event) =>
handleCommandNavigation(event),
},
attributes: {
class: "prose prose-lg dark:prose-invert prose-headings:font-title font-default focus:outline-none max-w-full",
class: "max-h-[500px] prose prose-lg dark:prose-invert prose-headings:font-title font-default focus:outline-none max-w-full",
},
}}
onUpdate={({ editor }) => {
Expand Down
24 changes: 13 additions & 11 deletions apps/app/src/components/editor/policy-editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ export function PolicyEditor({
Array.isArray(content) && content.length > 0
? content
: [
{
type: "paragraph",
content: [{ type: "text", text: "" }],
},
],
{
type: "paragraph",
content: [{ type: "text", text: "" }],
},
],
};

const handleUpdate = (updatedContent: JSONContent) => {
Expand All @@ -49,11 +49,13 @@ export function PolicyEditor({
};

return (
<AdvancedEditor
initialContent={documentContent}
onUpdate={handleUpdate}
onSave={handleSave}
readOnly={readOnly}
/>
<>
<AdvancedEditor
initialContent={documentContent}
onUpdate={handleUpdate}
onSave={handleSave}
readOnly={readOnly}
/>
</>
);
}
3 changes: 1 addition & 2 deletions apps/app/src/components/editor/selectors/node-selector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ import {
import { EditorBubbleItem, useEditor } from "novel";

import { Button } from "@comp/ui/button";
import { PopoverContent, PopoverTrigger } from "@comp/ui/popover";
import { Popover } from "@radix-ui/react-popover";
import { Popover, PopoverContent, PopoverTrigger } from "@comp/ui/popover";

export type SelectorItem = {
name: string;
Expand Down
79 changes: 66 additions & 13 deletions apps/trust/package.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,79 @@
{
"name": "@comp/trust",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev --turbopack --port 3003",
"dev": "next dev --port 3003",
"build": "next build",
"start": "next start",
"lint": "next lint"
"lint": "next lint",
"typecheck": "tsc --noEmit"
},
"dependencies": {
"react": "^19.1.0",
"react-dom": "^19.1.0",
"next": "15.3.2"
},
"devDependencies": {
"@comp/db": "workspace:*",
"@comp/ui": "workspace:*",
"typescript": "^5.8.3",
"@types/node": "^20.17.46",
"@types/react": "^19.1.3",
"@types/react-dom": "^19.1.3",
"@hookform/resolvers": "^3.9.1",
"@radix-ui/react-accordion": "1.2.2",
"@radix-ui/react-alert-dialog": "1.1.4",
"@radix-ui/react-aspect-ratio": "1.1.1",
"@radix-ui/react-avatar": "1.1.2",
"@radix-ui/react-checkbox": "latest",
"@radix-ui/react-collapsible": "latest",
"@radix-ui/react-context-menu": "2.2.4",
"@radix-ui/react-dialog": "1.1.4",
"@radix-ui/react-dropdown-menu": "2.1.4",
"@radix-ui/react-hover-card": "1.1.4",
"@radix-ui/react-label": "2.1.1",
"@radix-ui/react-menubar": "1.1.4",
"@radix-ui/react-navigation-menu": "1.2.3",
"@radix-ui/react-popover": "1.1.4",
"@radix-ui/react-progress": "1.1.1",
"@radix-ui/react-radio-group": "1.2.2",
"@radix-ui/react-scroll-area": "1.2.2",
"@radix-ui/react-select": "2.1.4",
"@radix-ui/react-separator": "1.1.1",
"@radix-ui/react-slider": "1.2.2",
"@radix-ui/react-slot": "1.1.1",
"@radix-ui/react-switch": "1.1.2",
"@radix-ui/react-tabs": "1.1.2",
"@radix-ui/react-toast": "1.2.4",
"@radix-ui/react-toggle": "1.1.1",
"@radix-ui/react-toggle-group": "1.1.1",
"@radix-ui/react-tooltip": "1.1.6",
"@tanstack/react-virtual": "^3.13.8",
"autoprefixer": "^10.4.21",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"cmdk": "1.0.4",
"date-fns": "4.1.0",
"embla-carousel-react": "8.5.1",
"file-saver": "latest",
"input-otp": "1.4.1",
"jszip": "latest",
"lucide-react": "^0.454.0",
"next": "^15.3.2",
"next-themes": "^0.4.4",
"react": "^19",
"react-day-picker": "8.10.1",
"react-dom": "^19",
"react-resizable-panels": "^2.1.7",
"recharts": "2.15.0",
"sonner": "^1.7.1",
"tailwind-merge": "^2.5.5",
"tailwindcss-animate": "^1.0.7",
"vaul": "^0.9.6",
"zod": "latest"
},
"peerDependencies": {
"react": "^19",
"react-dom": "^19",
"react-hook-form": "^7.56.3"
},
"devDependencies": {
"@types/node": "^22",
"@types/react": "^19",
"@types/react-dom": "^19",
"postcss": "^8.5.3",
"tailwindcss": "^3.4.17"
"tailwindcss": "3",
"typescript": "^5"
}
}
3 changes: 1 addition & 2 deletions apps/trust/src/app/[id]/components/compliance-header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import Image from "next/image"
import { buttonVariants } from "@comp/ui/button"
import type { Organization } from "@comp/db/types"
import Link from "next/link"
import { Globe, ExternalLink, Mail } from "lucide-react"
import { Badge } from "@comp/ui/badge"
import { Globe } from "lucide-react"

interface ComplianceHeaderProps {
organization: Organization
Expand Down
8 changes: 5 additions & 3 deletions apps/trust/src/app/[id]/lib/data.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
"use server";

import { db } from "@comp/db";

export const findOrganization = async (subdomain: string) => {
export const findOrganization = async (id: string) => {
const organization = await db.organization.findFirst({
where: { slug: subdomain },
where: { id: id },
});

const isPublished = await db.trust.findFirst({
const isPublished = await db.trust.findUnique({
where: { organizationId: organization?.id, status: "published" },
});

Expand Down
6 changes: 3 additions & 3 deletions apps/trust/src/app/[id]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { findOrganization, getPublishedControls, getPublishedPolicies } from "./lib/data";
import ComplianceReport from './components/report';

export default async function Page({ params }: { params: Promise<{ subdomain: string }> }) {
const subdomain = (await params).subdomain;
export default async function Page({ params }: { params: Promise<{ id: string }> }) {
const id = (await params).id;

const organization = await findOrganization(subdomain);
const organization = await findOrganization(id);

if (!organization) {
return <div>Organization not found</div>;
Expand Down
37 changes: 0 additions & 37 deletions apps/trust/src/app/global-error.tsx

This file was deleted.

7 changes: 0 additions & 7 deletions apps/trust/src/app/loading.tsx

This file was deleted.

20 changes: 0 additions & 20 deletions apps/trust/src/app/not-found.tsx

This file was deleted.

Loading