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
4 changes: 2 additions & 2 deletions apps/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"@dnd-kit/utilities": "^3.2.2",
"@dub/analytics": "^0.0.27",
"@dub/better-auth": "^0.0.3",
"@dub/embed-react": "^0.0.15",
"@dub/embed-react": "^0.0.16",
"@hookform/resolvers": "^5.1.1",
"@mendable/firecrawl-js": "^1.24.0",
"@nangohq/frontend": "^0.53.2",
Expand Down Expand Up @@ -57,7 +57,7 @@
"better-auth": "^1.2.8",
"canvas-confetti": "^1.9.3",
"d3": "^7.9.0",
"dub": "^0.63.6",
"dub": "^0.66.1",
"framer-motion": "^12.18.1",
"geist": "^1.3.1",
"lucide-react": "^0.534.0",
Expand Down
4 changes: 4 additions & 0 deletions apps/app/src/app/(app)/[orgId]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ export default async function Layout({
return redirect('/auth/unauthorized');
}

if (member.role === 'employee') {
return redirect('/no-access');
}

// If this org is not accessible on current plan, redirect to upgrade
if (!organization.hasAccess) {
return redirect(`/upgrade/${organization.id}`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

import { Card, CardContent, CardHeader, CardTitle } from '@comp/ui/card';
import { Input } from '@comp/ui/input';
import { Search } from 'lucide-react';
import { ExternalLink, Search } from 'lucide-react';
import Link from 'next/link';
import { useParams } from 'next/navigation';
import type { CSSProperties } from 'react';
import * as React from 'react';

Expand Down Expand Up @@ -47,6 +49,8 @@ export function EmployeeCompletionChart({
trainingVideos,
showAll = false,
}: EmployeeCompletionChartProps) {
const params = useParams();
const orgId = params.orgId as string;
const [searchTerm, setSearchTerm] = React.useState('');
const [displayedItems, setDisplayedItems] = React.useState(showAll ? 20 : 5);
const [isLoading, setIsLoading] = React.useState(false);
Expand Down Expand Up @@ -209,8 +213,19 @@ export function EmployeeCompletionChart({
{sortedStats.map((stat) => (
<div key={stat.id} className="space-y-2">
<div className="flex items-center justify-between text-sm">
<div>
<p className="font-medium">{stat.name}</p>
<div className="flex-1">
<div className="flex items-center gap-2">
<p className="font-medium">{stat.name}</p>
<Link
href={`/${orgId}/people/${stat.id}`}
target="_blank"
rel="noopener noreferrer"
className="text-primary hover:text-primary/80 flex items-center gap-1 text-xs font-medium underline-offset-4 hover:underline"
>
View Profile
<ExternalLink className="h-3 w-3" />
</Link>
</div>
<p className="text-muted-foreground text-xs">{stat.email}</p>
</div>
<span className="text-muted-foreground">
Expand Down
32 changes: 18 additions & 14 deletions apps/app/src/app/(app)/no-access/page.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Header } from '@/components/header';
import { OrganizationSwitcher } from '@/components/organization-switcher';
import { auth } from '@/utils/auth';
import { db } from '@db';
Expand Down Expand Up @@ -31,20 +32,23 @@ export default async function NoAccess() {
});

return (
<div className="bg-foreground/05 flex h-dvh flex-col items-center justify-center gap-4">
<h1 className="text-2xl font-bold">Access Denied</h1>
<div className="flex flex-col text-center">
<p>
<b>Employees</b> don&apos;t have access to app.trycomp.ai, did you mean to go to{' '}
<Link href="https://portal.trycomp.ai" className="text-primary underline">
portal.trycomp.ai
</Link>
?
</p>
<p>Please select another organization or contact your organization administrator.</p>
</div>
<div>
<OrganizationSwitcher organizations={organizations} organization={currentOrg} />
<div className="flex h-dvh flex-col">
<Header organizationId={currentOrg?.id} hideChat={true} />
<div className="bg-foreground/05 flex flex-1 flex-col items-center justify-center gap-4">
<h1 className="text-2xl font-bold">Access Denied</h1>
<div className="flex flex-col text-center">
<p>
<b>Employees</b> don&apos;t have access to app.trycomp.ai, did you mean to go to{' '}
<Link href="https://portal.trycomp.ai" className="text-primary underline">
portal.trycomp.ai
</Link>
?
</p>
<p>Please select another organization or contact your organization administrator.</p>
</div>
<div>
<OrganizationSwitcher organizations={organizations} organization={currentOrg} />
</div>
</div>
</div>
);
Expand Down
4 changes: 0 additions & 4 deletions apps/app/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,6 @@ export default async function RootPage({
},
});

if (member?.role === 'employee') {
return redirect(await buildUrlWithParams('/no-access'));
}

if (!member) {
return redirect(await buildUrlWithParams('/setup'));
}
Expand Down
10 changes: 8 additions & 2 deletions apps/app/src/components/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,20 @@ import { Suspense } from 'react';
import { AssistantButton } from './ai/chat-button';
import { MobileMenu } from './mobile-menu';

export async function Header({ organizationId }: { organizationId?: string }) {
export async function Header({
organizationId,
hideChat = false,
}: {
organizationId?: string;
hideChat?: boolean;
}) {
const { organizations } = await getOrganizations();

return (
<header className="border/40 sticky top-0 z-10 flex items-center justify-between border-b px-4 py-2 backdrop-blur-sm bg-card">
<MobileMenu organizations={organizations} organizationId={organizationId} />

<AssistantButton />
{!hideChat && <AssistantButton />}

<div className="ml-auto flex space-x-2">
<Suspense fallback={<Skeleton className="h-8 w-8 rounded-full" />}>
Expand Down
24 changes: 12 additions & 12 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/db/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"db:generate": "prisma generate",
"db:migrate": "prisma migrate dev",
"db:push": "prisma db push",
"db:seed": "prisma db seed",
"db:seed": "bun prisma/seed/seed.ts",
"db:studio": "prisma studio",
"docker:clean": "docker compose down -v",
"docker:down": "docker compose down",
Expand Down
Loading
Loading