diff --git a/app/(landing)/organizations/[id]/settings/page.tsx b/app/(landing)/organizations/[id]/settings/page.tsx index b37c5143c..e384fa4ae 100644 --- a/app/(landing)/organizations/[id]/settings/page.tsx +++ b/app/(landing)/organizations/[id]/settings/page.tsx @@ -2,25 +2,23 @@ import { useParams } from 'next/navigation'; import OrganizationSettings from '@/components/organization/OrganizationSettings'; +import { useEffect } from 'react'; +import { useOrganization } from '@/lib/providers'; export default function OrganizationSettingsPage() { const params = useParams(); const organizationId = params.id as string; + const { setActiveOrg } = useOrganization(); - const mockOrgData = { - name: 'Boundless', - logo: '/tech-company-logo.jpg', - tagline: 'Building the future of technology', - about: 'We are a community of innovators...', - }; - + useEffect(() => { + if (organizationId) { + setActiveOrg(organizationId); + } + }, [organizationId, setActiveOrg]); return (
- +
); diff --git a/app/(landing)/organizations/new/page.tsx b/app/(landing)/organizations/new/page.tsx index 8f9288514..83f6c10a5 100644 --- a/app/(landing)/organizations/new/page.tsx +++ b/app/(landing)/organizations/new/page.tsx @@ -4,13 +4,8 @@ import OrganizationSettings from '@/components/organization/OrganizationSettings export default function NewOrganizationPage() { return ( - +
+ +
); } diff --git a/components/auth/SignupForm.tsx b/components/auth/SignupForm.tsx index 078126bed..5a0988839 100644 --- a/components/auth/SignupForm.tsx +++ b/components/auth/SignupForm.tsx @@ -280,7 +280,7 @@ const SignupForm = ({ onLoadingChange, invitation }: SignupFormProps) => { diff --git a/components/organization/OrganizationHeader.tsx b/components/organization/OrganizationHeader.tsx index e695370d9..4e0701de3 100644 --- a/components/organization/OrganizationHeader.tsx +++ b/components/organization/OrganizationHeader.tsx @@ -20,10 +20,15 @@ export default function OrganizationHeader() { const { isLoading, user } = useAuthStatus(); const { logout } = useAuthActions(); const pathname = usePathname(); - const isOnOrganizationsPage = pathname === '/dashboard/organizations'; + const isOnOrganizationsPage = pathname === '/organizations'; const { organizations, activeOrg, setActiveOrg } = useOrganization(); + + // Show organization selector on org pages, but NOT on /organizations/new const showOrgSelector = - pathname !== '/organizations' && pathname.startsWith('/organizations'); + pathname !== '/organizations' && + pathname !== '/organizations/new' && + pathname.startsWith('/organizations') && + organizations.length > 0; return (
@@ -44,7 +49,17 @@ export default function OrganizationHeader() { - {showOrgSelector && organizations && organizations.length > 0 && ( + {/* Show title for new organization page */} + {pathname === '/organizations/new' && ( +
+ + / Create New Organization + +
+ )} + + {/* Show organization selector on other org pages */} + {showOrgSelector && (
- {/* Hamburger Menu - Visible only on medium screens and below */} - -
+ {!isCreating && ( + <> + +
+ + )}
@@ -68,24 +74,28 @@ export default function OrganizationSettings({ > Profile - - Links - - - Members - - - Transfer Ownership - + {!isCreating && ( + <> + + Links + + + Members + + + Transfer Ownership + + + )}
@@ -95,28 +105,39 @@ export default function OrganizationSettings({
- + - - - + {!isCreating && ( + <> + + + - - - + + + - - - + + + + + )}
- + {!isCreating && ( + + )}
); } diff --git a/components/organization/cards/OrganizationSelector.tsx b/components/organization/cards/OrganizationSelector.tsx index fcfc6be70..f3dfcbfcf 100644 --- a/components/organization/cards/OrganizationSelector.tsx +++ b/components/organization/cards/OrganizationSelector.tsx @@ -64,16 +64,24 @@ export default function OrganizationSelector({ const currentPath = pathname; const orgId = org._id; - if (currentPath.startsWith('/organizations/')) { - const pathAfterOrgs = currentPath.replace('/organizations/', ''); + // Don't navigate if we're on the /organizations/new page + if (currentPath === '/organizations/new') { + return; + } - if (pathAfterOrgs.match(/^[a-f0-9]{24}/)) { - const newPath = currentPath.replace( - /^\/organizations\/[a-f0-9]{24}/, - `/organizations/${orgId}` - ); + if (currentPath.startsWith('/organizations/')) { + const pathSegments = currentPath.split('/').filter(Boolean); + + // Check if second segment is an org ID (MongoDB ObjectId pattern or UUID) + if (pathSegments[1] && pathSegments[1].match(/^[a-f0-9]{24}$/i)) { + // Replace the org ID in the path + const pathAfterOrgId = pathSegments.slice(2).join('/'); + const newPath = pathAfterOrgId + ? `/organizations/${orgId}/${pathAfterOrgId}` + : `/organizations/${orgId}`; router.push(newPath); } else { + // If no org ID in path, just navigate to the org router.push(`/organizations/${orgId}`); } } else if (currentPath === '/organizations') { @@ -108,7 +116,7 @@ export default function OrganizationSelector({