From d86637200bc74f41e095023bfe58a5fb4e58ec35 Mon Sep 17 00:00:00 2001 From: plebeius Date: Sun, 25 Jan 2026 16:56:48 +0800 Subject: [PATCH] fix(mod-queue): improve alert threshold input validation and add i18n for view selector --- public/translations/ar/default.json | 5 +- public/translations/bn/default.json | 5 +- public/translations/cs/default.json | 5 +- public/translations/da/default.json | 5 +- public/translations/de/default.json | 5 +- public/translations/el/default.json | 5 +- public/translations/en/default.json | 3 ++ public/translations/es/default.json | 5 +- public/translations/fa/default.json | 5 +- public/translations/fi/default.json | 5 +- public/translations/fil/default.json | 5 +- public/translations/fr/default.json | 5 +- public/translations/he/default.json | 5 +- public/translations/hi/default.json | 5 +- public/translations/hu/default.json | 5 +- public/translations/id/default.json | 5 +- public/translations/it/default.json | 5 +- public/translations/ja/default.json | 5 +- public/translations/ko/default.json | 5 +- public/translations/mr/default.json | 5 +- public/translations/nl/default.json | 5 +- public/translations/no/default.json | 5 +- public/translations/pl/default.json | 5 +- public/translations/pt/default.json | 5 +- public/translations/ro/default.json | 5 +- public/translations/ru/default.json | 5 +- public/translations/sq/default.json | 5 +- public/translations/sv/default.json | 5 +- public/translations/te/default.json | 5 +- public/translations/th/default.json | 5 +- public/translations/tr/default.json | 5 +- public/translations/uk/default.json | 5 +- public/translations/ur/default.json | 5 +- public/translations/vi/default.json | 5 +- public/translations/zh/default.json | 5 +- .../board-buttons/board-buttons.tsx | 47 +++++++++++++++++-- 36 files changed, 182 insertions(+), 38 deletions(-) diff --git a/public/translations/ar/default.json b/public/translations/ar/default.json index b64a2b5d..71cd71a6 100644 --- a/public/translations/ar/default.json +++ b/public/translations/ar/default.json @@ -269,5 +269,8 @@ "submitted": "تم الإرسال", "hours": "ساعات", "minutes": "دقائق", - "alert_threshold": "عتبة التنبيه" + "alert_threshold": "عتبة التنبيه", + "modQueue.viewLabel": "View", + "modQueue.compact": "Compact", + "modQueue.feed": "Feed" } diff --git a/public/translations/bn/default.json b/public/translations/bn/default.json index 03badc9a..dcca3f86 100644 --- a/public/translations/bn/default.json +++ b/public/translations/bn/default.json @@ -269,5 +269,8 @@ "submitted": "জমা দেওয়া হয়েছে", "hours": "ঘণ্টা", "minutes": "মিনিট", - "alert_threshold": "সতর্কতা থ্রেশহোল্ড" + "alert_threshold": "সতর্কতা থ্রেশহোল্ড", + "modQueue.viewLabel": "View", + "modQueue.compact": "Compact", + "modQueue.feed": "Feed" } diff --git a/public/translations/cs/default.json b/public/translations/cs/default.json index 94305994..88b282ab 100644 --- a/public/translations/cs/default.json +++ b/public/translations/cs/default.json @@ -269,5 +269,8 @@ "submitted": "Odesláno", "hours": "hodin", "minutes": "minut", - "alert_threshold": "Práh upozornění" + "alert_threshold": "Práh upozornění", + "modQueue.viewLabel": "View", + "modQueue.compact": "Compact", + "modQueue.feed": "Feed" } diff --git a/public/translations/da/default.json b/public/translations/da/default.json index 41443d51..3f858add 100644 --- a/public/translations/da/default.json +++ b/public/translations/da/default.json @@ -269,5 +269,8 @@ "submitted": "Indsendt", "hours": "timer", "minutes": "minutter", - "alert_threshold": "Alarmtærskel" + "alert_threshold": "Alarmtærskel", + "modQueue.viewLabel": "View", + "modQueue.compact": "Compact", + "modQueue.feed": "Feed" } diff --git a/public/translations/de/default.json b/public/translations/de/default.json index 61e17e6d..5dc5e378 100644 --- a/public/translations/de/default.json +++ b/public/translations/de/default.json @@ -269,5 +269,8 @@ "submitted": "Eingereicht", "hours": "Stunden", "minutes": "Minuten", - "alert_threshold": "Alarmschwellenwert" + "alert_threshold": "Alarmschwellenwert", + "modQueue.viewLabel": "View", + "modQueue.compact": "Compact", + "modQueue.feed": "Feed" } diff --git a/public/translations/el/default.json b/public/translations/el/default.json index c839d059..f5658b56 100644 --- a/public/translations/el/default.json +++ b/public/translations/el/default.json @@ -269,5 +269,8 @@ "submitted": "Υποβλήθηκε", "hours": "ώρες", "minutes": "λεπτά", - "alert_threshold": "Όριο ειδοποίησης" + "alert_threshold": "Όριο ειδοποίησης", + "modQueue.viewLabel": "View", + "modQueue.compact": "Compact", + "modQueue.feed": "Feed" } diff --git a/public/translations/en/default.json b/public/translations/en/default.json index ddc363c3..78f5c28e 100644 --- a/public/translations/en/default.json +++ b/public/translations/en/default.json @@ -263,6 +263,9 @@ "alert_threshold": "Alert threshold", "hours": "hours", "minutes": "minutes", + "modQueue.viewLabel": "View", + "modQueue.compact": "Compact", + "modQueue.feed": "Feed", "no_content": "No content", "excerpt": "Excerpt", "publishing": "Publishing", diff --git a/public/translations/es/default.json b/public/translations/es/default.json index c571db18..619021df 100644 --- a/public/translations/es/default.json +++ b/public/translations/es/default.json @@ -269,5 +269,8 @@ "submitted": "Enviado", "hours": "horas", "minutes": "minutos", - "alert_threshold": "Umbral de alerta" + "alert_threshold": "Umbral de alerta", + "modQueue.viewLabel": "View", + "modQueue.compact": "Compact", + "modQueue.feed": "Feed" } diff --git a/public/translations/fa/default.json b/public/translations/fa/default.json index 29078e1c..90c0836e 100644 --- a/public/translations/fa/default.json +++ b/public/translations/fa/default.json @@ -269,5 +269,8 @@ "submitted": "ارسال شده", "hours": "ساعت", "minutes": "دقیقه", - "alert_threshold": "آستانه هشدار" + "alert_threshold": "آستانه هشدار", + "modQueue.viewLabel": "View", + "modQueue.compact": "Compact", + "modQueue.feed": "Feed" } diff --git a/public/translations/fi/default.json b/public/translations/fi/default.json index ec303dfe..39a05080 100644 --- a/public/translations/fi/default.json +++ b/public/translations/fi/default.json @@ -269,5 +269,8 @@ "submitted": "Lähetetty", "hours": "tuntia", "minutes": "minuuttia", - "alert_threshold": "Hälytyskynnys" + "alert_threshold": "Hälytyskynnys", + "modQueue.viewLabel": "View", + "modQueue.compact": "Compact", + "modQueue.feed": "Feed" } diff --git a/public/translations/fil/default.json b/public/translations/fil/default.json index cc85e549..ab6c0d5f 100644 --- a/public/translations/fil/default.json +++ b/public/translations/fil/default.json @@ -269,5 +269,8 @@ "submitted": "Isinumite", "hours": "oras", "minutes": "minuto", - "alert_threshold": "Alert threshold" + "alert_threshold": "Alert threshold", + "modQueue.viewLabel": "View", + "modQueue.compact": "Compact", + "modQueue.feed": "Feed" } diff --git a/public/translations/fr/default.json b/public/translations/fr/default.json index 38b03726..183d1af6 100644 --- a/public/translations/fr/default.json +++ b/public/translations/fr/default.json @@ -269,5 +269,8 @@ "submitted": "Soumis", "hours": "heures", "minutes": "minutes", - "alert_threshold": "Seuil d'alerte" + "alert_threshold": "Seuil d'alerte", + "modQueue.viewLabel": "View", + "modQueue.compact": "Compact", + "modQueue.feed": "Feed" } diff --git a/public/translations/he/default.json b/public/translations/he/default.json index 5ff6ae28..fc3d917c 100644 --- a/public/translations/he/default.json +++ b/public/translations/he/default.json @@ -269,5 +269,8 @@ "submitted": "נשלח", "hours": "שעות", "minutes": "דקות", - "alert_threshold": "סף התרעה" + "alert_threshold": "סף התרעה", + "modQueue.viewLabel": "View", + "modQueue.compact": "Compact", + "modQueue.feed": "Feed" } diff --git a/public/translations/hi/default.json b/public/translations/hi/default.json index 8bb60a73..03395dae 100644 --- a/public/translations/hi/default.json +++ b/public/translations/hi/default.json @@ -269,5 +269,8 @@ "submitted": "सबमिट किया गया", "hours": "घंटे", "minutes": "मिनट", - "alert_threshold": "सतर्कता सीमा" + "alert_threshold": "सतर्कता सीमा", + "modQueue.viewLabel": "View", + "modQueue.compact": "Compact", + "modQueue.feed": "Feed" } diff --git a/public/translations/hu/default.json b/public/translations/hu/default.json index 165a7c6a..7a3ec449 100644 --- a/public/translations/hu/default.json +++ b/public/translations/hu/default.json @@ -269,5 +269,8 @@ "submitted": "Beküldve", "hours": "óra", "minutes": "perc", - "alert_threshold": "Riasztási küszöb" + "alert_threshold": "Riasztási küszöb", + "modQueue.viewLabel": "View", + "modQueue.compact": "Compact", + "modQueue.feed": "Feed" } diff --git a/public/translations/id/default.json b/public/translations/id/default.json index 1e02ffed..e8697747 100644 --- a/public/translations/id/default.json +++ b/public/translations/id/default.json @@ -269,5 +269,8 @@ "submitted": "Dikirim", "hours": "jam", "minutes": "menit", - "alert_threshold": "Ambang peringatan" + "alert_threshold": "Ambang peringatan", + "modQueue.viewLabel": "View", + "modQueue.compact": "Compact", + "modQueue.feed": "Feed" } diff --git a/public/translations/it/default.json b/public/translations/it/default.json index ce93e22b..3ee2f207 100644 --- a/public/translations/it/default.json +++ b/public/translations/it/default.json @@ -269,5 +269,8 @@ "submitted": "Inviato", "hours": "ore", "minutes": "minuti", - "alert_threshold": "Soglia di allerta" + "alert_threshold": "Soglia di allerta", + "modQueue.viewLabel": "View", + "modQueue.compact": "Compact", + "modQueue.feed": "Feed" } diff --git a/public/translations/ja/default.json b/public/translations/ja/default.json index 99472635..917bb4b8 100644 --- a/public/translations/ja/default.json +++ b/public/translations/ja/default.json @@ -269,5 +269,8 @@ "submitted": "送信済み", "hours": "時間", "minutes": "分", - "alert_threshold": "アラート閾値" + "alert_threshold": "アラート閾値", + "modQueue.viewLabel": "View", + "modQueue.compact": "Compact", + "modQueue.feed": "Feed" } diff --git a/public/translations/ko/default.json b/public/translations/ko/default.json index ad83f0ca..e3157c3b 100644 --- a/public/translations/ko/default.json +++ b/public/translations/ko/default.json @@ -269,5 +269,8 @@ "submitted": "제출됨", "hours": "시간", "minutes": "분", - "alert_threshold": "알림 임계값" + "alert_threshold": "알림 임계값", + "modQueue.viewLabel": "View", + "modQueue.compact": "Compact", + "modQueue.feed": "Feed" } diff --git a/public/translations/mr/default.json b/public/translations/mr/default.json index 37a22713..02beacf5 100644 --- a/public/translations/mr/default.json +++ b/public/translations/mr/default.json @@ -269,5 +269,8 @@ "submitted": "सबमिट केले", "hours": "तास", "minutes": "मिनिटे", - "alert_threshold": "सतर्कता मर्यादा" + "alert_threshold": "सतर्कता मर्यादा", + "modQueue.viewLabel": "View", + "modQueue.compact": "Compact", + "modQueue.feed": "Feed" } diff --git a/public/translations/nl/default.json b/public/translations/nl/default.json index 3cb6ea8d..8cf7e2ad 100644 --- a/public/translations/nl/default.json +++ b/public/translations/nl/default.json @@ -269,5 +269,8 @@ "submitted": "Ingediend", "hours": "uur", "minutes": "minuten", - "alert_threshold": "Drempelwaarde voor waarschuwing" + "alert_threshold": "Drempelwaarde voor waarschuwing", + "modQueue.viewLabel": "View", + "modQueue.compact": "Compact", + "modQueue.feed": "Feed" } diff --git a/public/translations/no/default.json b/public/translations/no/default.json index 2f036153..c4171f0b 100644 --- a/public/translations/no/default.json +++ b/public/translations/no/default.json @@ -269,5 +269,8 @@ "submitted": "Sendt inn", "hours": "timer", "minutes": "minutter", - "alert_threshold": "Terskel for varsel" + "alert_threshold": "Terskel for varsel", + "modQueue.viewLabel": "View", + "modQueue.compact": "Compact", + "modQueue.feed": "Feed" } diff --git a/public/translations/pl/default.json b/public/translations/pl/default.json index 7f92276c..780f71f5 100644 --- a/public/translations/pl/default.json +++ b/public/translations/pl/default.json @@ -269,5 +269,8 @@ "submitted": "Przesłane", "hours": "godzin", "minutes": "minut", - "alert_threshold": "Próg alertu" + "alert_threshold": "Próg alertu", + "modQueue.viewLabel": "View", + "modQueue.compact": "Compact", + "modQueue.feed": "Feed" } diff --git a/public/translations/pt/default.json b/public/translations/pt/default.json index 7b314590..16dcbde8 100644 --- a/public/translations/pt/default.json +++ b/public/translations/pt/default.json @@ -269,5 +269,8 @@ "submitted": "Enviado", "hours": "horas", "minutes": "minutos", - "alert_threshold": "Limite de alerta" + "alert_threshold": "Limite de alerta", + "modQueue.viewLabel": "View", + "modQueue.compact": "Compact", + "modQueue.feed": "Feed" } diff --git a/public/translations/ro/default.json b/public/translations/ro/default.json index e358c6ad..4525740a 100644 --- a/public/translations/ro/default.json +++ b/public/translations/ro/default.json @@ -269,5 +269,8 @@ "submitted": "Trimis", "hours": "ore", "minutes": "minute", - "alert_threshold": "Prag de alertă" + "alert_threshold": "Prag de alertă", + "modQueue.viewLabel": "View", + "modQueue.compact": "Compact", + "modQueue.feed": "Feed" } diff --git a/public/translations/ru/default.json b/public/translations/ru/default.json index e212d9d2..5eb28ec0 100644 --- a/public/translations/ru/default.json +++ b/public/translations/ru/default.json @@ -269,5 +269,8 @@ "submitted": "Отправлено", "hours": "часов", "minutes": "минут", - "alert_threshold": "Порог предупреждения" + "alert_threshold": "Порог предупреждения", + "modQueue.viewLabel": "View", + "modQueue.compact": "Compact", + "modQueue.feed": "Feed" } diff --git a/public/translations/sq/default.json b/public/translations/sq/default.json index 5898b13c..02ecec76 100644 --- a/public/translations/sq/default.json +++ b/public/translations/sq/default.json @@ -269,5 +269,8 @@ "submitted": "Dërguar", "hours": "orë", "minutes": "minuta", - "alert_threshold": "Pragu i alarmit" + "alert_threshold": "Pragu i alarmit", + "modQueue.viewLabel": "View", + "modQueue.compact": "Compact", + "modQueue.feed": "Feed" } diff --git a/public/translations/sv/default.json b/public/translations/sv/default.json index 60bf7f75..95fef456 100644 --- a/public/translations/sv/default.json +++ b/public/translations/sv/default.json @@ -269,5 +269,8 @@ "submitted": "Inskickat", "hours": "timmar", "minutes": "minuter", - "alert_threshold": "Tröskelvärde för varning" + "alert_threshold": "Tröskelvärde för varning", + "modQueue.viewLabel": "View", + "modQueue.compact": "Compact", + "modQueue.feed": "Feed" } diff --git a/public/translations/te/default.json b/public/translations/te/default.json index 4a2de249..6e43a067 100644 --- a/public/translations/te/default.json +++ b/public/translations/te/default.json @@ -269,5 +269,8 @@ "submitted": "సమర్పించబడింది", "hours": "గంటలు", "minutes": "నిమిషాలు", - "alert_threshold": "హెచ్చరిక థ్రెషోల్డ్" + "alert_threshold": "హెచ్చరిక థ్రెషోల్డ్", + "modQueue.viewLabel": "View", + "modQueue.compact": "Compact", + "modQueue.feed": "Feed" } diff --git a/public/translations/th/default.json b/public/translations/th/default.json index 386dbb82..ca3e3dff 100644 --- a/public/translations/th/default.json +++ b/public/translations/th/default.json @@ -269,5 +269,8 @@ "submitted": "ส่งแล้ว", "hours": "ชั่วโมง", "minutes": "นาที", - "alert_threshold": "เกณฑ์การแจ้งเตือน" + "alert_threshold": "เกณฑ์การแจ้งเตือน", + "modQueue.viewLabel": "View", + "modQueue.compact": "Compact", + "modQueue.feed": "Feed" } diff --git a/public/translations/tr/default.json b/public/translations/tr/default.json index b79dfb57..b3f675b4 100644 --- a/public/translations/tr/default.json +++ b/public/translations/tr/default.json @@ -269,5 +269,8 @@ "submitted": "Gönderildi", "hours": "saat", "minutes": "dakika", - "alert_threshold": "Uyarı eşiği" + "alert_threshold": "Uyarı eşiği", + "modQueue.viewLabel": "View", + "modQueue.compact": "Compact", + "modQueue.feed": "Feed" } diff --git a/public/translations/uk/default.json b/public/translations/uk/default.json index 3909a6b7..7089e305 100644 --- a/public/translations/uk/default.json +++ b/public/translations/uk/default.json @@ -269,5 +269,8 @@ "submitted": "Відправлено", "hours": "годин", "minutes": "хвилин", - "alert_threshold": "Поріг попередження" + "alert_threshold": "Поріг попередження", + "modQueue.viewLabel": "View", + "modQueue.compact": "Compact", + "modQueue.feed": "Feed" } diff --git a/public/translations/ur/default.json b/public/translations/ur/default.json index 9cd30fea..bd63e860 100644 --- a/public/translations/ur/default.json +++ b/public/translations/ur/default.json @@ -269,5 +269,8 @@ "submitted": "جمع کرایا گیا", "hours": "گھنٹے", "minutes": "منٹ", - "alert_threshold": "انتباہ کی حد" + "alert_threshold": "انتباہ کی حد", + "modQueue.viewLabel": "View", + "modQueue.compact": "Compact", + "modQueue.feed": "Feed" } diff --git a/public/translations/vi/default.json b/public/translations/vi/default.json index 2f632514..b9ea62d3 100644 --- a/public/translations/vi/default.json +++ b/public/translations/vi/default.json @@ -269,5 +269,8 @@ "submitted": "Đã gửi", "hours": "giờ", "minutes": "phút", - "alert_threshold": "Ngưỡng cảnh báo" + "alert_threshold": "Ngưỡng cảnh báo", + "modQueue.viewLabel": "View", + "modQueue.compact": "Compact", + "modQueue.feed": "Feed" } diff --git a/public/translations/zh/default.json b/public/translations/zh/default.json index f4bdf9c3..64825a5e 100644 --- a/public/translations/zh/default.json +++ b/public/translations/zh/default.json @@ -269,5 +269,8 @@ "submitted": "已提交", "hours": "小时", "minutes": "分钟", - "alert_threshold": "警报阈值" + "alert_threshold": "警报阈值", + "modQueue.viewLabel": "View", + "modQueue.compact": "Compact", + "modQueue.feed": "Feed" } diff --git a/src/components/board-buttons/board-buttons.tsx b/src/components/board-buttons/board-buttons.tsx index c7ad11a7..381c965f 100644 --- a/src/components/board-buttons/board-buttons.tsx +++ b/src/components/board-buttons/board-buttons.tsx @@ -230,10 +230,47 @@ const ImageSizeOptions = () => { ); }; +const MAX_ALERT_THRESHOLD = 10000; // Maximum threshold value in minutes (~166 hours) + const ModQueueAlertThreshold = () => { const { t } = useTranslation(); const { alertThresholdValue, alertThresholdUnit, setAlertThreshold } = useModQueueStore(); + const handleThresholdChange = (e: React.ChangeEvent) => { + const inputValue = e.target.value.trim(); + + // Handle empty input - allow it temporarily for better UX + if (inputValue === '') { + return; + } + + // Parse safely + const parsedValue = parseInt(inputValue, 10); + + // Default to 1 if invalid or NaN + if (isNaN(parsedValue) || parsedValue < 1) { + setAlertThreshold(1, alertThresholdUnit); + return; + } + + // Convert to minutes for clamping, then convert back to current unit + const valueInMinutes = alertThresholdUnit === 'hours' ? parsedValue * 60 : parsedValue; + const clampedMinutes = Math.min(valueInMinutes, MAX_ALERT_THRESHOLD); + const finalValue = alertThresholdUnit === 'hours' ? Math.round(clampedMinutes / 60) : clampedMinutes; + + setAlertThreshold(finalValue, alertThresholdUnit); + }; + + const handleThresholdBlur = (e: React.FocusEvent) => { + const inputValue = e.target.value.trim(); + + // If empty or invalid, restore to current value or default to 1 + if (inputValue === '' || isNaN(parseInt(inputValue, 10))) { + const safeValue = alertThresholdValue >= 1 ? alertThresholdValue : 1; + setAlertThreshold(safeValue, alertThresholdUnit); + } + }; + return (