feat(heute): ungeplant Erledigtes nachtragen (ENTWICKLUN-7)
Drive-by-Aufgaben ("btw, Yevgen-Security-Fix hab ich auch noch gemacht")
strukturiert erfassen statt nur im Freitext. Neues Feld todo.unplanned +
Endpoint dayEntry.addUnplanned: legt sofort ein erledigtes, als „ungeplant"
markiertes ToDo an.
- Schnell-Eingabe „Ungeplant erledigt" auf Heute (Mid-Day) und in der
Reflexion (End-of-Day-Recall).
- "ungeplant"-Badge in Heute, Reflexion und Historie.
- historyForDate liefert das unplanned-Flag mit.
- Reflexions-Freitext bleibt für die Tages-Story.
Migration 0012 (todo.unplanned).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
516b35bf15
commit
66adc49e2c
9 files changed
+3431
-3
No files matched your search
@@ -6,7 +6,7 @@ import { Card } from '../components/ui/Card';
|
||||
import { Button } from '../components/ui/Button';
|
||||
import { SkeletonCard } from '../components/ui/SkeletonCard';
|
||||
import { toast } from 'sonner';
|
||||
import { X, Plus, RotateCw, BellRing, Play, Clock } from 'lucide-react';
|
||||
import { X, Plus, RotateCw, BellRing, Play, Clock, Check } from 'lucide-react';
|
||||
import { TimelineSection, ManualDialog } from '../components/time/TimelineSection';
|
||||
|
||||
/** Aktuelle Stunde in Europe/Berlin (0–23). */
|
||||
@@ -186,7 +186,7 @@ function TodoRow({
|
||||
todo,
|
||||
allTodos,
|
||||
}: {
|
||||
todo: { id: string; title: string; status: 'open' | 'done' | 'dropped' };
|
||||
todo: { id: string; title: string; status: 'open' | 'done' | 'dropped'; unplanned?: boolean };
|
||||
allTodos: Array<{ id: string; title: string }>;
|
||||
}) {
|
||||
const utils = trpc.useUtils();
|
||||
@@ -222,6 +222,11 @@ function TodoRow({
|
||||
}
|
||||
>
|
||||
{todo.title}
|
||||
{todo.unplanned && (
|
||||
<span className="ml-2 rounded-full bg-black/5 px-1.5 py-0.5 text-[10px] text-[var(--color-ink-muted)]">
|
||||
ungeplant
|
||||
</span>
|
||||
)}
|
||||
</span>
|
||||
{todo.status !== 'done' && todo.status !== 'dropped' && (
|
||||
<button
|
||||
@@ -309,11 +314,48 @@ function AddTodoInline() {
|
||||
);
|
||||
}
|
||||
|
||||
function AddUnplannedInline() {
|
||||
const utils = trpc.useUtils();
|
||||
const [title, setTitle] = useState('');
|
||||
const add = trpc.dayEntry.addUnplanned.useMutation({
|
||||
onSuccess: async () => {
|
||||
setTitle('');
|
||||
toast('Ungeplant erledigt — eingetragen.');
|
||||
await utils.dayEntry.today.invalidate();
|
||||
await utils.dayEntry.todayTeam.invalidate();
|
||||
await utils.dashboard.overview.invalidate();
|
||||
},
|
||||
});
|
||||
return (
|
||||
<form
|
||||
className="mt-2 flex items-center gap-2"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
const v = title.trim();
|
||||
if (!v) return;
|
||||
add.mutate({ title: v });
|
||||
}}
|
||||
>
|
||||
<input
|
||||
type="text"
|
||||
value={title}
|
||||
onChange={(e) => setTitle(e.target.value)}
|
||||
placeholder="Ungeplant erledigt? z. B. mItapp-Security-Fix für Yevgen …"
|
||||
maxLength={200}
|
||||
className="flex-1 rounded-[var(--radius-md)] border border-dashed border-[var(--color-border)] bg-white px-3 py-2 text-sm focus:border-[var(--color-ink)] focus:outline-none"
|
||||
/>
|
||||
<Button type="submit" size="sm" variant="ghost" disabled={!title.trim() || add.isPending}>
|
||||
<Check size={14} /> Erledigt eintragen
|
||||
</Button>
|
||||
</form>
|
||||
);
|
||||
}
|
||||
|
||||
function EinstempeltView({
|
||||
todos,
|
||||
entry,
|
||||
}: {
|
||||
todos: Array<{ id: string; title: string; status: 'open' | 'done' | 'dropped' }>;
|
||||
todos: Array<{ id: string; title: string; status: 'open' | 'done' | 'dropped'; unplanned?: boolean }>;
|
||||
entry: { status: 'begun' | 'full' | 'absent' };
|
||||
}) {
|
||||
// Reflexion ist „fällig", wenn nach 18:00 Berlin und noch nicht abgeschlossen.
|
||||
@@ -359,6 +401,7 @@ function EinstempeltView({
|
||||
))}
|
||||
</ul>
|
||||
<AddTodoInline />
|
||||
<AddUnplannedInline />
|
||||
</Card.Body>
|
||||
<Card.Footer className="flex justify-end">
|
||||
<Button onClick={() => (location.href = '/reflexion')}>{ctaLabel}</Button>
|
||||
|
||||
Reference in new issue
Block a user