fix(web): 大纲生成只替换目标卷+重排确认+窗口徽标用lucide + 伏笔看板中文化/单一登记入口/Field表单
This commit is contained in:
@@ -62,15 +62,17 @@ export function ForeshadowBoard({
|
||||
title="伏笔看板"
|
||||
description="跟踪每条伏笔从埋设、推进到回收的状态,逾期项会单独提醒。"
|
||||
actions={
|
||||
<Button
|
||||
onClick={() => setRegisterOpen(true)}
|
||||
disabled={registerOpen}
|
||||
variant="primary"
|
||||
size="sm"
|
||||
>
|
||||
<Plus className="h-4 w-4" aria-hidden="true" />
|
||||
登记伏笔
|
||||
</Button>
|
||||
// registerOpen 时隐藏头部入口,避免与展开的表单重复(全局只一个 RegisterForm)。
|
||||
registerOpen ? undefined : (
|
||||
<Button
|
||||
onClick={() => setRegisterOpen(true)}
|
||||
variant="primary"
|
||||
size="sm"
|
||||
>
|
||||
<Plus className="h-4 w-4" aria-hidden="true" />
|
||||
登记伏笔
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
/>
|
||||
{registerOpen ? (
|
||||
@@ -90,11 +92,16 @@ export function ForeshadowBoard({
|
||||
title="还没有伏笔"
|
||||
description="登记第一条伏笔后,这里会按待推进、推进中、已回收、已逾期四种状态自动分栏。"
|
||||
action={
|
||||
<RegisterForm
|
||||
projectId={project.id}
|
||||
busy={busy}
|
||||
onRegister={register}
|
||||
/>
|
||||
registerOpen ? undefined : (
|
||||
<Button
|
||||
onClick={() => setRegisterOpen(true)}
|
||||
variant="primary"
|
||||
size="sm"
|
||||
>
|
||||
<Plus className="h-4 w-4" aria-hidden="true" />
|
||||
登记伏笔
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
className="mt-6"
|
||||
/>
|
||||
@@ -138,16 +145,15 @@ function ForeshadowBoardSummary({
|
||||
className="mb-3 grid grid-cols-2 gap-2 sm:grid-cols-4"
|
||||
>
|
||||
{LANES.map((status) => (
|
||||
<Card key={status} className="px-3 py-2">
|
||||
<Card key={status} data-status={status} className="px-3 py-2">
|
||||
<div className="flex items-center justify-between gap-2">
|
||||
<Badge variant={SUMMARY_VARIANTS[status]}>
|
||||
{LANE_LABELS[status]}
|
||||
</Badge>
|
||||
<span className="font-mono text-sm text-ink">{counts[status]}</span>
|
||||
</div>
|
||||
<p className="mt-1 text-[11px] text-ink-soft">
|
||||
<span className="font-mono">{status}</span>
|
||||
{" · "}
|
||||
<p className="mt-1 text-2xs text-ink-soft">
|
||||
占比{" "}
|
||||
{total > 0 ? `${Math.round((counts[status] / total) * 100)}%` : "0%"}
|
||||
</p>
|
||||
</Card>
|
||||
|
||||
@@ -26,8 +26,9 @@ export function KanbanColumn({
|
||||
const overdue = status === "OVERDUE";
|
||||
return (
|
||||
<section
|
||||
data-status={status}
|
||||
className="flex min-w-0 flex-col rounded border border-line bg-bg"
|
||||
aria-label={`${status} 泳道`}
|
||||
aria-label={`${LANE_LABELS[status]} 泳道`}
|
||||
>
|
||||
<header
|
||||
className={`flex items-center justify-between rounded-t border-b px-3 py-2 ${
|
||||
@@ -44,7 +45,6 @@ export function KanbanColumn({
|
||||
{LANE_LABELS[status]}
|
||||
</span>
|
||||
)}
|
||||
<span className="font-mono text-[10px] text-ink-soft">{status}</span>
|
||||
</span>
|
||||
<span className="font-mono text-xs">{items.length}</span>
|
||||
</header>
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
"use client";
|
||||
|
||||
import { useState, type ReactNode } from "react";
|
||||
import { useState } from "react";
|
||||
import { Plus } from "lucide-react";
|
||||
|
||||
import { Button } from "@/components/ui/Button";
|
||||
import { Field } from "@/components/ui/Field";
|
||||
import { TextArea } from "@/components/ui/TextArea";
|
||||
import { TextInput } from "@/components/ui/TextInput";
|
||||
import { cardClass } from "@/lib/ui/variants";
|
||||
import type { RegisterInput } from "@/lib/foreshadow/board";
|
||||
@@ -71,8 +73,9 @@ export function RegisterForm({
|
||||
);
|
||||
}
|
||||
|
||||
const canSubmit =
|
||||
form.code.trim().length > 0 && form.title.trim().length > 0 && !busy;
|
||||
const missingRequired =
|
||||
form.code.trim().length === 0 || form.title.trim().length === 0;
|
||||
const canSubmit = !missingRequired && !busy;
|
||||
|
||||
return (
|
||||
<form
|
||||
@@ -83,59 +86,53 @@ export function RegisterForm({
|
||||
className={cardClass("p-4")}
|
||||
>
|
||||
<div className="grid grid-cols-2 gap-3 sm:grid-cols-3">
|
||||
<FormSlot label="代号 *" id="f-code">
|
||||
<Field label="代号" required>
|
||||
<TextInput
|
||||
id="f-code"
|
||||
value={form.code}
|
||||
onChange={(e) => set("code", e.target.value)}
|
||||
/>
|
||||
</FormSlot>
|
||||
<FormSlot label="标题 *" id="f-title" span2>
|
||||
</Field>
|
||||
<Field label="标题" required className="col-span-2">
|
||||
<TextInput
|
||||
id="f-title"
|
||||
value={form.title}
|
||||
onChange={(e) => set("title", e.target.value)}
|
||||
/>
|
||||
</FormSlot>
|
||||
<FormSlot label="埋设章" id="f-planted">
|
||||
</Field>
|
||||
<Field label="埋设章">
|
||||
<TextInput
|
||||
id="f-planted"
|
||||
inputMode="numeric"
|
||||
value={form.plantedAt}
|
||||
onChange={(e) => set("plantedAt", e.target.value)}
|
||||
/>
|
||||
</FormSlot>
|
||||
<FormSlot label="回收窗口起" id="f-from">
|
||||
</Field>
|
||||
<Field label="回收窗口起">
|
||||
<TextInput
|
||||
id="f-from"
|
||||
inputMode="numeric"
|
||||
value={form.expectedCloseFrom}
|
||||
onChange={(e) => set("expectedCloseFrom", e.target.value)}
|
||||
/>
|
||||
</FormSlot>
|
||||
<FormSlot label="回收窗口止" id="f-to">
|
||||
</Field>
|
||||
<Field label="回收窗口止">
|
||||
<TextInput
|
||||
id="f-to"
|
||||
inputMode="numeric"
|
||||
value={form.expectedCloseTo}
|
||||
onChange={(e) => set("expectedCloseTo", e.target.value)}
|
||||
/>
|
||||
</FormSlot>
|
||||
<FormSlot label="重要度" id="f-imp">
|
||||
</Field>
|
||||
<Field label="重要度">
|
||||
<TextInput
|
||||
id="f-imp"
|
||||
value={form.importance}
|
||||
onChange={(e) => set("importance", e.target.value)}
|
||||
placeholder="主线/支线"
|
||||
/>
|
||||
</FormSlot>
|
||||
<FormSlot label="线索内容" id="f-content" span3>
|
||||
<TextInput
|
||||
id="f-content"
|
||||
</Field>
|
||||
<Field label="线索内容" className="col-span-2 sm:col-span-3">
|
||||
<TextArea
|
||||
rows={2}
|
||||
value={form.content}
|
||||
onChange={(e) => set("content", e.target.value)}
|
||||
/>
|
||||
</FormSlot>
|
||||
</Field>
|
||||
</div>
|
||||
<div className="mt-3 flex items-center gap-2">
|
||||
<Button
|
||||
@@ -146,38 +143,17 @@ export function RegisterForm({
|
||||
>
|
||||
{busy ? "登记中…" : "登记"}
|
||||
</Button>
|
||||
<Button
|
||||
onClick={() => setOpen(false)}
|
||||
variant="secondary"
|
||||
size="sm"
|
||||
>
|
||||
<Button onClick={() => setOpen(false)} variant="secondary" size="sm">
|
||||
取消
|
||||
</Button>
|
||||
{missingRequired && !busy ? (
|
||||
<span className="text-xs text-ink-soft">先填代号与标题</span>
|
||||
) : null}
|
||||
</div>
|
||||
</form>
|
||||
);
|
||||
}
|
||||
|
||||
interface FormSlotProps {
|
||||
label: string;
|
||||
id: string;
|
||||
span2?: boolean;
|
||||
span3?: boolean;
|
||||
children: ReactNode;
|
||||
}
|
||||
|
||||
function FormSlot({ label, id, span2, span3, children }: FormSlotProps) {
|
||||
const span = span3 ? "col-span-2 sm:col-span-3" : span2 ? "col-span-2" : "";
|
||||
return (
|
||||
<div className={span}>
|
||||
<label htmlFor={id} className="block text-xs text-ink-soft">
|
||||
{label}
|
||||
</label>
|
||||
<div className="mt-0.5">{children}</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function toInt(raw: string): number | null {
|
||||
const trimmed = raw.trim();
|
||||
if (trimmed.length === 0) return null;
|
||||
|
||||
Reference in New Issue
Block a user