fix: replace browser confirm popup with inline delete confirmation

First click on X shows a red "Confirm" button inline. Second click
deletes the stage and moves all its tasks back to "no phase".
Clicking elsewhere resets the state.

v1.48.1

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
mARTin 2026-03-18 00:48:52 +01:00
parent 265eac6f89
commit d1d7c4a7b6
2 changed files with 25 additions and 11 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "my-weekly-todo-list", "name": "my-weekly-todo-list",
"version": "1.48.0", "version": "1.48.1",
"description": "A web-based weekly task management application that organizes to-dos and calendar events in a single, intuitive weekly view", "description": "A web-based weekly task management application that organizes to-dos and calendar events in a single, intuitive weekly view",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {

View File

@ -1973,6 +1973,7 @@ export default function WeeklyView() {
const [kanbanFilterList, setKanbanFilterList] = useState<string>(""); const [kanbanFilterList, setKanbanFilterList] = useState<string>("");
const [kanbanFilterWeek, setKanbanFilterWeek] = useState<string>(""); const [kanbanFilterWeek, setKanbanFilterWeek] = useState<string>("");
const [kanbanSearch, setKanbanSearch] = useState(""); const [kanbanSearch, setKanbanSearch] = useState("");
const [kanbanDeleteStageId, setKanbanDeleteStageId] = useState<string | null>(null);
const [protectEventTimes, setProtectEventTimes] = useState(false); const [protectEventTimes, setProtectEventTimes] = useState(false);
const [unlockedEvents, setUnlockedEvents] = useState<Set<string>>(new Set()); const [unlockedEvents, setUnlockedEvents] = useState<Set<string>>(new Set());
@ -6464,17 +6465,30 @@ export default function WeeklyView() {
{stage.name} {stage.name}
</span> </span>
<span className="kanban-column-count">{stageTasks.length}</span> <span className="kanban-column-count">{stageTasks.length}</span>
{kanbanDeleteStageId === stage.id ? (
<button <button
onClick={() => { onClick={async () => {
if (confirm(language === "de" ? `Phase "${stage.name}" löschen?` : `Delete stage "${stage.name}"?`)) { // Move all tasks in this stage back to "no phase"
saveKanbanStages(kanbanStages.filter((_, i) => i !== idx)); const tasksInStage = filteredKanbanTasks.filter(tk => tk.kanbanStage === stage.id);
for (const tk of tasksInStage) {
await updateTaskFields(tk.id, { kanbanStage: null });
} }
saveKanbanStages(kanbanStages.filter((_, i) => i !== idx));
setKanbanDeleteStageId(null);
}} }}
style={{ padding: "2px 6px", fontSize: "0.65rem", borderRadius: "4px", border: "none", cursor: "pointer", background: "#ef4444", color: "#fff", fontWeight: 600, flexShrink: 0, whiteSpace: "nowrap" }}
>
{language === "de" ? "Ja, löschen" : "Confirm"}
</button>
) : (
<button
onClick={() => setKanbanDeleteStageId(stage.id)}
className="kanban-column-delete" className="kanban-column-delete"
title={language === "de" ? "Phase löschen" : "Delete stage"} title={language === "de" ? "Phase löschen" : "Delete stage"}
> >
<X size={12} /> <X size={12} />
</button> </button>
)}
</div> </div>
<div className="kanban-column-body"> <div className="kanban-column-body">
{stageTasks.map(renderKanbanCard)} {stageTasks.map(renderKanbanCard)}