Files
SubMiner/stats/src/lib/delete-confirm.ts
sudacode 70d52248f8 fix(stats): address CodeRabbit review on PR #50
- Guard episode deletion against double-submit with an isDeletingRef +
  setIsDeleting pair threaded through buildDeleteEpisodeHandler, and
  disable the MediaHeader delete button while a request is in flight.
- Restore MediaHeader title truncation by adding min-w-0 flex-1 to the
  h2 so long titles shrink instead of pushing the delete button away.
- Normalize the headword in FrequencyRankTable before comparing it to
  the (hiragana-normalized) reading so katakana-only entries like カレー
  no longer render a redundant 【かれー】. Test strengthened to reject
  any bracketed reading, not just the literal.
- Rewrite confirmBucketDelete copy to include the "and all associated
  data" warning and handle singular/plural cleanly.
- Run Prettier across the stats files CI was complaining about
  (EpisodeDetail, WatchTimeChart, SessionsTab + test, FrequencyRankTable
  + test, session-grouping test) to clear the format:check:stats gate.
2026-04-09 21:48:43 -07:00

31 lines
1.0 KiB
TypeScript

export function confirmSessionDelete(): boolean {
return globalThis.confirm('Delete this session and all associated data?');
}
export function confirmDayGroupDelete(dayLabel: string, count: number): boolean {
return globalThis.confirm(
`Delete all ${count} session${count === 1 ? '' : 's'} from ${dayLabel} and all associated data?`,
);
}
export function confirmAnimeGroupDelete(title: string, count: number): boolean {
return globalThis.confirm(
`Delete all ${count} session${count === 1 ? '' : 's'} for "${title}" and all associated data?`,
);
}
export function confirmEpisodeDelete(title: string): boolean {
return globalThis.confirm(`Delete "${title}" and all its sessions?`);
}
export function confirmBucketDelete(title: string, count: number): boolean {
if (count === 1) {
return globalThis.confirm(
`Delete this session of "${title}" from this day and all associated data?`,
);
}
return globalThis.confirm(
`Delete all ${count} sessions of "${title}" from this day and all associated data?`,
);
}