Fix: Polish projects menu
This commit is contained in:
@@ -71,9 +71,43 @@ export type ProjectItem = {
|
||||
id: string;
|
||||
name: string;
|
||||
description: string;
|
||||
groupLabel?: string;
|
||||
parentLabel?: string;
|
||||
meta?: string;
|
||||
active?: boolean;
|
||||
};
|
||||
|
||||
export type ProjectMenuTarget =
|
||||
| {
|
||||
id: string;
|
||||
label: string;
|
||||
kind: "surface";
|
||||
}
|
||||
| {
|
||||
id: string;
|
||||
label: string;
|
||||
kind: "folder";
|
||||
}
|
||||
| {
|
||||
id: string;
|
||||
label: string;
|
||||
kind: "project";
|
||||
};
|
||||
|
||||
export type ProjectContextMenuAction = {
|
||||
id: string;
|
||||
label: string;
|
||||
tone?: "default" | "danger";
|
||||
shortcut?: WorkspaceContextMenuShortcut;
|
||||
children?: readonly ProjectContextMenuAction[];
|
||||
};
|
||||
|
||||
export type ProjectContextMenuSection = {
|
||||
id: string;
|
||||
label?: string;
|
||||
items: readonly ProjectContextMenuAction[];
|
||||
};
|
||||
|
||||
export type SidebarItem = {
|
||||
id: string;
|
||||
label: string;
|
||||
@@ -364,9 +398,31 @@ export const activeDepartment: ActiveDepartment = {
|
||||
};
|
||||
|
||||
export const projectItems: readonly ProjectItem[] = [
|
||||
{ id: "general", name: "General", description: "Default shared project", active: true },
|
||||
{ id: "operations", name: "Operations", description: "Cross-team planning and delivery" },
|
||||
{ id: "hiring", name: "Hiring", description: "Candidate pipeline and interview loops" },
|
||||
{
|
||||
id: "general",
|
||||
name: "General",
|
||||
description: "Default shared project",
|
||||
groupLabel: "Shared space",
|
||||
parentLabel: "Workspace home",
|
||||
meta: "1 workspace",
|
||||
active: true,
|
||||
},
|
||||
{
|
||||
id: "operations",
|
||||
name: "Operations",
|
||||
description: "Cross-team planning and delivery",
|
||||
groupLabel: "Team folders",
|
||||
parentLabel: "Shared Services",
|
||||
meta: "2 workspaces",
|
||||
},
|
||||
{
|
||||
id: "hiring",
|
||||
name: "Hiring",
|
||||
description: "Candidate pipeline and interview loops",
|
||||
groupLabel: "Team folders",
|
||||
parentLabel: "People Ops",
|
||||
meta: "1 workspace",
|
||||
},
|
||||
] as const;
|
||||
|
||||
export const departmentItems: readonly DepartmentItem[] = [
|
||||
@@ -533,6 +589,69 @@ export const getWorkspaceContextMenuSections = (
|
||||
}
|
||||
};
|
||||
|
||||
const getProjectCreateActions = (): readonly ProjectContextMenuAction[] =>
|
||||
[
|
||||
{ id: "new-project", label: "New project" },
|
||||
{ id: "new-folder", label: "New folder" },
|
||||
] as const;
|
||||
|
||||
export const createProjectSurfaceTarget = (label = "Projects"): ProjectMenuTarget => ({
|
||||
id: "project-surface",
|
||||
label,
|
||||
kind: "surface",
|
||||
});
|
||||
|
||||
export const createProjectFolderTarget = (id: string, label: string): ProjectMenuTarget => ({
|
||||
id,
|
||||
label,
|
||||
kind: "folder",
|
||||
});
|
||||
|
||||
export const createProjectTarget = (project: ProjectItem): ProjectMenuTarget => ({
|
||||
id: project.id,
|
||||
label: project.name,
|
||||
kind: "project",
|
||||
});
|
||||
|
||||
export const getProjectContextMenuEyebrow = (target: ProjectMenuTarget): string => {
|
||||
switch (target.kind) {
|
||||
case "surface":
|
||||
return "Projects";
|
||||
case "folder":
|
||||
return "Folder";
|
||||
case "project":
|
||||
return "Project";
|
||||
}
|
||||
};
|
||||
|
||||
export const getProjectContextMenuSections = (target: ProjectMenuTarget): readonly ProjectContextMenuSection[] => {
|
||||
const createActions = getProjectCreateActions();
|
||||
|
||||
switch (target.kind) {
|
||||
case "surface":
|
||||
return [
|
||||
{
|
||||
id: "create",
|
||||
items: createActions,
|
||||
},
|
||||
] as const;
|
||||
case "folder":
|
||||
return [
|
||||
{
|
||||
id: "create",
|
||||
items: createActions,
|
||||
},
|
||||
] as const;
|
||||
case "project":
|
||||
return [
|
||||
{
|
||||
id: "create",
|
||||
items: createActions,
|
||||
},
|
||||
] as const;
|
||||
}
|
||||
};
|
||||
|
||||
export const topBarActions: readonly TopBarAction[] = [
|
||||
{ id: "search", label: "Search", icon: Search },
|
||||
] as const;
|
||||
|
||||
Reference in New Issue
Block a user