Skip to content

⭐️⭐️⭐️ Open-source, self-hosted alternative to Linear and Plane. Project management and issue tracking where teams and AI agents work side by side to plan and ship products.

feat(web): create an initiative from the palette or a hotkey (#329)

Croffc38d12196680
diff --git a/apps/web/messages/ar/common.json b/apps/web/messages/ar/common.json
index 92a3e512..0b3a3542 100644
--- a/apps/web/messages/ar/common.json
+++ b/apps/web/messages/ar/common.json
@@ -63,6 +63,9 @@
"issue": {
"new": "مهمة جديدة"
},
+ "initiative": {
+ "new": "مبادرة جديدة"
+ },
"view": {
"kanban": "تخطيط اللوحة",
"table": "تخطيط الجدول",
diff --git a/apps/web/messages/ar/initiatives.json b/apps/web/messages/ar/initiatives.json
index 8d995fde..83b250ec 100644
--- a/apps/web/messages/ar/initiatives.json
+++ b/apps/web/messages/ar/initiatives.json
@@ -6,6 +6,7 @@
"showDescription": "إظهار الوصف",
"noDescription": "لا يوجد وصف.",
"noOwner": "لا يوجد مالك",
+ "startDate": "تاريخ البدء",
"targetDate": "التاريخ المستهدف",
"progress": "التقدّم",
"activity": "النشاط",
@@ -92,9 +93,7 @@
"noTargetDate": "عيّن تاريخًا مستهدفًا لتتبّع الوتيرة."
},
"form": {
- "title": "العنوان",
"titlePlaceholder": "إطلاق الربع الثالث",
- "description": "الوصف",
"descriptionPlaceholder": "المبادرة دي عن إيه؟",
"create": "إنشاء مبادرة",
"creating": "جارٍ الإنشاء…",
diff --git a/apps/web/messages/ar/palette.json b/apps/web/messages/ar/palette.json
index 3d8be493..beb5ca40 100644
--- a/apps/web/messages/ar/palette.json
+++ b/apps/web/messages/ar/palette.json
@@ -5,6 +5,7 @@
"searching": "جارٍ البحث…",
"selectAllIssues": "تحديد كل المهام",
"newIssue": "مهمة جديدة",
+ "newInitiative": "مبادرة جديدة",
"newProject": "مشروع جديد",
"toggleChat": "إظهار محادثة الذكاء الاصطناعي أو إخفاؤها",
"board": "اللوحة",
diff --git a/apps/web/messages/en/common.json b/apps/web/messages/en/common.json
index 18e2c54b..7af47b23 100644
--- a/apps/web/messages/en/common.json
+++ b/apps/web/messages/en/common.json
@@ -63,6 +63,9 @@
"issue": {
"new": "New issue"
},
+ "initiative": {
+ "new": "New initiative"
+ },
"view": {
"kanban": "Board layout",
"table": "Table layout",
diff --git a/apps/web/messages/en/initiatives.json b/apps/web/messages/en/initiatives.json
index f2da1733..7bcfaa4f 100644
--- a/apps/web/messages/en/initiatives.json
+++ b/apps/web/messages/en/initiatives.json
@@ -6,6 +6,7 @@
"showDescription": "Show description",
"noDescription": "No description.",
"noOwner": "No owner",
+ "startDate": "Start date",
"targetDate": "Target date",
"progress": "Progress",
"activity": "Activity",
@@ -92,9 +93,7 @@
"noTargetDate": "Set a target date to track pace."
},
"form": {
- "title": "Title",
"titlePlaceholder": "Q3 Launch",
- "description": "Description",
"descriptionPlaceholder": "What is this initiative about?",
"create": "Create initiative",
"creating": "Creating…",
diff --git a/apps/web/messages/en/palette.json b/apps/web/messages/en/palette.json
index 0b690048..997642ff 100644
--- a/apps/web/messages/en/palette.json
+++ b/apps/web/messages/en/palette.json
@@ -5,6 +5,7 @@
"searching": "Searching…",
"selectAllIssues": "Select all issues",
"newIssue": "New issue",
+ "newInitiative": "New initiative",
"newProject": "New project",
"toggleChat": "Show or hide the AI chat",
"board": "Board",
diff --git a/apps/web/messages/fr/common.json b/apps/web/messages/fr/common.json
index 2fabbd8d..a4f14f6c 100644
--- a/apps/web/messages/fr/common.json
+++ b/apps/web/messages/fr/common.json
@@ -63,6 +63,9 @@
"issue": {
"new": "Nouveau ticket"
},
+ "initiative": {
+ "new": "Nouvelle initiative"
+ },
"view": {
"kanban": "Affichage tableau",
"table": "Affichage liste",
diff --git a/apps/web/messages/fr/initiatives.json b/apps/web/messages/fr/initiatives.json
index 7f1866ee..144e085e 100644
--- a/apps/web/messages/fr/initiatives.json
+++ b/apps/web/messages/fr/initiatives.json
@@ -6,6 +6,7 @@
"showDescription": "Afficher la description",
"noDescription": "Aucune description.",
"noOwner": "Aucun responsable",
+ "startDate": "Date de début",
"targetDate": "Date cible",
"progress": "Avancement",
"activity": "Activité",
@@ -92,9 +93,7 @@
"noTargetDate": "Définissez une date cible pour suivre le rythme."
},
"form": {
- "title": "Titre",
"titlePlaceholder": "Lancement T3",
- "description": "Description",
"descriptionPlaceholder": "De quoi parle cette initiative ?",
"create": "Créer l'initiative",
"creating": "Création…",
diff --git a/apps/web/messages/fr/palette.json b/apps/web/messages/fr/palette.json
index 137c8a35..59a1f6f0 100644
--- a/apps/web/messages/fr/palette.json
+++ b/apps/web/messages/fr/palette.json
@@ -5,6 +5,7 @@
"searching": "Recherche…",
"selectAllIssues": "Sélectionner tous les tickets",
"newIssue": "Nouveau ticket",
+ "newInitiative": "Nouvelle initiative",
"newProject": "Nouveau projet",
"toggleChat": "Afficher ou masquer le chat IA",
"board": "Tableau",
diff --git a/apps/web/messages/ru/common.json b/apps/web/messages/ru/common.json
index d413988c..0ff0fc54 100644
--- a/apps/web/messages/ru/common.json
+++ b/apps/web/messages/ru/common.json
@@ -63,6 +63,9 @@
"issue": {
"new": "Новая задача"
},
+ "initiative": {
+ "new": "Новая инициатива"
+ },
"view": {
"kanban": "Вид «Доска»",
"table": "Вид «Таблица»",
diff --git a/apps/web/messages/ru/initiatives.json b/apps/web/messages/ru/initiatives.json
index cd555430..9d2f5de9 100644
--- a/apps/web/messages/ru/initiatives.json
+++ b/apps/web/messages/ru/initiatives.json
@@ -6,6 +6,7 @@
"showDescription": "Показать описание",
"noDescription": "Описания нет.",
"noOwner": "Без владельца",
+ "startDate": "Дата начала",
"targetDate": "Целевая дата",
"progress": "Прогресс",
"activity": "Активность",
@@ -92,9 +93,7 @@
"noTargetDate": "Укажите целевую дату, чтобы видеть темп."
},
"form": {
- "title": "Название",
"titlePlaceholder": "Запуск в 3 квартале",
- "description": "Описание",
"descriptionPlaceholder": "О чём эта инициатива?",
"create": "Создать инициативу",
"creating": "Создание…",
diff --git a/apps/web/messages/ru/palette.json b/apps/web/messages/ru/palette.json
index 616699c4..1721f9b4 100644
--- a/apps/web/messages/ru/palette.json
+++ b/apps/web/messages/ru/palette.json
@@ -5,6 +5,7 @@
"searching": "Поиск…",
"selectAllIssues": "Выбрать все задачи",
"newIssue": "Новая задача",
+ "newInitiative": "Новая инициатива",
"newProject": "Новый проект",
"toggleChat": "Показать или скрыть ИИ-чат",
"board": "Доска",
diff --git a/apps/web/messages/uk/common.json b/apps/web/messages/uk/common.json
index 2b8d1b50..13becbe2 100644
--- a/apps/web/messages/uk/common.json
+++ b/apps/web/messages/uk/common.json
@@ -63,6 +63,9 @@
"issue": {
"new": "Нова задача"
},
+ "initiative": {
+ "new": "Нова ініціатива"
+ },
"view": {
"kanban": "Вигляд «Дошка»",
"table": "Вигляд «Таблиця»",
diff --git a/apps/web/messages/uk/initiatives.json b/apps/web/messages/uk/initiatives.json
index 963b2cd0..3a158df4 100644
--- a/apps/web/messages/uk/initiatives.json
+++ b/apps/web/messages/uk/initiatives.json
@@ -6,6 +6,7 @@
"showDescription": "Показати опис",
"noDescription": "Опису немає.",
"noOwner": "Без власника",
+ "startDate": "Дата початку",
"targetDate": "Цільова дата",
"progress": "Прогрес",
"activity": "Активність",
@@ -92,9 +93,7 @@
"noTargetDate": "Вкажіть цільову дату, щоб бачити темп."
},
"form": {
- "title": "Назва",
"titlePlaceholder": "Запуск у 3 кварталі",
- "description": "Опис",
"descriptionPlaceholder": "Про що ця ініціатива?",
"create": "Створити ініціативу",
"creating": "Створення…",
diff --git a/apps/web/messages/uk/palette.json b/apps/web/messages/uk/palette.json
index 85ceb674..08f0f188 100644
--- a/apps/web/messages/uk/palette.json
+++ b/apps/web/messages/uk/palette.json
@@ -5,6 +5,7 @@
"searching": "Пошук…",
"selectAllIssues": "Вибрати всі задачі",
"newIssue": "Нова задача",
+ "newInitiative": "Нова ініціатива",
"newProject": "Новий проєкт",
"toggleChat": "Показати або сховати ШІ-чат",
"board": "Дошка",
diff --git a/apps/web/messages/zh-CN/common.json b/apps/web/messages/zh-CN/common.json
index b588b710..5b695e42 100644
--- a/apps/web/messages/zh-CN/common.json
+++ b/apps/web/messages/zh-CN/common.json
@@ -63,6 +63,9 @@
"issue": {
"new": "新建工作项"
},
+ "initiative": {
+ "new": "新建计划"
+ },
"view": {
"kanban": "看板布局",
"table": "表格布局",
diff --git a/apps/web/messages/zh-CN/initiatives.json b/apps/web/messages/zh-CN/initiatives.json
index 29c65d67..d21293cd 100644
--- a/apps/web/messages/zh-CN/initiatives.json
+++ b/apps/web/messages/zh-CN/initiatives.json
@@ -6,6 +6,7 @@
"showDescription": "显示描述",
"noDescription": "暂无描述。",
"noOwner": "无负责人",
+ "startDate": "开始日期",
"targetDate": "目标日期",
"progress": "进度",
"activity": "活动记录",
@@ -92,9 +93,7 @@
"noTargetDate": "设置目标日期以跟踪进度。"
},
"form": {
- "title": "标题",
"titlePlaceholder": "第三季度发布",
- "description": "描述",
"descriptionPlaceholder": "此计划的目标是什么?",
"create": "新建计划",
"creating": "正在创建…",
diff --git a/apps/web/messages/zh-CN/palette.json b/apps/web/messages/zh-CN/palette.json
index e14455e5..3c579ce5 100644
--- a/apps/web/messages/zh-CN/palette.json
+++ b/apps/web/messages/zh-CN/palette.json
@@ -5,6 +5,7 @@
"searching": "正在搜索…",
"selectAllIssues": "选择所有工作项",
"newIssue": "新建工作项",
+ "newInitiative": "新建计划",
"newProject": "新建项目",
"toggleChat": "显示或隐藏 AI 聊天",
"board": "看板",
diff --git a/apps/web/src/components/common/overlay/CreateInitiativeDialog.tsx b/apps/web/src/components/common/overlay/CreateInitiativeDialog.tsx
deleted file mode 100644
index 5d7c7592..00000000
--- a/apps/web/src/components/common/overlay/CreateInitiativeDialog.tsx
+++ /dev/null
@@ -1,74 +0,0 @@
-import { useState } from 'react';
-import { useRouter } from 'next/navigation';
-import { useTranslations } from 'next-intl';
-import { initiativePath } from '@/utils/paths';
-import { useCreateInitiative } from '@/services/initiatives.service';
-import Modal from './Modal';
-import { Button } from '@/components/ui/button';
-import { Input } from '@/components/ui/input';
-import { Label } from '@/components/ui/label';
-import { Textarea } from '@/components/ui/textarea';
-
-// Creates an initiative from a title and optional description; the remaining fields
-// (owner, priority, target date, labels) are set on its detail page. Without
-// onCreated the dialog navigates there.
-export default function CreateInitiativeDialog({
- projectKey,
- onClose,
- onCreated,
-}: {
- projectKey: string;
- onClose: () => void;
- onCreated?: (id: number) => void;
-}) {
- const t = useTranslations('initiatives');
- const tCommon = useTranslations('common');
- const [title, setTitle] = useState('');
- const [description, setDescription] = useState('');
- const create = useCreateInitiative(projectKey);
- const router = useRouter();
-
- const submit = async () => {
- const name = title.trim();
- if (!name) return;
- const created = await create.mutateAsync({ title: name, description: description.trim() });
- onClose();
- if (onCreated) onCreated(created.id);
- else router.push(initiativePath(projectKey, created.id));
- };
-
- return (
- <Modal title={t('newInitiative')} scope={projectKey} onClose={onClose}>
- <div className="flex flex-col gap-4">
- <div className="flex flex-col gap-1.5">
- <Label htmlFor="initiative-title">{t('form.title')}</Label>
- <Input
- id="initiative-title"
- value={title}
- autoFocus
- placeholder={t('form.titlePlaceholder')}
- onChange={(e) => setTitle(e.target.value)}
- onKeyDown={(e) => e.key === 'Enter' && title.trim() && void submit()}
- />
- </div>
- <div className="flex flex-col gap-1.5">
- <Label htmlFor="initiative-description">{t('form.description')}</Label>
- <Textarea
- id="initiative-description"
- value={description}
- placeholder={t('form.descriptionPlaceholder')}
- onChange={(e) => setDescription(e.target.value)}
- />
- </div>
- <div className="flex justify-end gap-2">
- <Button variant="ghost" onClick={onClose}>
- {tCommon('cancel')}
- </Button>
- <Button disabled={!title.trim() || create.isPending} onClick={() => void submit()}>
- {create.isPending ? t('form.creating') : t('form.create')}
- </Button>
- </div>
- </div>
- </Modal>
- );
-}
diff --git a/apps/web/src/components/common/overlay/InitiativeDialog.tsx b/apps/web/src/components/common/overlay/InitiativeDialog.tsx
new file mode 100644
index 00000000..5d7622de
--- /dev/null
+++ b/apps/web/src/components/common/overlay/InitiativeDialog.tsx
@@ -0,0 +1,158 @@
+import { useRef, useState } from 'react';
+import { useRouter } from 'next/navigation';
+import { useTranslations } from 'next-intl';
+import type { Initiative, InitiativeStatus } from '@/lib/api';
+import { initiativePath } from '@/utils/paths';
+import { useCreateInitiative, useUpdateInitiative } from '@/services/initiatives.service';
+import { useProjectQuery } from '@/services/projects.service';
+import Modal, { useModalFullscreen } from './Modal';
+import AssigneeSelect from '@/components/common/fields/AssigneeSelect';
+import DatePill from '@/components/common/fields/DatePill';
+import LabelsSelect from '@/components/common/fields/LabelsSelect';
+import PrioritySelect from '@/components/common/fields/PrioritySelect';
+import InitiativeStatusSelect from '@/components/common/fields/InitiativeStatusSelect';
+import MarkdownEditor from '@/components/common/editor/MarkdownEditor';
+import { Button } from '@/components/ui/button';
+import { cn } from '@/lib/utils';
+
+// An initiative's fields, laid out as the new-issue dialog is: title, description,
+// then the properties as pills. With `initiative` it edits that one, otherwise it
+// creates one and — without onCreated — navigates to it.
+export default function InitiativeDialog({
+ projectKey,
+ initiative,
+ onClose,
+ onCreated,
+}: {
+ projectKey: string;
+ initiative?: Initiative;
+ onClose: () => void;
+ onCreated?: (id: number) => void;
+}) {
+ const t = useTranslations('initiatives');
+ const tCommon = useTranslations('common');
+ // Already in the cache: the Shell loads it for the project the dialog opens in.
+ const { data: project } = useProjectQuery(projectKey);
+ const titleRef = useRef<HTMLInputElement>(null);
+ const [title, setTitle] = useState(initiative?.title ?? '');
+ const [description, setDescription] = useState(initiative?.description ?? '');
+ const [status, setStatus] = useState<InitiativeStatus>(initiative?.status ?? 'planned');
+ const [ownerUserId, setOwnerUserId] = useState<string | null>(initiative?.ownerUserId ?? null);
+ const [priority, setPriority] = useState(initiative?.priority ?? '');
+ const [startDate, setStartDate] = useState<string | null>(initiative?.startDate ?? null);
+ const [targetDate, setTargetDate] = useState<string | null>(initiative?.targetDate ?? null);
+ const [labelIds, setLabelIds] = useState<number[]>(initiative?.labelIds ?? []);
+ const { fullscreen, onToggleFullscreen } = useModalFullscreen();
+ const create = useCreateInitiative(projectKey);
+ const update = useUpdateInitiative(projectKey);
+ const router = useRouter();
+
+ const saving = create.isPending || update.isPending;
+ const busyLabel = initiative ? tCommon('saving') : t('form.creating');
+ const idleLabel = initiative ? t('form.save') : t('form.create');
+ const submitLabel = saving ? busyLabel : idleLabel;
+
+ const toggleLabel = (labelId: number) =>
+ setLabelIds((ids) =>
+ ids.includes(labelId) ? ids.filter((id) => id !== labelId) : [...ids, labelId],
+ );
+
+ const submit = async () => {
+ const name = title.trim();
+ if (!name) return;
+ const fields = {
+ title: name,
+ description: description.trim(),
+ status,
+ ownerUserId,
+ priority: priority || null,
+ startDate,
+ targetDate,
+ labelIds,
+ };
+ if (initiative) {
+ await update.mutateAsync({ id: initiative.id, patch: fields });
+ onClose();
+ return;
+ }
+ const created = await create.mutateAsync(fields);
+ onClose();
+ if (onCreated) onCreated(created.id);
+ else router.push(initiativePath(projectKey, created.id));
+ };
+
+ return (
+ <Modal
+ title={initiative ? t('form.editTitle') : t('newInitiative')}
+ scope={projectKey}
+ onClose={onClose}
+ onOpenAutoFocus={(event) => {
+ event.preventDefault();
+ titleRef.current?.focus();
+ }}
+ wide
+ fullscreen={fullscreen}
+ onToggleFullscreen={onToggleFullscreen}
+ >
+ <div className={cn('flex min-h-0 flex-col', fullscreen && 'flex-1 overflow-hidden')}>
+ <input
+ ref={titleRef}
+ // `auto` once there is something to read, so a title keeps the script it
+ // was typed in.
+ dir={title ? 'auto' : undefined}
+ className="w-full bg-transparent text-lg font-semibold outline-none placeholder:text-muted-foreground"
+ placeholder={t('form.titlePlaceholder')}
+ value={title}
+ onChange={(e) => setTitle(e.target.value)}
+ />
+ <div className={cn('flex min-h-0 flex-col overflow-hidden', fullscreen && 'flex-1')}>
+ <MarkdownEditor
+ // In fullscreen the editor claims the leftover height; in compact it
+ // grows with its content and scrolls once the dialog runs out of room.
+ className={cn('mt-3 overflow-y-auto', fullscreen ? 'min-h-48 flex-1' : 'min-h-24')}
+ defaultValue={initiative?.description ?? ''}
+ placeholder={t('form.descriptionPlaceholder')}
+ onChange={setDescription}
+ />
+ </div>
+
+ <div className="mt-4 flex flex-wrap items-center gap-2">
+ <InitiativeStatusSelect value={status} onChange={setStatus} />
+
+ {project?.assignees.some((a) => a.kind === 'member') && (
+ <AssigneeSelect
+ assignees={project.assignees}
+ value={ownerUserId}
+ onChange={setOwnerUserId}
+ placeholder={t('noOwner')}
+ />
+ )}
+
+ <PrioritySelect value={priority} onChange={setPriority} />
+
+ <DatePill value={startDate} placeholder={t('startDate')} onChange={setStartDate} />
+
+ <DatePill value={targetDate} placeholder={t('targetDate')} onChange={setTargetDate} />
+
+ {project && project.labels.length > 0 && (
+ <LabelsSelect
+ labels={project.labels}
+ groups={project.labelGroups}
+ value={labelIds}
+ onToggle={toggleLabel}
+ />
+ )}
+ </div>
+
+ <div className="mt-6 flex justify-end gap-2">
+ <Button variant="ghost" onClick={onClose}>
+ {tCommon('cancel')}
+ </Button>
+ <Button disabled={!title.trim() || saving} onClick={() => void submit()}>
+ {submitLabel}
+ </Button>
+ </div>
+ </div>
+ </Modal>
+ );
+}
diff --git a/apps/web/src/components/common/overlay/Modal.tsx b/apps/web/src/components/common/overlay/Modal.tsx
index 74f9b781..df98b454 100644
--- a/apps/web/src/components/common/overlay/Modal.tsx
+++ b/apps/web/src/components/common/overlay/Modal.tsx
@@ -1,5 +1,6 @@
-import type { ReactNode } from 'react';
+import { useState, type ReactNode } from 'react';
import { Maximize2, Minimize2, X } from 'lucide-react';
+import { useIsMobile } from '@/hooks/use-mobile';
import { Button } from '@/components/ui/button';
import {
Dialog,
@@ -24,6 +25,18 @@ const MAX_WIDTH = {
const CONTROL_CLASS = 'size-7 text-muted-foreground hover:text-foreground';
+// The fullscreen props of a dialog whose body adapts to fullscreen. On a phone
+// there is no room for anything else, so it is always fullscreen and the toggle
+// is dropped.
+export function useModalFullscreen() {
+ const isMobile = useIsMobile();
+ const [expanded, setExpanded] = useState(false);
+ return {
+ fullscreen: isMobile || expanded,
+ onToggleFullscreen: isMobile ? undefined : () => setExpanded((v) => !v),
+ };
+}
+
export default function Modal({
title,
crumb,
diff --git a/apps/web/src/components/layout/CommandLayer.tsx b/apps/web/src/components/layout/CommandLayer.tsx
index bae4282c..432d6d08 100644
--- a/apps/web/src/components/layout/CommandLayer.tsx
+++ b/apps/web/src/components/layout/CommandLayer.tsx
@@ -25,6 +25,7 @@ export default function CommandLayer({
onViewChange,
onNewIssue,
onSelectAll,
+ onNewInitiative,
onNewProject,
onSelectProject,
onOpenIssue,
@@ -42,6 +43,7 @@ export default function CommandLayer({
onViewChange: (view: WorkItemsView) => void;
onNewIssue: () => void;
onSelectAll: () => void;
+ onNewInitiative: () => void;
onNewProject: () => void;
onSelectProject: (key: string) => void;
onOpenIssue: (sequenceNumber: number) => void;
@@ -54,6 +56,7 @@ export default function CommandLayer({
const issue = useIssueCommands(project, currentIssueId, onIssueDeleted);
const app = useAppCommands({
hasProject,
+ initiativesEnabled: !!project?.project.initiativesEnabled,
onBoard,
view,
projects,
@@ -61,6 +64,7 @@ export default function CommandLayer({
onViewChange,
onNewIssue,
onSelectAll,
+ onNewInitiative,
onNewProject,
onSelectProject,
onToggleChat,
diff --git a/apps/web/src/components/layout/Shell.tsx b/apps/web/src/components/layout/Shell.tsx
index 629a430f..128a8376 100644
--- a/apps/web/src/components/layout/Shell.tsx
+++ b/apps/web/src/components/layout/Shell.tsx
@@ -66,6 +66,7 @@ export default function Shell({
// project it loaded rather than the context.
const { can } = usePermissions(project);
const chatAvailable = !!projectKey && can('ai_agents', 'read');
+ const canCreateInitiative = !!project?.project.initiativesEnabled && can('initiatives', 'create');
const issueQuery = useIssueBySeqQuery(projectKey, routeIssueSeq);
useProjectRouteSync({ projects, projectsLoaded, projectKey });
@@ -104,6 +105,7 @@ export default function Shell({
onToggleCommand: () => overlays.setShowCommand((v) => !v),
onChangeView: editor.changeView,
onNewIssue: () => canCreateIssue && openNewIssue(),
+ onNewInitiative: () => canCreateInitiative && overlays.setShowNewInitiative(true),
onNewProject: () => overlays.setShowNewProject(true),
onSettings: () => firstSettingsHref && router.push(firstSettingsHref),
onToggleChat: chatPanel.toggle,
@@ -217,6 +219,7 @@ export default function Shell({
// Handled by the kanban board's selection provider (mounted only on the
// board); the constant matches BOARD_SELECT_ALL_EVENT in useSelection.
onSelectAll={() => window.dispatchEvent(new Event('board:select-all'))}
+ onNewInitiative={() => overlays.setShowNewInitiative(true)}
onNewProject={() => overlays.setShowNewProject(true)}
onSelectProject={(key) => router.push(projectPath(key))}
onOpenIssue={(seq) => projectKey && router.push(issuePath(projectKey, seq))}
diff --git a/apps/web/src/components/layout/ShellOverlays.tsx b/apps/web/src/components/layout/ShellOverlays.tsx
index 4fefacd2..757300bf 100644
--- a/apps/web/src/components/layout/ShellOverlays.tsx
+++ b/apps/web/src/components/layout/ShellOverlays.tsx
@@ -6,6 +6,7 @@ import { issuePath, projectPath } from '@/utils/paths';
import type { useOverlays } from '@/hooks/useOverlays';
import NewProjectModal from '@/components/layout/NewProjectModal';
import NewTeamModal from '@/features/teams/components/NewTeamModal';
+import InitiativeDialog from '@/components/common/overlay/InitiativeDialog';
import NewIssueModal from '@/features/issue/components/create/NewIssueModal';
import IssueDetail from '@/features/issue/components/detail/IssueDetail';
@@ -36,6 +37,13 @@ export default function ShellOverlays({
{overlays.showNewTeam && <NewTeamModal onClose={() => overlays.setShowNewTeam(false)} />}
+ {projectKey && overlays.showNewInitiative && (
+ <InitiativeDialog
+ projectKey={projectKey}
+ onClose={() => overlays.setShowNewInitiative(false)}
+ />
+ )}
+
{project && overlays.newIssueDefaults != null && (
<NewIssueModal
project={project}
diff --git a/apps/web/src/features/initiatives/InitiativesPage.tsx b/apps/web/src/features/initiatives/InitiativesPage.tsx
index 0b3e199c..95ffab09 100644
--- a/apps/web/src/features/initiatives/InitiativesPage.tsx
+++ b/apps/web/src/features/initiatives/InitiativesPage.tsx
@@ -16,7 +16,7 @@ import { Button } from '@/components/ui/button';
import { Tabs, TabsList } from '@/components/ui/tabs';
import InitiativesList from './components/list/InitiativesList';
import InitiativesPagination from './components/list/InitiativesPagination';
-import CreateInitiativeDialog from '@/components/common/overlay/CreateInitiativeDialog';
+import InitiativeDialog from '@/components/common/overlay/InitiativeDialog';
import InitiativeTabTrigger from './components/list/InitiativeTabTrigger';
import { useInitiativeTabOrder } from './hooks/useInitiativeTabOrder';
import { INITIATIVE_TABS, tabCount } from './utils/tabs';
@@ -154,7 +154,7 @@ export default function InitiativesPage({ tab }: { tab: InitiativesTab }) {
<InitiativesPagination page={page} pageSize={PAGE_SIZE} total={total} onPage={changePage} />
{creating && projectKey && (
- <CreateInitiativeDialog projectKey={projectKey} onClose={() => setCreating(false)} />
+ <InitiativeDialog projectKey={projectKey} onClose={() => setCreating(false)} />
)}
</div>
);
diff --git a/apps/web/src/features/initiatives/components/detail/EditInitiativeDialog.tsx b/apps/web/src/features/initiatives/components/detail/EditInitiativeDialog.tsx
deleted file mode 100644
index cffdb33e..00000000
--- a/apps/web/src/features/initiatives/components/detail/EditInitiativeDialog.tsx
+++ /dev/null
@@ -1,73 +0,0 @@
-'use client';
-
-import { useState } from 'react';
-import { useTranslations } from 'next-intl';
-import type { Initiative } from '@/lib/api';
-import { useUpdateInitiative } from '@/services/initiatives.service';
-import Modal from '@/components/common/overlay/Modal';
-import { Button } from '@/components/ui/button';
-import { Input } from '@/components/ui/input';
-import { Label } from '@/components/ui/label';
-import { Textarea } from '@/components/ui/textarea';
-
-// Only title and description; the other fields are edited inline from the header pills.
-export default function EditInitiativeDialog({
- initiative,
- projectKey,
- onClose,
-}: {
- initiative: Initiative;
- projectKey: string;
- onClose: () => void;
-}) {
- const t = useTranslations('initiatives');
- const tCommon = useTranslations('common');
- const [title, setTitle] = useState(initiative.title);
- const [description, setDescription] = useState(initiative.description);
- const update = useUpdateInitiative(projectKey);
-
- const submit = async () => {
- const name = title.trim();
- if (!name) return;
- await update.mutateAsync({
- id: initiative.id,
- patch: { title: name, description: description.trim() },
- });
- onClose();
- };
-
- return (
- <Modal title={t('form.editTitle')} scope={projectKey} onClose={onClose}>
- <div className="flex flex-col gap-4">
- <div className="flex flex-col gap-1.5">
- <Label htmlFor="edit-initiative-title">{t('form.title')}</Label>
- <Input
- id="edit-initiative-title"
- value={title}
- autoFocus
- onChange={(e) => setTitle(e.target.value)}
- onKeyDown={(e) => e.key === 'Enter' && title.trim() && void submit()}
- />
- </div>
- <div className="flex flex-col gap-1.5">
- <Label htmlFor="edit-initiative-description">{t('form.description')}</Label>
- <Textarea
- id="edit-initiative-description"
- value={description}
- placeholder={t('form.descriptionPlaceholder')}
- className="min-h-32"
- onChange={(e) => setDescription(e.target.value)}
- />
- </div>
- <div className="flex justify-end gap-2">
- <Button variant="ghost" onClick={onClose}>
- {tCommon('cancel')}
- </Button>
- <Button disabled={!title.trim() || update.isPending} onClick={() => void submit()}>
- {update.isPending ? tCommon('saving') : t('form.save')}
- </Button>
- </div>
- </div>
- </Modal>
- );
-}
diff --git a/apps/web/src/features/initiatives/components/detail/InitiativeActions.tsx b/apps/web/src/features/initiatives/components/detail/InitiativeActions.tsx
index c55f6eb3..d4fca63f 100644
--- a/apps/web/src/features/initiatives/components/detail/InitiativeActions.tsx
+++ b/apps/web/src/features/initiatives/components/detail/InitiativeActions.tsx
@@ -15,7 +15,7 @@ import {
DropdownMenuSeparator,
DropdownMenuTrigger,
} from '@/components/ui/dropdown-menu';
-import EditInitiativeDialog from './EditInitiativeDialog';
+import InitiativeDialog from '@/components/common/overlay/InitiativeDialog';
// The initiative's overflow menu. Deleting returns to the initiatives list.
export default function InitiativeActions({
@@ -71,9 +71,9 @@ export default function InitiativeActions({
</DropdownMenu>
{editing && (
- <EditInitiativeDialog
- initiative={initiative}
+ <InitiativeDialog
projectKey={projectKey}
+ initiative={initiative}
onClose={() => setEditing(false)}
/>
)}
diff --git a/apps/web/src/features/initiatives/components/list/InitiativeRow.tsx b/apps/web/src/features/initiatives/components/list/InitiativeRow.tsx
index a5b9f490..1799902a 100644
--- a/apps/web/src/features/initiatives/components/list/InitiativeRow.tsx
+++ b/apps/web/src/features/initiatives/components/list/InitiativeRow.tsx
@@ -35,20 +35,13 @@ export default function InitiativeRow({
<TableCell className="px-3 py-2.5 align-middle whitespace-normal">
<div className="flex min-w-0 items-center gap-2.5">
<span className="shrink-0">{colorDot(STATUS_META[initiative.status].color)}</span>
- <div className="min-w-0">
- <Link
- href={href}
- onClick={(e) => e.stopPropagation()}
- className="block truncate text-sm font-medium hover:underline"
- >
- {initiative.title}
- </Link>
- {initiative.description && (
- <span className="block truncate text-xs text-muted-foreground">
- {initiative.description}
- </span>
- )}
- </div>
+ <Link
+ href={href}
+ onClick={(e) => e.stopPropagation()}
+ className="min-w-0 truncate text-sm font-medium hover:underline"
+ >
+ {initiative.title}
+ </Link>
</div>
</TableCell>
diff --git a/apps/web/src/features/issue/components/create/NewIssueModal.tsx b/apps/web/src/features/issue/components/create/NewIssueModal.tsx
index 2c88ab00..45e802c9 100644
--- a/apps/web/src/features/issue/components/create/NewIssueModal.tsx
+++ b/apps/web/src/features/issue/components/create/NewIssueModal.tsx
@@ -32,7 +32,7 @@ import NewIssueAttachButton from './NewIssueAttachButton';
import NewIssueAttachmentStrip from './NewIssueAttachmentStrip';
import NewIssueDropOverlay from './NewIssueDropOverlay';
import NewIssueTemplatePill from './NewIssueTemplatePill';
-import Modal from '@/components/common/overlay/Modal';
+import Modal, { useModalFullscreen } from '@/components/common/overlay/Modal';
import NewIssueBody from './NewIssueBody';
import AssigneeSelect from '@/components/common/fields/AssigneeSelect';
import DatePill from '@/components/common/fields/DatePill';
@@ -109,7 +109,7 @@ export default function NewIssueModal({
const [labelIds, setLabelIds] = useState<number[]>(defaults.labelIds ?? []);
const [error, setError] = useState<string | null>(null);
const [saving, setSaving] = useState(false);
- const [fullscreen, setFullscreen] = useState(false);
+ const { fullscreen, onToggleFullscreen } = useModalFullscreen();
// Custom fields for the selected type (project-wide + type-scoped), off the
// scaffold every member already loads. Fields flagged "show in main info" get their
@@ -346,7 +346,7 @@ export default function NewIssueModal({
}}
wide
fullscreen={fullscreen}
- onToggleFullscreen={() => setFullscreen((v) => !v)}
+ onToggleFullscreen={onToggleFullscreen}
// Halves the dialog's bottom padding: the footer then sits as far from the
// separator above it as from the dialog edge below.
className="pb-3"
diff --git a/apps/web/src/features/issue/components/fields/InitiativeSelect.tsx b/apps/web/src/features/issue/components/fields/InitiativeSelect.tsx
index 6eceeb03..1620f10e 100644
--- a/apps/web/src/features/issue/components/fields/InitiativeSelect.tsx
+++ b/apps/web/src/features/issue/components/fields/InitiativeSelect.tsx
@@ -3,7 +3,7 @@ import { Check, CircleDashed, Plus, Target } from 'lucide-react';
import { useTranslations } from 'next-intl';
import { usePermissions } from '@/hooks/usePermissions';
import { useInitiativeOptionsQuery } from '@/services/initiatives.service';
-import CreateInitiativeDialog from '@/components/common/overlay/CreateInitiativeDialog';
+import InitiativeDialog from '@/components/common/overlay/InitiativeDialog';
import { colorDot } from '@/components/common/fields/colorDot';
import { STATUS_META } from '@/utils/initiativeMeta';
import {
@@ -105,7 +105,7 @@ export default function InitiativeSelect({
</Popover>
{creating && (
- <CreateInitiativeDialog
+ <InitiativeDialog
projectKey={projectKey}
onClose={() => setCreating(false)}
onCreated={onChange}
diff --git a/apps/web/src/hooks/useAppCommands.tsx b/apps/web/src/hooks/useAppCommands.tsx
index c8149808..a0962967 100644
--- a/apps/web/src/hooks/useAppCommands.tsx
+++ b/apps/web/src/hooks/useAppCommands.tsx
@@ -1,4 +1,4 @@
-import { LayoutGrid, ListChecks, MessagesSquare, Plus, SquarePlus } from 'lucide-react';
+import { LayoutGrid, ListChecks, MessagesSquare, Plus, SquarePlus, Target } from 'lucide-react';
import type { Project } from '@/lib/api';
import { useTranslations } from 'next-intl';
import { VIEWS, type WorkItemsView } from '@/utils/viewTypes';
@@ -12,6 +12,7 @@ import type { Command, CommandSection } from '@/utils/commands';
// handlers come from the Shell, which owns the overlays and the router.
export function useAppCommands({
hasProject,
+ initiativesEnabled,
onBoard,
view,
projects,
@@ -19,11 +20,13 @@ export function useAppCommands({
onViewChange,
onNewIssue,
onSelectAll,
+ onNewInitiative,
onNewProject,
onSelectProject,
onToggleChat,
}: {
hasProject: boolean;
+ initiativesEnabled: boolean;
// True on the work items routes, where the layout and selection commands apply.
onBoard: boolean;
view: WorkItemsView;
@@ -32,6 +35,7 @@ export function useAppCommands({
onViewChange: (view: WorkItemsView) => void;
onNewIssue: () => void;
onSelectAll: () => void;
+ onNewInitiative: () => void;
onNewProject: () => void;
onSelectProject: (key: string) => void;
onToggleChat: () => void;
@@ -82,6 +86,16 @@ export function useAppCommands({
run: onNewIssue,
});
}
+ if (hasProject && initiativesEnabled && can('initiatives', 'create')) {
+ generalItems.push({
+ id: 'general.new-initiative',
+ label: tPalette('newInitiative'),
+ icon: <Target />,
+ keywords: 'create add goal',
+ shortcut: hotkey('initiative.new') ?? undefined,
+ run: onNewInitiative,
+ });
+ }
if (hasProject && can('ai_agents', 'read')) {
generalItems.push({
id: 'general.ai-chat',
diff --git a/apps/web/src/hooks/useKeyboardShortcuts.ts b/apps/web/src/hooks/useKeyboardShortcuts.ts
index 3e5471bb..e0e618a6 100644
--- a/apps/web/src/hooks/useKeyboardShortcuts.ts
+++ b/apps/web/src/hooks/useKeyboardShortcuts.ts
@@ -25,6 +25,7 @@ export function useKeyboardShortcuts(opts: {
onToggleCommand: () => void;
onChangeView: (view: WorkItemsView) => void;
onNewIssue: () => void;
+ onNewInitiative: () => void;
onNewProject: () => void;
onSettings: () => void;
onToggleChat: () => void;
@@ -36,6 +37,7 @@ export function useKeyboardShortcuts(opts: {
onToggleCommand,
onChangeView,
onNewIssue,
+ onNewInitiative,
onNewProject,
onSettings,
onToggleChat,
@@ -65,6 +67,11 @@ export function useKeyboardShortcuts(opts: {
onNewIssue();
return;
}
+ if (hasProject && matches(e, 'initiative.new')) {
+ e.preventDefault();
+ onNewInitiative();
+ return;
+ }
if (matches(e, 'project.new')) {
e.preventDefault();
onNewProject();
@@ -90,6 +97,7 @@ export function useKeyboardShortcuts(opts: {
onToggleCommand,
onChangeView,
onNewIssue,
+ onNewInitiative,
onNewProject,
onSettings,
onToggleChat,
diff --git a/apps/web/src/hooks/useOverlays.ts b/apps/web/src/hooks/useOverlays.ts
index e355e178..efee9085 100644
--- a/apps/web/src/hooks/useOverlays.ts
+++ b/apps/web/src/hooks/useOverlays.ts
@@ -8,6 +8,7 @@ import type { NewIssueDefaults } from '@/utils/project';
export function useOverlays() {
const [showNewProject, setShowNewProject] = useState(false);
const [showNewTeam, setShowNewTeam] = useState(false);
+ const [showNewInitiative, setShowNewInitiative] = useState(false);
const [showCommand, setShowCommand] = useState(false);
// Initial field values for a new issue (null = the new-issue modal is closed).
const [newIssueDefaults, setNewIssueDefaults] = useState<NewIssueDefaults | null>(null);
@@ -22,13 +23,20 @@ export function useOverlays() {
}, [pathname]);
const anyOpen =
- showNewProject || showNewTeam || showCommand || newIssueDefaults != null || openIssueId != null;
+ showNewProject ||
+ showNewTeam ||
+ showNewInitiative ||
+ showCommand ||
+ newIssueDefaults != null ||
+ openIssueId != null;
return {
showNewProject,
setShowNewProject,
showNewTeam,
setShowNewTeam,
+ showNewInitiative,
+ setShowNewInitiative,
showCommand,
setShowCommand,
newIssueDefaults,
diff --git a/apps/web/src/utils/hotkeys.ts b/apps/web/src/utils/hotkeys.ts
index 5d3bdabf..f1474b73 100644
--- a/apps/web/src/utils/hotkeys.ts
+++ b/apps/web/src/utils/hotkeys.ts
@@ -15,6 +15,7 @@ export type HotkeyId =
| 'view.timeline'
| 'view.calendar'
| 'issue.new'
+ | 'initiative.new'
| 'project.new'
| 'project.settings'
| 'chat.toggle'
@@ -60,6 +61,7 @@ export const HOTKEYS: HotkeyDef[] = [
fixed: true,
},
{ id: 'issue.new', group: 'general', combo: 'n', scope: 'app' },
+ { id: 'initiative.new', group: 'general', combo: 'i', scope: 'app' },
{ id: 'project.new', group: 'general', combo: 'b', scope: 'app' },
{
id: 'project.settings',