StatusBadge: drop holiday suffix chip — main badge already says 公假

The previous '🎉香港特別行政區成立紀念日' chip wrapped to 7 lines on
mobile and duplicated info already conveyed by the '公假' main badge.

Keep leave chips (+SL2h, +AL4h, etc.) since the basic-status badge
doesn't reveal the leave type, but skip holiday decoration entirely.
This commit is contained in:
IT狗
2026-07-21 22:41:45 +08:00
parent fcc3246d8e
commit f12a239e26
+6 -13
View File
@@ -32,9 +32,10 @@ export default function StatusBadge({ code = '', text = '', size = 'sm' }) {
</span> </span>
) )
// Extract leave/holiday suffix from status_text: // Extract leave suffix from status_text (holiday suffix dropped — the main
// badge already says 公假, so repeating the long name like
// '香港特別行政區成立紀念日' clutters the row).
// '異常-遲到48分 + SL2h' → ['SL2h'] // '異常-遲到48分 + SL2h' → ['SL2h']
// '缺勤 (🎉香港特別行政區成立紀念日)' → ['🎉香港特別行政區成立紀念日']
// 'OT3分 + AL4h + SL3h' → ['AL4h', 'SL3h'] // 'OT3分 + AL4h + SL3h' → ['AL4h', 'SL3h']
// '正常 + CL4h' → ['CL4h'] // '正常 + CL4h' → ['CL4h']
const t = String(text || '') const t = String(text || '')
@@ -44,25 +45,17 @@ export default function StatusBadge({ code = '', text = '', size = 'sm' }) {
for (let i = 1; i < split.length; i++) { for (let i = 1; i < split.length; i++) {
noteParts.push(split[i].replace(/^\(|\)$/g, '').trim()) noteParts.push(split[i].replace(/^\(|\)$/g, '').trim())
} }
} else if (t.includes('🎉')) {
const m = t.match(/🎉[^)\s]+(?:\s[^)\s]+)*/)
if (m) noteParts.push(m[0])
} }
const noteChips = noteParts.filter(Boolean).map((part, idx) => { const noteChips = noteParts.filter(Boolean).map((part, idx) => {
// Strip trailing ')' const cls = 'bg-violet-50 text-violet-600 border border-violet-200'
const clean = part.replace(/\)+$/, '')
const isHoliday = clean.startsWith('🎉')
const cls = isHoliday
? 'bg-indigo-50 text-indigo-600 border border-indigo-200'
: 'bg-violet-50 text-violet-600 border border-violet-200'
return ( return (
<span <span
key={idx} key={idx}
className={`inline-flex items-center ${sizeCls} rounded-full font-normal ${cls}`} className={`inline-flex items-center ${sizeCls} rounded-full font-normal ${cls}`}
title={clean} title={part}
> >
{isHoliday ? clean : `+${clean}`} +{part}
</span> </span>
) )
}) })