Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

feat([issue-2679]): add per-goal Daily Driver feature-area multi-select to goal editor

[._.]/ Adam Eivyd6c0eab4384d
diff --git a/client/src/components/goals/GoalDetailPanel.jsx b/client/src/components/goals/GoalDetailPanel.jsx
index 782f2e9228..200e12bb88 100644
--- a/client/src/components/goals/GoalDetailPanel.jsx
+++ b/client/src/components/goals/GoalDetailPanel.jsx
@@ -95,6 +95,7 @@ export default function GoalDetailPanel({ goal, allGoals, onClose, onRefresh })
setTagInput={s.setTagInput}
addTag={s.addTag}
removeTag={s.removeTag}
+ toggleFeatureArea={s.toggleFeatureArea}
parentOptions={parentOptions}
saveEdit={s.saveEdit}
onCancel={() => s.setEditing(false)}
diff --git a/client/src/components/goals/GoalDetailPanel.test.jsx b/client/src/components/goals/GoalDetailPanel.test.jsx
index a0eaa83319..d537d7a9da 100644
--- a/client/src/components/goals/GoalDetailPanel.test.jsx
+++ b/client/src/components/goals/GoalDetailPanel.test.jsx
@@ -7,8 +7,11 @@ import { act, render, screen, fireEvent } from '@testing-library/react';
vi.mock('../../services/api', () => ({
getActivities: vi.fn(() => Promise.resolve([])),
getCalendarAccounts: vi.fn(() => Promise.resolve([])),
+ updateGoal: vi.fn(() => Promise.resolve({})),
}));
+import * as api from '../../services/api';
+
import GoalDetailPanel from './GoalDetailPanel';
const baseGoal = {
@@ -137,3 +140,53 @@ describe('GoalDetailPanel provenance chip', () => {
expect(screen.queryByText('Inferred')).toBeNull();
});
});
+
+describe('GoalDetailPanel Daily Driver feature-area override (issue #2679)', () => {
+ it('shows the category default (greyed) when no per-goal override is set', async () => {
+ // mastery → ['post', 'memory'] → "Daily POST, Memory" per goalFeatureMap.
+ await renderPanel();
+ fireEvent.click(screen.getByText('Edit'));
+ expect(screen.getByText(/Default \(Mastery\):/)).toBeTruthy();
+ expect(screen.getByText(/Daily POST, Memory/)).toBeTruthy();
+ });
+
+ it('initializes the multi-select from goal.featureAreas and reflects selection', async () => {
+ await renderPanel({ ...baseGoal, featureAreas: ['writersRoom'] });
+ fireEvent.click(screen.getByText('Edit'));
+ const writersBtn = screen.getByRole('button', { name: /Writers Room/ });
+ expect(writersBtn.getAttribute('aria-pressed')).toBe('true');
+ // With an override present, the category-default hint is hidden.
+ expect(screen.queryByText(/Default \(/)).toBeNull();
+ });
+
+ it('round-trips the override through updateGoal when saved', async () => {
+ await renderPanel(); // no override → falls back to category default
+ fireEvent.click(screen.getByText('Edit'));
+ // Toggle two areas on, then save.
+ fireEvent.click(screen.getByRole('button', { name: /Universes/ }));
+ fireEvent.click(screen.getByRole('button', { name: /Tribe/ }));
+ await act(async () => {
+ fireEvent.click(screen.getByText('Save'));
+ await Promise.resolve();
+ });
+ expect(api.updateGoal).toHaveBeenCalledWith(
+ 'g-1',
+ expect.objectContaining({ featureAreas: ['universes', 'tribe'] })
+ );
+ });
+
+ it('sends an empty featureAreas array when the override is cleared (falls back to category default)', async () => {
+ await renderPanel({ ...baseGoal, featureAreas: ['universes'] });
+ fireEvent.click(screen.getByText('Edit'));
+ // Toggle the sole selected area off.
+ fireEvent.click(screen.getByRole('button', { name: /Universes/ }));
+ await act(async () => {
+ fireEvent.click(screen.getByText('Save'));
+ await Promise.resolve();
+ });
+ expect(api.updateGoal).toHaveBeenCalledWith(
+ 'g-1',
+ expect.objectContaining({ featureAreas: [] })
+ );
+ });
+});
diff --git a/client/src/components/goals/GoalEditForm.jsx b/client/src/components/goals/GoalEditForm.jsx
index d2ededc7a4..86b753e91f 100644
--- a/client/src/components/goals/GoalEditForm.jsx
+++ b/client/src/components/goals/GoalEditForm.jsx
@@ -1,12 +1,31 @@
-import { X } from 'lucide-react';
+import {
+ X, Target,
+ Brain, HeartPulse, PenLine, Globe, Clapperboard, Users,
+ BookOpen, Package, Share2, ListTree, BrainCircuit,
+} from 'lucide-react';
import Pill from '../ui/Pill';
import { FormField } from '../ui/FormField';
import { CATEGORY_CONFIG, HORIZON_OPTIONS, GOAL_TYPE_OPTIONS, MAX_TAGS } from './goalConstants';
+import { FEATURE_AREAS, FEATURE_AREA_IDS, GOAL_CATEGORY_FEATURE_MAP } from '../../lib/goalFeatureMap';
+
+// Resolve a feature-area icon NAME (kept as a string in goalFeatureMap.js so
+// that module stays React-free and server-mirrorable) to a lucide component.
+// Mirrors the map in DailyDriverWidget — the two render the same area set.
+const AREA_ICONS = {
+ Brain, HeartPulse, PenLine, Globe, Clapperboard, Users,
+ BookOpen, Package, Share2, ListTree, BrainCircuit, Target,
+};
export default function GoalEditForm({
form, setForm, tagInput, setTagInput, addTag, removeTag,
- parentOptions, saveEdit, onCancel
+ toggleFeatureArea, parentOptions, saveEdit, onCancel
}) {
+ const selectedAreas = form.featureAreas || [];
+ // Category default shown (greyed) when no per-goal override is set, so the
+ // user sees which areas the Daily Driver will deep-link to by default.
+ const categoryDefaultLabels = (GOAL_CATEGORY_FEATURE_MAP[form.category] || [])
+ .map(id => FEATURE_AREAS[id]?.label)
+ .filter(Boolean);
return (
<div className="space-y-3">
<input
@@ -162,6 +181,37 @@ export default function GoalEditForm({
</button>
</div>
</div>
+ <div>
+ <label id="feature-areas-label" className="text-xs text-gray-500">Daily Driver Feature Areas</label>
+ <p className="text-[10px] text-gray-600 mt-0.5">
+ Pin which PortOS areas the Daily Driver deep-links to for this goal. Leave empty to use the category default.
+ </p>
+ <div role="group" aria-labelledby="feature-areas-label" className="flex flex-wrap gap-1 mt-1">
+ {FEATURE_AREA_IDS.map(id => {
+ const area = FEATURE_AREAS[id];
+ const Icon = AREA_ICONS[area.icon] || Target;
+ const active = selectedAreas.includes(id);
+ return (
+ <button
+ key={id}
+ type="button"
+ aria-pressed={active}
+ onClick={() => toggleFeatureArea(id)}
+ className={`flex items-center gap-1 px-1.5 py-0.5 text-[10px] rounded ${active ? 'bg-port-accent text-white' : 'bg-port-bg border border-port-border text-gray-400'}`}
+ >
+ <Icon className="w-3 h-3" />
+ {area.label}
+ </button>
+ );
+ })}
+ </div>
+ {selectedAreas.length === 0 && (
+ <p className="text-[10px] text-gray-600 mt-1">
+ Default ({CATEGORY_CONFIG[form.category]?.label || form.category}):{' '}
+ {categoryDefaultLabels.length > 0 ? categoryDefaultLabels.join(', ') : 'none for this category'}
+ </p>
+ )}
+ </div>
<div className="flex gap-2">
<button onClick={saveEdit} className="px-3 py-1.5 text-sm rounded bg-port-accent text-white hover:bg-port-accent/80">
Save
diff --git a/client/src/hooks/useGoalDetail.js b/client/src/hooks/useGoalDetail.js
index b1294ac5e7..754da80e35 100644
--- a/client/src/hooks/useGoalDetail.js
+++ b/client/src/hooks/useGoalDetail.js
@@ -58,7 +58,11 @@ export function useGoalDetail({ goal, allGoals, onClose, onRefresh }) {
parentId: goal.parentId || '',
tags: [...(goal.tags || [])],
targetDate: goal.targetDate || '',
- timeBlockConfig: goal.timeBlockConfig || null
+ timeBlockConfig: goal.timeBlockConfig || null,
+ // Per-goal Daily Driver feature-area override (issue #2679). An empty
+ // array = "no override" — getGoalFeatureAreas falls back to the category
+ // default, so we don't need a separate null sentinel here.
+ featureAreas: [...(goal.featureAreas || [])]
});
setEditing(true);
};
@@ -259,6 +263,18 @@ export function useGoalDetail({ goal, allGoals, onClose, onRefresh }) {
setForm({ ...form, tags: form.tags.filter(t => t !== tag) });
};
+ // Toggle a Daily Driver feature-area id in the per-goal override (issue #2679).
+ // Mirrors addTag/removeTag: the form owns the list, the hook owns the mutation.
+ const toggleFeatureArea = (areaId) => {
+ setForm(prev => {
+ const current = prev.featureAreas || [];
+ const next = current.includes(areaId)
+ ? current.filter(a => a !== areaId)
+ : [...current, areaId];
+ return { ...prev, featureAreas: next };
+ });
+ };
+
// Exclude self and descendants from parent options to prevent cycles
const getDescendantIds = (id) => {
const ids = new Set([id]);
@@ -307,6 +323,6 @@ export function useGoalDetail({ goal, allGoals, onClose, onRefresh }) {
handleLinkActivity, handleAddProgress, resetProgressForm, handleDeleteProgress,
handleUnlinkActivity, handleLinkCalendar, handleUnlinkCalendar,
handleProgressChange, handleAddTodo, handleToggleTodo, handleDeleteTodo,
- addTag, removeTag, getDescendantIds
+ addTag, removeTag, toggleFeatureArea, getDescendantIds
};
}