Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

fix: align project creation access and collapse optional properties (#10270)

Bohan Jiang08b512475665
diff --git a/packages/views/common/pill-button.tsx b/packages/views/common/pill-button.tsx
index 02782da763..9909d3435e 100644
--- a/packages/views/common/pill-button.tsx
+++ b/packages/views/common/pill-button.tsx
@@ -31,7 +31,7 @@ export function PillButton({
children,
className,
...props
-}: React.ButtonHTMLAttributes<HTMLButtonElement>) {
+}: React.ComponentPropsWithRef<"button">) {
return (
<button
type="button"
diff --git a/packages/views/modals/create-project.tsx b/packages/views/modals/create-project.tsx
index 11a05b8c70..c792581469 100644
--- a/packages/views/modals/create-project.tsx
+++ b/packages/views/modals/create-project.tsx
@@ -1,7 +1,7 @@
"use client";
import { useState, useRef } from "react";
-import { CalendarClock, CalendarDays, ChevronRight, FolderOpen, GitBranch, Maximize2, Minimize2, MoreHorizontal, Pencil, Search, X as XIcon, UserMinus } from "@multica/ui/icons";
+import { CalendarClock, CalendarDays, ChevronRight, FolderOpen, GitBranch, Maximize2, Minimize2, MoreHorizontal, Pencil, Search, X as XIcon, User, UserMinus } from "@multica/ui/icons";
/**
* GitHub mark — lucide-react v1 dropped brand icons, so we inline the
@@ -174,8 +174,7 @@ export function CreateProjectModal({ onClose }: { onClose: () => void }) {
const [visibility, setVisibility] = useState<ProjectVisibility>(draft.visibility ?? "workspace");
const [memberIds, setMemberIds] = useState<string[]>(draft.memberIds ?? []);
const privateEnabled = useConfigStore((s) => s.featureFlags.private_projects_v1 === true);
- // Dates are collapsed into the ⋯ overflow by default (progressive
- // disclosure, mirroring create-issue); these flip a pill inline + open.
+ // Optional properties stay in the ⋯ menu until selected or opened.
const [startDatePickerOpen, setStartDatePickerOpen] = useState(false);
const [dueDatePickerOpen, setDueDatePickerOpen] = useState(false);
const [iconPickerOpen, setIconPickerOpen] = useState(false);
@@ -333,6 +332,7 @@ export function CreateProjectModal({ onClose }: { onClose: () => void }) {
const [leadOpen, setLeadOpen] = useState(false);
const [leadFilter, setLeadFilter] = useState("");
+ const moreOptionsRef = useRef<HTMLButtonElement>(null);
const leadQuery = leadFilter.toLowerCase();
const filteredMembers = members.filter((m) => m.name.toLowerCase().includes(leadQuery) || matchesPinyin(m.name, leadQuery));
@@ -342,6 +342,8 @@ export function CreateProjectModal({ onClose }: { onClose: () => void }) {
const leadLabel =
leadType && leadId ? getActorName(leadType, leadId) : t(($) => $.create_project.lead);
+ const hasLead = !!(leadType && leadId);
+ const hasSource = sourceMode === "local" ? !!selectedLocalPath : selectedRepos.length > 0;
const createProject = useCreateProject();
@@ -588,12 +590,8 @@ export function CreateProjectModal({ onClose }: { onClose: () => void }) {
</p>
</div>
- {/* Property toolbar — mirrors the create-issue footer: a wrapping pill
- row whose low-frequency fields (start/due date) collapse into a ⋯
- overflow, with the primary action in a separate bar below.
- Repos lives here alongside the property pills for now. Once we
- support more resource types (Linear / Notion / Figma / Slack), pull
- them out into a dedicated Resources strip above this footer. */}
+ {/* Optional properties appear inline once selected; their pickers
+ open from ⋯ with the inline pill as the anchor. */}
<div className="flex items-center gap-1.5 px-4 py-2 shrink-0 flex-wrap">
<DropdownMenu>
<DropdownMenuTrigger
@@ -645,21 +643,26 @@ export function CreateProjectModal({ onClose }: { onClose: () => void }) {
if (!v) setLeadFilter("");
}}
>
- <PopoverTrigger
- render={
- <PillButton>
- {leadType && leadId ? (
- <>
- <ActorAvatar actorType={leadType} actorId={leadId} size="sm" showStatusDot />
- <span className="truncate">{leadLabel}</span>
- </>
- ) : (
- <span className="text-muted-foreground">{t(($) => $.create_project.lead)}</span>
- )}
- </PillButton>
- }
- />
- <PopoverContent align="start" className="w-52 p-0">
+ {(hasLead || leadOpen) && (
+ <PopoverTrigger
+ render={
+ <PillButton>
+ {leadType && leadId ? (
+ <>
+ <ActorAvatar actorType={leadType} actorId={leadId} size="sm" showStatusDot />
+ <span className="truncate">{leadLabel}</span>
+ </>
+ ) : (
+ <>
+ <User className="size-3.5 shrink-0 text-muted-foreground" />
+ <span className="text-muted-foreground">{t(($) => $.create_project.lead)}</span>
+ </>
+ )}
+ </PillButton>
+ }
+ />
+ )}
+ <PopoverContent align="start" className="w-52 p-0" finalFocus={hasLead ? undefined : moreOptionsRef}>
<div className="px-2 py-1.5 border-b">
<input
type="text"
@@ -763,32 +766,34 @@ export function CreateProjectModal({ onClose }: { onClose: () => void }) {
if (!v) setRepoSearch("");
}}
>
- <PopoverTrigger
- render={
- <PillButton>
- {sourceMode === "local" ? (
- <>
- <FolderOpen className="size-3" />
- <span className="max-w-[12rem] truncate">
- {selectedLocalPath
- ? selectedLocalLabel ?? selectedLocalPath
- : t(($) => $.create_project.source_pill_local)}
- </span>
- </>
- ) : (
- <>
- <GithubIcon className="size-3" />
- <span>
- {selectedRepos.length === 0
- ? t(($) => $.create_project.repos_pill)
- : t(($) => $.create_project.repos_pill_count, { count: selectedRepos.length })}
- </span>
- </>
- )}
- </PillButton>
- }
- />
- <PopoverContent side="top" align="start" className="w-72 p-2 space-y-2">
+ {(hasSource || repoPopoverOpen) && (
+ <PopoverTrigger
+ render={
+ <PillButton>
+ {sourceMode === "local" ? (
+ <>
+ <FolderOpen className="size-3" />
+ <span className="max-w-[12rem] truncate">
+ {selectedLocalPath
+ ? selectedLocalLabel ?? selectedLocalPath
+ : t(($) => $.create_project.source_pill_local)}
+ </span>
+ </>
+ ) : (
+ <>
+ <GithubIcon className="size-3" />
+ <span>
+ {selectedRepos.length === 0
+ ? t(($) => $.create_project.repos_pill)
+ : t(($) => $.create_project.repos_pill_count, { count: selectedRepos.length })}
+ </span>
+ </>
+ )}
+ </PillButton>
+ }
+ />
+ )}
+ <PopoverContent side="top" align="start" className="w-72 p-2 space-y-2" finalFocus={hasSource ? undefined : moreOptionsRef}>
{/* Source mode is binary — repo OR local directory, never both.
Local option is desktop-only because a local_directory
resource has to be pinned to a daemon_id, which doesn't
@@ -1102,19 +1107,29 @@ export function CreateProjectModal({ onClose }: { onClose: () => void }) {
</PopoverContent>
</Popover>
- {/* Overflow — always the last child so it stays at the end of the
- wrap flow. Only rendered while a date is still collapsible; when
- both are set there is nothing left to add. */}
- {(!startDate || !dueDate) && (
+ {/* Keep overflow last in the wrap flow while any property is unset. */}
+ {(!hasLead || !hasSource || !startDate || !dueDate) && (
<DropdownMenu>
<DropdownMenuTrigger
render={
- <PillButton aria-label={t(($) => $.create_project.more_options_aria)}>
+ <PillButton ref={moreOptionsRef} aria-label={t(($) => $.create_project.more_options_aria)}>
<MoreHorizontal className="size-3.5" />
</PillButton>
}
/>
<DropdownMenuContent align="start" className="w-auto">
+ {!hasLead && (
+ <DropdownMenuItem onClick={() => setLeadOpen(true)}>
+ <User className="size-3.5" />
+ {t(($) => $.create_project.lead)}
+ </DropdownMenuItem>
+ )}
+ {!hasSource && (
+ <DropdownMenuItem onClick={() => setRepoPopoverOpen(true)}>
+ {sourceMode === "local" ? <FolderOpen className="size-3.5" /> : <GithubIcon className="size-3.5" />}
+ {sourceMode === "local" ? t(($) => $.create_project.source_pill_local) : t(($) => $.create_project.repos_pill)}
+ </DropdownMenuItem>
+ )}
{!dueDate && (
<DropdownMenuItem onClick={() => setDueDatePickerOpen(true)}>
<CalendarDays className="h-3.5 w-3.5" />
diff --git a/packages/views/projects/components/project-access.tsx b/packages/views/projects/components/project-access.tsx
index 2435a56f1b..5211515b0d 100644
--- a/packages/views/projects/components/project-access.tsx
+++ b/packages/views/projects/components/project-access.tsx
@@ -17,6 +17,7 @@ import { Popover, PopoverContent, PopoverTrigger } from "@multica/ui/components/
import { Command, CommandEmpty, CommandInput, CommandItem, CommandList } from "@multica/ui/components/ui/command";
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle } from "@multica/ui/components/ui/alert-dialog";
import { ActorAvatar } from "../../common/actor-avatar";
+import { PillButton } from "../../common/pill-button";
import { useT } from "../../i18n";
const EMPTY_IDS: string[] = [];
@@ -206,7 +207,12 @@ export function ProjectAccessDraftPicker({ visibility, memberIds, leadId, member
const Icon = visibility === "private" ? Lock : Globe;
return (
<Popover>
- <PopoverTrigger render={<Button type="button" variant="outline" size="sm" aria-label={t(($) => $.access.label)}><Icon />{visibility === "private" ? t(($) => $.access.private) : t(($) => $.access.workspace)}</Button>} />
+ <PopoverTrigger render={
+ <PillButton aria-label={t(($) => $.access.label)}>
+ <Icon className="size-3.5 shrink-0 text-muted-foreground" />
+ <span className="truncate">{visibility === "private" ? t(($) => $.access.private) : t(($) => $.access.workspace)}</span>
+ </PillButton>
+ } />
<PopoverContent side="top" align="end" className="max-h-[70dvh] w-96 max-w-[calc(100vw-2rem)] overflow-y-auto">
<AccessFields visibility={visibility} onVisibilityChange={(value) => onChange(value, selected)} members={members} selected={selected} leadId={leadId} userId={userId}
disabled={false} canChangeScope canUsePrivate={enabled} canAdd