feat(dashboard): allow create organizations

This commit is contained in:
Carl-Gerhard Lindesvärd
2026-03-03 11:11:59 +01:00
parent de6ca96628
commit 2377f95b86
2 changed files with 23 additions and 23 deletions

View File

@@ -6,7 +6,7 @@
"dev": "pnpm with-env vite dev --port 3000", "dev": "pnpm with-env vite dev --port 3000",
"start_deprecated": "pnpm with-env node .output/server/index.mjs", "start_deprecated": "pnpm with-env node .output/server/index.mjs",
"preview": "vite preview", "preview": "vite preview",
"deploy": "npx wrangler deploy", "deploy": "pnpm build && npx wrangler deploy",
"cf-typegen": "wrangler types", "cf-typegen": "wrangler types",
"build": "pnpm with-env vite build", "build": "pnpm with-env vite build",
"serve": "vite preview", "serve": "vite preview",

View File

@@ -1,3 +1,12 @@
import type { IServiceOrganization } from '@openpanel/db';
import { Link, useRouter } from '@tanstack/react-router';
import {
Building2Icon,
CheckIcon,
ChevronsUpDownIcon,
PlusIcon,
} from 'lucide-react';
import { useState } from 'react';
import { Button } from '@/components/ui/button'; import { Button } from '@/components/ui/button';
import { import {
DropdownMenu, DropdownMenu,
@@ -10,18 +19,7 @@ import {
DropdownMenuTrigger, DropdownMenuTrigger,
} from '@/components/ui/dropdown-menu'; } from '@/components/ui/dropdown-menu';
import { useAppParams } from '@/hooks/use-app-params'; import { useAppParams } from '@/hooks/use-app-params';
import { useRouter } from '@tanstack/react-router';
import { Link } from '@tanstack/react-router';
import {
Building2Icon,
CheckIcon,
ChevronsUpDownIcon,
PlusIcon,
} from 'lucide-react';
import { useState } from 'react';
import { pushModal } from '@/modals'; import { pushModal } from '@/modals';
import type { IServiceOrganization } from '@openpanel/db';
interface ProjectSelectorProps { interface ProjectSelectorProps {
projects: Array<{ id: string; name: string; organizationId: string }>; projects: Array<{ id: string; name: string; organizationId: string }>;
@@ -69,16 +67,16 @@ export default function ProjectSelector({
}; };
return ( return (
<DropdownMenu open={open} onOpenChange={setOpen}> <DropdownMenu onOpenChange={setOpen} open={open}>
<DropdownMenuTrigger asChild> <DropdownMenuTrigger asChild>
<Button <Button
size={'sm'}
variant="outline"
role="combobox"
aria-expanded={open} aria-expanded={open}
className="flex min-w-0 flex-1 items-center justify-start" className="flex min-w-0 flex-1 items-center justify-start"
role="combobox"
size={'sm'}
variant="outline"
> >
<Building2Icon size={16} className="shrink-0" /> <Building2Icon className="shrink-0" size={16} />
<span className="mx-2 truncate"> <span className="mx-2 truncate">
{projectId {projectId
? projects.find((p) => p.id === projectId)?.name ? projects.find((p) => p.id === projectId)?.name
@@ -108,10 +106,10 @@ export default function ProjectSelector({
{projects.length > 10 && ( {projects.length > 10 && (
<DropdownMenuItem asChild> <DropdownMenuItem asChild>
<Link <Link
to={'/$organizationId'}
params={{ params={{
organizationId, organizationId,
}} }}
to={'/$organizationId'}
> >
All projects All projects
</Link> </Link>
@@ -148,11 +146,13 @@ export default function ProjectSelector({
</DropdownMenuItem> </DropdownMenuItem>
))} ))}
<DropdownMenuSeparator /> <DropdownMenuSeparator />
<DropdownMenuItem disabled> <DropdownMenuItem asChild>
New organization <Link to={'/onboarding/project'}>
<DropdownMenuShortcut> New organization
<PlusIcon size={16} /> <DropdownMenuShortcut>
</DropdownMenuShortcut> <PlusIcon size={16} />
</DropdownMenuShortcut>
</Link>
</DropdownMenuItem> </DropdownMenuItem>
</DropdownMenuGroup> </DropdownMenuGroup>
</> </>