Skip to content

Commit a6203bd

Browse files
committed
fix bugs raised on discord and fix the checklist DELETE route
1 parent 1766a61 commit a6203bd

File tree

21 files changed

+114
-51
lines changed

21 files changed

+114
-51
lines changed

app/_components/FeatureComponents/Kanban/Kanban.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export const Kanban = ({ checklist, onUpdate }: KanbanBoardProps) => {
8585

8686
useKanbanReminders({
8787
checklist: localChecklist,
88-
checklistId: localChecklist.id,
88+
checklistId: localChecklist.uuid || localChecklist.id,
8989
category: localChecklist.category || "Uncategorized",
9090
onUpdate: handleItemUpdate,
9191
});

app/_components/FeatureComponents/Kanban/KanbanCard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ const KanbanCardComponent = ({
122122
isOpen={showTimeEntriesModal}
123123
onClose={() => setShowTimeEntriesModal(false)}
124124
timeEntries={item.timeEntries}
125-
checklistId={checklistId}
125+
checklistId={checklist.uuid || checklistId}
126126
itemId={item.id}
127127
category={category}
128128
onUpdate={onUpdate}

app/_components/FeatureComponents/Kanban/KanbanItemContent.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ const KanbanItemContentComponent = ({
5858
};
5959

6060
return (
61-
<div className="space-y-2 min-w-0 overflow-hidden">
61+
<div className="space-y-2 min-w-0">
6262
<div className="flex items-center gap-2 min-w-0">
6363
<div className="flex items-center gap-2 flex-1 min-w-0">
6464
{item.createdBy && isShared && (

app/_components/FeatureComponents/Kanban/TimeEntriesModal.tsx

Lines changed: 80 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,16 @@ const _formatDuration = (seconds: number): string => {
3838
return `${pad(h)}:${pad(m)}:${pad(s)}`;
3939
};
4040

41-
const _getUserAvatarUrl = (username: string, usersPublicData?: { username?: string; avatarUrl?: string }[]): string => {
41+
const _getUserAvatarUrl = (
42+
username: string,
43+
usersPublicData?: { username?: string; avatarUrl?: string }[],
44+
): string => {
4245
if (!usersPublicData) return "";
43-
return usersPublicData.find((u) => u.username?.toLowerCase() === username?.toLowerCase())?.avatarUrl || "";
46+
return (
47+
usersPublicData.find(
48+
(u) => u.username?.toLowerCase() === username?.toLowerCase(),
49+
)?.avatarUrl || ""
50+
);
4451
};
4552

4653
interface EditingState {
@@ -64,7 +71,10 @@ const TimeEntriesModalComponent = ({
6471
const [deleteTarget, setDeleteTarget] = useState<string | null>(null);
6572
const [saving, setSaving] = useState(false);
6673

67-
const totalSeconds = timeEntries.reduce((sum, e) => sum + (e.duration || 0), 0);
74+
const totalSeconds = timeEntries.reduce(
75+
(sum, e) => sum + (e.duration || 0),
76+
0,
77+
);
6878

6979
const handleStartEdit = (entry: TimeEntry) => {
7080
setEditing({
@@ -82,12 +92,17 @@ const TimeEntriesModalComponent = ({
8292
formData.append("itemId", itemId);
8393
formData.append("entryId", editing.entryId);
8494
formData.append("category", category);
85-
if (editing.startTime) formData.append("startTime", new Date(editing.startTime).toISOString());
95+
if (editing.startTime)
96+
formData.append("startTime", new Date(editing.startTime).toISOString());
8697
if (editing.endTime) {
8798
formData.append("endTime", new Date(editing.endTime).toISOString());
8899
const start = new Date(editing.startTime).getTime();
89100
const end = new Date(editing.endTime).getTime();
90-
if (end > start) formData.append("duration", Math.floor((end - start) / 1000).toString());
101+
if (end > start)
102+
formData.append(
103+
"duration",
104+
Math.floor((end - start) / 1000).toString(),
105+
);
91106
}
92107
const result = await editTimeEntry(formData);
93108
if (result.success && result.data) {
@@ -114,7 +129,7 @@ const TimeEntriesModalComponent = ({
114129
};
115130

116131
const sorted = [...timeEntries].sort(
117-
(a, b) => new Date(b.startTime).getTime() - new Date(a.startTime).getTime()
132+
(a, b) => new Date(b.startTime).getTime() - new Date(a.startTime).getTime(),
118133
);
119134

120135
return (
@@ -127,8 +142,13 @@ const TimeEntriesModalComponent = ({
127142
>
128143
<div className="space-y-3">
129144
<div className="flex items-center justify-between text-sm text-muted-foreground border-b border-border pb-3">
130-
<span>{sorted.length} {sorted.length === 1 ? t("kanban.session") : t("kanban.sessions")}</span>
131-
<span className="font-semibold text-foreground">{_formatDuration(totalSeconds)}</span>
145+
<span>
146+
{sorted.length}{" "}
147+
{sorted.length === 1 ? t("kanban.session") : t("kanban.sessions")}
148+
</span>
149+
<span className="font-semibold text-foreground">
150+
{_formatDuration(totalSeconds)}
151+
</span>
132152
</div>
133153

134154
<div className="space-y-2 max-h-[55vh] overflow-y-auto">
@@ -149,7 +169,9 @@ const TimeEntriesModalComponent = ({
149169
</label>
150170
<DateTimePicker
151171
value={editing.startTime}
152-
onChange={(v) => setEditing({ ...editing, startTime: v })}
172+
onChange={(v) =>
173+
setEditing({ ...editing, startTime: v })
174+
}
153175
/>
154176
</div>
155177
<div>
@@ -158,14 +180,23 @@ const TimeEntriesModalComponent = ({
158180
</label>
159181
<DateTimePicker
160182
value={editing.endTime}
161-
onChange={(v) => setEditing({ ...editing, endTime: v })}
183+
onChange={(v) =>
184+
setEditing({ ...editing, endTime: v })
185+
}
162186
/>
163187
</div>
164188
</div>
165189
{editing.startTime && editing.endTime && (
166190
<div className="text-xs text-muted-foreground">
167191
{_formatDuration(
168-
Math.max(0, Math.floor((new Date(editing.endTime).getTime() - new Date(editing.startTime).getTime()) / 1000))
192+
Math.max(
193+
0,
194+
Math.floor(
195+
(new Date(editing.endTime).getTime() -
196+
new Date(editing.startTime).getTime()) /
197+
1000,
198+
),
199+
),
169200
)}
170201
</div>
171202
)}
@@ -198,7 +229,10 @@ const TimeEntriesModalComponent = ({
198229
<UserAvatar
199230
username={entry.user}
200231
size="xs"
201-
avatarUrl={_getUserAvatarUrl(entry.user, usersPublicData)}
232+
avatarUrl={_getUserAvatarUrl(
233+
entry.user,
234+
usersPublicData,
235+
)}
202236
/>
203237
)}
204238
<div className="flex-1 min-w-0">
@@ -207,35 +241,48 @@ const TimeEntriesModalComponent = ({
207241
{_formatDuration(entry.duration || 0)}
208242
</span>
209243
{entry.user && (
210-
<span className="text-xs text-muted-foreground">{entry.user}</span>
244+
<span className="text-xs text-muted-foreground">
245+
{entry.user}
246+
</span>
211247
)}
212248
</div>
213249
<div className="text-xs text-muted-foreground mt-0.5">
214-
{new Date(entry.startTime).toLocaleDateString(undefined, {
215-
weekday: "short",
216-
month: "short",
217-
day: "numeric",
218-
})}
219-
{" "}
220-
{new Date(entry.startTime).toLocaleTimeString(undefined, {
221-
hour: "2-digit",
222-
minute: "2-digit",
223-
second: "2-digit",
224-
})}
250+
{new Date(entry.startTime).toLocaleDateString(
251+
undefined,
252+
{
253+
weekday: "short",
254+
month: "short",
255+
day: "numeric",
256+
},
257+
)}{" "}
258+
{new Date(entry.startTime).toLocaleTimeString(
259+
undefined,
260+
{
261+
hour: "2-digit",
262+
minute: "2-digit",
263+
second: "2-digit",
264+
},
265+
)}
225266
{entry.endTime && (
226267
<>
227268
{" → "}
228-
{new Date(entry.endTime).toLocaleTimeString(undefined, {
229-
hour: "2-digit",
230-
minute: "2-digit",
231-
second: "2-digit",
232-
})}
269+
{new Date(entry.endTime).toLocaleTimeString(
270+
undefined,
271+
{
272+
hour: "2-digit",
273+
minute: "2-digit",
274+
second: "2-digit",
275+
},
276+
)}
233277
</>
234278
)}
235279
</div>
236280
</div>
237281
<button
238-
onClick={(e) => { e.stopPropagation(); setDeleteTarget(entry.id); }}
282+
onClick={(e) => {
283+
e.stopPropagation();
284+
setDeleteTarget(entry.id);
285+
}}
239286
className="p-1.5 rounded-jotty hover:bg-destructive/10 transition-colors shrink-0"
240287
>
241288
<Delete03Icon className="h-4 w-4 text-muted-foreground hover:text-destructive" />
@@ -260,7 +307,9 @@ const TimeEntriesModalComponent = ({
260307
onClose={() => setDeleteTarget(null)}
261308
onConfirm={handleDelete}
262309
title={t("common.delete")}
263-
message={t("common.confirmDelete")}
310+
message={t("common.confirmDeleteItem", {
311+
itemTitle: t("common.thisEntry"),
312+
})}
264313
confirmText={t("common.delete")}
265314
variant="destructive"
266315
/>

app/_translations/de.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,8 @@
245245
"continue": "Weiter",
246246
"history": "Verlauf",
247247
"disable": "Deaktivieren",
248-
"items": "Elemente"
248+
"items": "Elemente",
249+
"thisEntry": "diesen Eintrag"
249250
},
250251
"auth": {
251252
"loginTitle": "Anmelden",

app/_translations/en.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,8 @@
245245
"offline": "Offline",
246246
"connected": "Connected",
247247
"reconnecting": "Reconnecting...",
248-
"hide": "Hide"
248+
"hide": "Hide",
249+
"thisEntry": "this entry"
249250
},
250251
"history": {
251252
"noteHistory": "Note History",

app/_translations/es.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,8 @@
245245
"disable": "Desactivar",
246246
"history": "Historial",
247247
"items": "Elementos",
248-
"noResults": "Sin resultados"
248+
"noResults": "Sin resultados",
249+
"thisEntry": "esta entrada"
249250
},
250251
"auth": {
251252
"loginTitle": "Iniciar sesión",

app/_translations/fr.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,8 @@
245245
"disable": "Désactiver",
246246
"history": "Historique",
247247
"items": "Éléments",
248-
"noResults": "Aucun résultat"
248+
"noResults": "Aucun résultat",
249+
"thisEntry": "cette entrée"
249250
},
250251
"auth": {
251252
"loginTitle": "Connexion",

app/_translations/it.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,8 @@
245245
"disable": "Disattiva",
246246
"history": "Cronologia",
247247
"items": "Elementi",
248-
"noResults": "Nessun risultato"
248+
"noResults": "Nessun risultato",
249+
"thisEntry": "questa voce"
249250
},
250251
"auth": {
251252
"loginTitle": "Accedi",

app/_translations/klingon.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,8 @@
245245
"connected": "Connected",
246246
"reconnecting": "Reconnecting...",
247247
"hide": "So'",
248-
"items": "chelmey"
248+
"items": "chelmey",
249+
"thisEntry": "this entry"
249250
},
250251
"history": {
251252
"noteHistory": "ghItlh Qu' tetlh",

0 commit comments

Comments
 (0)