Skip to content

Commit 3fa7456

Browse files
authored
Merge pull request #1406 from trycompai/main
[comp] Production Deploy
2 parents 0988081 + 5ff10ee commit 3fa7456

File tree

6 files changed

+14
-32
lines changed

6 files changed

+14
-32
lines changed

.github/workflows/auto-pr-to-main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ on:
1616
- COMP-*
1717
- cursor/*
1818
- codex/*
19+
- chas/*
1920
jobs:
2021
create-pull-request:
2122
runs-on: warp-ubuntu-latest-arm64-4x

apps/app/src/app/(app)/[orgId]/frameworks/page.tsx

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,23 @@ export async function generateMetadata() {
1515
};
1616
}
1717

18-
export default async function DashboardPage() {
18+
export default async function DashboardPage({ params }: { params: Promise<{ orgId: string }> }) {
19+
const { orgId: organizationId } = await params;
20+
1921
const session = await auth.api.getSession({
2022
headers: await headers(),
2123
});
2224

23-
const organizationId = session?.session.activeOrganizationId;
24-
25-
if (!organizationId) {
26-
redirect('/');
27-
}
28-
2925
const org = await db.organization.findUnique({
3026
where: { id: organizationId },
3127
select: { onboardingCompleted: true },
3228
});
29+
3330
if (org && org.onboardingCompleted === false) {
3431
redirect(`/onboarding/${organizationId}`);
3532
}
3633

37-
// Fetch current user's member information
38-
const currentMember = await db.member.findFirst({
34+
const member = await db.member.findFirst({
3935
where: {
4036
userId: session.user.id,
4137
organizationId,
@@ -69,7 +65,7 @@ export default async function DashboardPage() {
6965
organizationId={organizationId}
7066
publishedPoliciesScore={publishedPoliciesScore}
7167
doneTasksScore={doneTasksScore}
72-
currentMember={currentMember}
68+
currentMember={member}
7369
/>
7470
);
7571
}

apps/app/src/app/(app)/[orgId]/layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export default async function Layout({
8787
<SidebarProvider initialIsCollapsed={isCollapsed}>
8888
<AnimatedLayout sidebar={<Sidebar organization={organization} />} isCollapsed={isCollapsed}>
8989
{onboarding?.triggerJobId && <OnboardingTracker onboarding={onboarding} />}
90-
<Header />
90+
<Header organizationId={organization.id} />
9191
<DynamicMinHeight>{children}</DynamicMinHeight>
9292
<AssistantSheet />
9393
<Suspense fallback={null}>

apps/app/src/components/header.tsx

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,16 @@
11
import { UserMenu } from '@/components/user-menu';
22
import { getOrganizations } from '@/data/getOrganizations';
3-
import { auth } from '@/utils/auth';
43
import { Skeleton } from '@comp/ui/skeleton';
5-
import { headers } from 'next/headers';
6-
import { redirect } from 'next/navigation';
74
import { Suspense } from 'react';
85
import { AssistantButton } from './ai/chat-button';
96
import { MobileMenu } from './mobile-menu';
107

11-
export async function Header() {
12-
const session = await auth.api.getSession({
13-
headers: await headers(),
14-
});
15-
16-
const currentOrganizationId = session?.session.activeOrganizationId;
17-
18-
if (!currentOrganizationId) {
19-
redirect('/');
20-
}
21-
8+
export async function Header({ organizationId }: { organizationId?: string }) {
229
const { organizations } = await getOrganizations();
2310

2411
return (
2512
<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">
26-
<MobileMenu organizationId={currentOrganizationId} organizations={organizations} />
13+
<MobileMenu organizations={organizations} organizationId={organizationId} />
2714

2815
<AssistantButton />
2916

apps/app/src/components/main-menu.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
'use client';
22

3-
import { env } from '@/env.mjs';
43
import { Badge } from '@comp/ui/badge';
54
import { Button } from '@comp/ui/button';
65
import { cn } from '@comp/ui/cn';
@@ -36,7 +35,7 @@ type MenuItem = {
3635
};
3736

3837
interface ItemProps {
39-
organizationId: string;
38+
organizationId?: string;
4039
item: MenuItem;
4140
isActive: boolean;
4241
disabled: boolean;
@@ -49,7 +48,6 @@ export function MainMenu({ organizationId, isCollapsed = false, onItemClick }: P
4948
const pathname = usePathname();
5049
const [activeStyle, setActiveStyle] = useState({ top: '0px', height: '0px' });
5150
const itemRefs = useRef<(HTMLDivElement | null)[]>([]);
52-
const isDubEnabled = env.NEXT_PUBLIC_IS_DUB_ENABLED === 'true';
5351

5452
const items: MenuItem[] = [
5553
{
@@ -242,7 +240,7 @@ const Item = ({
242240
}: ItemProps) => {
243241
const Icon = item.icon;
244242
const linkDisabled = disabled || item.disabled;
245-
const itemPath = item.path.replace(':organizationId', organizationId);
243+
const itemPath = item.path.replace(':organizationId', organizationId ?? '');
246244

247245
if (linkDisabled) {
248246
return (
@@ -315,7 +313,7 @@ const Item = ({
315313
};
316314

317315
type Props = {
318-
organizationId: string;
316+
organizationId?: string;
319317
isCollapsed?: boolean;
320318
onItemClick?: () => void;
321319
};

apps/app/src/components/mobile-menu.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { OrganizationSwitcher } from './organization-switcher';
1111
interface MobileMenuProps {
1212
organizations: Organization[];
1313
isCollapsed?: boolean;
14-
organizationId: string;
14+
organizationId?: string;
1515
}
1616

1717
export function MobileMenu({ organizationId, organizations }: MobileMenuProps) {

0 commit comments

Comments
 (0)