feat(projects): next_step attribute — inline editor + card display

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
g-butandClaude Sonnet 4.6 committed 2026-05-19 10:28:41 +02:00
1 parent a0b85c2559
commit 8475bbb4f3
3 files changed
+88 -16

No files matched your search

+19 -8
View File
@@ -2,7 +2,7 @@
import { useState, useMemo } from "react";
import { useSearchParams } from "next/navigation";
import { GitBranch, Globe, ShieldAlert, AlertTriangle, Search } from "lucide-react";
import { ArrowRight, GitBranch, Globe, ShieldAlert, AlertTriangle, Search } from "lucide-react";
import { IvyDispatchButton } from "@/components/shared/IvyDispatchButton";
import { useEscapeKey } from "@/hooks/use-escape-key";
import { ProjectDetail } from "./ProjectDetail";
@@ -36,14 +36,17 @@ function ProjectCard({
const { prodUrl, repo } = getProjectLinks(attrs);
const maturity = attrs["maturity"];
const status = attrs["status"];
const nextStep = attrs["next_step"] ?? null;
const signals = getHealthSignals(attrs);
const hasIssues = signals.length > 0;
const extraAttrs = Object.entries(attrs).filter(([k]) => !RESERVED.includes(k));
const ivyPrompt = [
`Project: ${project.name}`,
status && `Status: ${status}`,
maturity && `Maturity: ${maturity}`,
description && `Description: ${description}`,
nextStep && `Next Step: ${nextStep}`,
signals.length > 0 && `Issues: ${signals.map((s) => s.label).join(", ")}`,
"",
"What should I prioritize for this project? What are the biggest risks or next steps?",
@@ -123,17 +126,25 @@ function ProjectCard({
</div>
)}
{!status && !maturity && !hasIssues && (
<div className="flex flex-wrap gap-1.5">
{Object.entries(attrs)
.filter(([k]) => !RESERVED.includes(k))
.slice(0, 2)
.map(([key, value]) => (
{nextStep && (
<div className="flex items-start gap-1.5 rounded-md border border-status-positive/20 bg-status-positive-subtle px-2.5 py-2">
<ArrowRight className="h-3 w-3 shrink-0 mt-0.5 text-status-positive/70" />
<span className="text-xs text-text-secondary leading-relaxed line-clamp-2">{nextStep}</span>
</div>
)}
{!status && !maturity && !hasIssues && !nextStep && (
extraAttrs.length > 0 ? (
<div className="flex flex-wrap gap-1.5">
{extraAttrs.slice(0, 2).map(([key, value]) => (
<span key={key} title={`${key}: ${value}`} className="ui-micro-badge rounded-full border-border-default bg-surface-overlay text-text-tertiary">
{String(value).slice(0, 30)}
</span>
))}
</div>
</div>
) : (
<p className="text-xs text-text-muted italic">No context yet — click to add</p>
)
)}
</div>
);
+68 -7
View File
@@ -1,7 +1,7 @@
"use client";
import { useState } from "react";
import { Plus, Users, MessageSquare, Loader2 } from "lucide-react";
import { ArrowRight, Plus, Users, MessageSquare, Loader2 } from "lucide-react";
import type { ProjectData } from "./project-detail-types";
import {
ISSUE_ATTRS, RESERVED, SUGGESTED_ATTRS, PROJECT_CHANNELS,
@@ -14,6 +14,61 @@ import { toLocalDateStr } from "@/lib/dates";
import { ENTITY_TYPE, INTERACTION_DIRECTION } from "@/lib/constants/statuses";
import { APP_LOCALE } from "@/lib/constants";
function NextStepSection({
attrs, projectId, editable, onReload,
}: {
attrs: Record<string, string>;
projectId: string;
editable: boolean;
onReload: () => void;
}) {
const [editing, setEditing] = useState(false);
const value = attrs["next_step"];
if (!value && !editable) return null;
if (editing) {
return (
<div className="rounded-lg border border-status-positive/20 bg-status-positive-subtle p-3 space-y-2">
<div className="ui-micro-label text-status-positive/70">Next Step</div>
<AddAttrInline
projectId={projectId}
presetKey="next_step"
presetPlaceholder="Single most important next action"
initialValue={value}
onSaved={() => { setEditing(false); onReload(); }}
onCancel={() => setEditing(false)}
/>
</div>
);
}
if (!value) {
return (
<button
onClick={() => setEditing(true)}
className="flex min-h-9 w-full items-center gap-1.5 rounded-lg border border-border-subtle bg-surface-raised px-3 py-2 text-left transition-colors hover:border-status-positive/30 hover:bg-status-positive-subtle"
>
<Plus className="h-3 w-3 shrink-0 text-status-positive/60" />
<span className="text-xs text-text-muted italic">Define next step — the single most important action</span>
</button>
);
}
return (
<div
className={`rounded-lg border border-status-positive/20 bg-status-positive-subtle p-3 ${editable ? "cursor-text" : ""}`}
onClick={editable ? () => setEditing(true) : undefined}
title={editable ? "Click to edit next step" : undefined}
>
<div className="flex items-center gap-1.5 ui-micro-label text-status-positive/70 mb-1.5">
<ArrowRight className="h-3 w-3" /> Next Step
</div>
<p className="text-xs text-text-primary leading-relaxed">{value}</p>
</div>
);
}
export function OverviewTab({
data,
projectId,
@@ -61,12 +116,11 @@ export function OverviewTab({
const attrs = data.attrs;
const displayAttrs = Object.entries(attrs).filter(([k]) => !RESERVED.includes(k));
const missingSuggested = SUGGESTED_ATTRS.filter(({ key }) => !attrs[key]);
// next_step has its own dedicated section — exclude from the missing-suggested list
const missingSuggested = SUGGESTED_ATTRS.filter(({ key }) => !attrs[key] && key !== "next_step");
return (
<div className="space-y-5">
<ClaudeSession tabName={data.runtimeState?.tabName ?? data.name} />
{ISSUE_ATTRS.some((k) => attrs[k]) && (
<div className="space-y-2">
{HEALTH_SIGNAL_CONFIG.filter((cfg) => attrs[cfg.key]).map(({ key, icon: Icon, cardLabel, cardBorder, cardBg, cardText, cardBody }) => (
@@ -80,7 +134,14 @@ export function OverviewTab({
</div>
)}
{displayAttrs.length > 0 ? (
<NextStepSection
attrs={attrs}
projectId={projectId}
editable={!data.readonly}
onReload={onReload}
/>
{displayAttrs.length > 0 && (
<div>
{displayAttrs.map(([key, value]) => (
<AttrRow
@@ -95,8 +156,6 @@ export function OverviewTab({
/>
))}
</div>
) : (
<p className="text-xs text-text-secondary italic">No details recorded yet.</p>
)}
{!data.readonly && missingSuggested.length > 0 && (
@@ -253,6 +312,8 @@ export function OverviewTab({
{data.activity.length > 0 && (
<ProjectHistorySection events={data.activity} />
)}
<ClaudeSession tabName={data.runtimeState?.tabName ?? data.name} />
</div>
);
}
@@ -74,7 +74,7 @@ export const LINK_ATTRS = ["production_url", "repo", "github_repo", "url"];
// Issue keys rendered as warning cards
export const ISSUE_ATTRS = ["broken_features", "security_vulnerability", "deployment_issue"];
// Keys with dedicated rendering (not shown in generic grid)
export const RESERVED = [...LINK_ATTRS, ...ISSUE_ATTRS, "status", "maturity", "description", "owner"];
export const RESERVED = [...LINK_ATTRS, ...ISSUE_ATTRS, "status", "maturity", "description", "owner", "next_step"];
/**
* Resolve project quick-link attrs into ready-to-use href strings.