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:
@@ -32,9 +32,10 @@ export default function StatusBadge({ code = '', text = '', size = 'sm' }) {
|
||||
</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']
|
||||
// '缺勤 (🎉香港特別行政區成立紀念日)' → ['🎉香港特別行政區成立紀念日']
|
||||
// 'OT3分 + AL4h + SL3h' → ['AL4h', 'SL3h']
|
||||
// '正常 + CL4h' → ['CL4h']
|
||||
const t = String(text || '')
|
||||
@@ -44,25 +45,17 @@ export default function StatusBadge({ code = '', text = '', size = 'sm' }) {
|
||||
for (let i = 1; i < split.length; i++) {
|
||||
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) => {
|
||||
// Strip trailing ')'
|
||||
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'
|
||||
const cls = 'bg-violet-50 text-violet-600 border border-violet-200'
|
||||
return (
|
||||
<span
|
||||
key={idx}
|
||||
className={`inline-flex items-center ${sizeCls} rounded-full font-normal ${cls}`}
|
||||
title={clean}
|
||||
title={part}
|
||||
>
|
||||
{isHoliday ? clean : `+${clean}`}
|
||||
+{part}
|
||||
</span>
|
||||
)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user