mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-23 13:23:04 +00:00
fix: clear every open Sonar security issue, and half the reliability ones (#2037)
* fix(security): mint idempotency keys properly, and resolve the extractor by path Three findings out of a sweep of every open Sonar security issue. The other 49 turned out to be false positives and are documented in sonar-project.properties rather than changed — each entry scoped to a file, never a whole rule, so a future Math.random() on an auth path still fails. The idempotency key is the one that can lose data. Both producers fell back to Math.random when crypto.randomUUID was missing, and randomUUID needs a secure context — TREK's own quickstart is http://localhost:3000 and LAN installs run on http://192.168.x.x, so on the deployments the README documents the fallback is what actually runs. The axios one was `Math.random().toString(36).slice(2)`, which is not length-stable: 0.5 yields a single character and 0 yields the empty string, which the interceptor reads as "no key" and skips deduplication for entirely. Two writes sharing a key collapse into one — the second gets the first one's cached response and the edit is gone with no error anywhere. Both now come from utils/randomId, which has the getRandomValues rung that works in insecure contexts too. The extractor probe stored the bare binary name, so every extraction re-resolved it through whatever PATH held at that moment. The official image sets KITINERARY_EXTRACTOR_PATH and never reaches that branch, but a bare-metal install without it ran an unqualified name from a PATH it does not control. It now walks the search path itself and keeps the absolute path of the file it verified; execFileSync also drops the /bin/sh hop the old probe needed. PATH comes through app-config because process.env is walled off in src/. * fix: four tests and sorts that were not doing what they claimed Sonar reported 43 high-impact reliability issues. Reading all of them, four are real; the rest are cosmetic or would be made worse by the suggested change. budget.test.ts hand-built `paid: true`, but both emitters send `paid: body.paid ? 1 : 0` and the handler stores the value verbatim — the test asserted a payload the server never sends. The line below it already used a number. admin.controller.test.ts had a `.resolves` assertion with no await. The promise was dropped, so that line could not fail the test. The two to-do category lists sorted with a bare .sort(), which is byte order: every accented name files behind the whole ASCII range, so in a German trip "Übernachtung" lands after "Zelt". TREK ships 23 locales, so this is real data. One side effect worth knowing: katColor picks a category's dot colour by its index, so re-sorting can move which category shows which colour — it already moves whenever a category is added, and the colour carries no meaning. Deliberately not changed: the two `| 0` truncations (Math.trunc is not equivalent — `| 0` wraps at 32 bits and these carry millisecond timestamps), the two .map() callbacks whose second parameter is declared and used, and the sha1 in thumbnail.service (its own comment says a swap would orphan every existing thumbnail). * refactor: give every button a type, and prefer the Number statics Two mechanical sweeps, no behaviour change intended in either. A <button> with no type attribute is type="submit" per the HTML spec. Outside a form that does nothing today, but it turns into a surprise the moment the markup is wrapped in one, which is what Sonar's S9011 is warning about. 870 buttons get an explicit type="button". Two things were left alone on purpose: buttons that take a {...spread}, because the spread may carry a type and the merge order decides which wins, and anything inside a <form> — there the answer is a judgement call, and checking all eleven form files found every real submit button already carrying type="submit". The Number sweep covers only the three globals that are exactly equivalent to their Number twin: parseInt, parseFloat and NaN. isNaN is NOT in it — the global coerces its argument, so isNaN('abc') is true where Number.isNaN('abc') is false, and renaming it would change what the code does. It reaches server and plugin-sdk as well as the client; both copies of egress-policy.ts got the identical edit, so the mirror the SDK's parity test guards stays intact.
This commit is contained in:
@@ -218,7 +218,7 @@ export default function VacayCalendar() {
|
||||
{/* Floating toolbar — lift above the mobile bottom nav (z-60). On desktop --bottom-nav-h is 0px. */}
|
||||
<div className="sticky mt-3 sm:mt-4 flex items-center justify-center px-2" style={{ bottom: 'calc(var(--bottom-nav-h, 0px) + 12px)', zIndex: 61 }}>
|
||||
<div className="vg-card flex items-center gap-1.5 sm:gap-2 px-2 sm:px-3 py-1.5 sm:py-2 rounded-full">
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={() => setMode('vacation')}
|
||||
className="flex items-center gap-1 sm:gap-1.5 px-2 sm:px-3 py-1.5 rounded-full text-[11px] sm:text-xs font-semibold transition-[background-color,color] duration-150 ease-[cubic-bezier(0.23,1,0.32,1)]"
|
||||
style={mode === 'vacation'
|
||||
@@ -229,7 +229,7 @@ export default function VacayCalendar() {
|
||||
{selectedUser ? selectedUser.username : t('vacay.modeVacation')}
|
||||
</button>
|
||||
{companyHolidaysEnabled && (
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={() => setMode('company')}
|
||||
className="flex items-center gap-1 sm:gap-1.5 px-2 sm:px-3 py-1.5 rounded-full text-[11px] sm:text-xs font-semibold transition-[background-color,color] duration-150 ease-[cubic-bezier(0.23,1,0.32,1)]"
|
||||
style={companyMode
|
||||
@@ -243,7 +243,7 @@ export default function VacayCalendar() {
|
||||
{/* Divider — comp/flex and half-day are modifiers, not modes. */}
|
||||
<span className="w-px self-stretch my-0.5" style={{ background: 'var(--vg-line)' }} aria-hidden />
|
||||
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={() => setCompDay(v => !v)}
|
||||
title={t('vacay.modeCompHint')}
|
||||
aria-pressed={compDay}
|
||||
@@ -262,7 +262,7 @@ export default function VacayCalendar() {
|
||||
{t('vacay.modeComp')}
|
||||
</button>
|
||||
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={() => setHalfDay(v => !v)}
|
||||
title={t('vacay.modeHalfHint')}
|
||||
aria-pressed={halfDay}
|
||||
|
||||
@@ -67,7 +67,7 @@ export default function VacayPersons() {
|
||||
<div className="vg-card rounded-[22px]" style={{ padding: '14px 18px' }}>
|
||||
<div className="flex items-center justify-between mb-2">
|
||||
<span style={{ fontSize: 11, fontWeight: 600, textTransform: 'uppercase', letterSpacing: '0.14em', color: 'var(--vg-ink3)' }}>{t('vacay.persons')}</span>
|
||||
<button onClick={() => { setShowInvite(true); loadAvailable() }}
|
||||
<button type="button" onClick={() => { setShowInvite(true); loadAvailable() }}
|
||||
className="w-7 h-7 rounded-lg flex items-center justify-center transition-colors"
|
||||
style={{ color: 'var(--vg-ink3)' }}>
|
||||
<UserPlus size={15} />
|
||||
@@ -88,7 +88,7 @@ export default function VacayPersons() {
|
||||
background: isSelected ? 'var(--vg-surf2)' : 'transparent',
|
||||
border: `1px solid ${isSelected ? 'var(--vg-line)' : 'transparent'}`,
|
||||
}}>
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={(e) => { e.stopPropagation(); setColorEditUserId(u.id); setShowColorPicker(true) }}
|
||||
className="w-3 h-3 rounded-full shrink-0 transition-transform hover:scale-125"
|
||||
style={{ backgroundColor: u.color, cursor: 'pointer' }}
|
||||
@@ -114,7 +114,7 @@ export default function VacayPersons() {
|
||||
{inv.username}
|
||||
</span>
|
||||
<VacayBadge label={t('vacay.pending')} tone="amber" />
|
||||
<button onClick={() => cancelInvite(inv.user_id)}
|
||||
<button type="button" onClick={() => cancelInvite(inv.user_id)}
|
||||
className="ml-auto opacity-0 group-hover:opacity-100 text-[10px] px-1.5 py-0.5 rounded transition-all"
|
||||
style={{ color: 'var(--vg-ink3)' }}>
|
||||
{t('common.cancel')}
|
||||
@@ -131,7 +131,7 @@ export default function VacayPersons() {
|
||||
onClick={e => e.stopPropagation()}>
|
||||
<div className="flex items-center justify-between p-5 border-b border-edge-secondary">
|
||||
<h2 className="text-base font-semibold text-content">{t('vacay.inviteUser')}</h2>
|
||||
<button onClick={() => setShowInvite(false)} className="p-1.5 rounded-lg transition-colors text-content-faint">
|
||||
<button type="button" onClick={() => setShowInvite(false)} className="p-1.5 rounded-lg transition-colors text-content-faint">
|
||||
<X size={16} />
|
||||
</button>
|
||||
</div>
|
||||
@@ -149,10 +149,10 @@ export default function VacayPersons() {
|
||||
/>
|
||||
)}
|
||||
<div className="flex gap-3 justify-end pt-2">
|
||||
<button onClick={() => setShowInvite(false)} className="px-4 py-2 text-sm rounded-lg text-content-muted border border-edge">
|
||||
<button type="button" onClick={() => setShowInvite(false)} className="px-4 py-2 text-sm rounded-lg text-content-muted border border-edge">
|
||||
{t('common.cancel')}
|
||||
</button>
|
||||
<button onClick={handleInvite} disabled={!selectedInviteUser || inviting}
|
||||
<button type="button" onClick={handleInvite} disabled={!selectedInviteUser || inviting}
|
||||
className="px-4 py-2 text-sm rounded-lg transition-colors flex items-center gap-1.5 disabled:opacity-40 bg-content text-surface-card">
|
||||
{inviting && <Loader2 size={13} className="animate-spin" />}
|
||||
{t('vacay.sendInvite')}
|
||||
@@ -172,14 +172,14 @@ export default function VacayPersons() {
|
||||
onClick={e => e.stopPropagation()}>
|
||||
<div className="flex items-center justify-between p-5 border-b border-edge-secondary">
|
||||
<h2 className="text-base font-semibold text-content">{t('vacay.changeColor')}</h2>
|
||||
<button onClick={() => { setShowColorPicker(false); setColorEditUserId(null) }} className="p-1.5 rounded-lg transition-colors text-content-faint">
|
||||
<button type="button" onClick={() => { setShowColorPicker(false); setColorEditUserId(null) }} className="p-1.5 rounded-lg transition-colors text-content-faint">
|
||||
<X size={16} />
|
||||
</button>
|
||||
</div>
|
||||
<div className="p-5">
|
||||
<div className="flex flex-wrap gap-2 justify-center">
|
||||
{PRESET_COLORS.map(c => (
|
||||
<button key={c} onClick={() => handleColorChange(c)}
|
||||
<button type="button" key={c} onClick={() => handleColorChange(c)}
|
||||
className={`w-8 h-8 rounded-full transition-transform duration-150 ease-[cubic-bezier(0.23,1,0.32,1)] ${editingUserColor === c ? 'ring-2 ring-offset-2 scale-110' : 'hover:scale-110'}`}
|
||||
style={{ backgroundColor: c }} />
|
||||
))}
|
||||
|
||||
@@ -76,7 +76,7 @@ export default function VacaySettings({ onClose }: VacaySettingsProps) {
|
||||
const current: number[] = plan.weekend_days ? String(plan.weekend_days).split(',').map(Number) : [0, 6]
|
||||
const active = current.includes(day)
|
||||
return (
|
||||
<button key={day} onClick={() => {
|
||||
<button type="button" key={day} onClick={() => {
|
||||
const next = active ? current.filter(d => d !== day) : [...current, day]
|
||||
updatePlan({ weekend_days: next.join(',') })
|
||||
}}
|
||||
@@ -111,7 +111,7 @@ export default function VacaySettings({ onClose }: VacaySettingsProps) {
|
||||
].map(({ value, label }) => {
|
||||
const active = (plan.week_start ?? 1) === value
|
||||
return (
|
||||
<button key={value} onClick={() => updatePlan({ week_start: value })}
|
||||
<button type="button" key={value} onClick={() => updatePlan({ week_start: value })}
|
||||
style={{
|
||||
padding: '4px 10px', borderRadius: 8, fontSize: 'calc(12px * var(--fs-scale-body, 1))', fontWeight: 600, cursor: 'pointer',
|
||||
fontFamily: 'inherit', border: '1px solid', transition: 'all 0.12s',
|
||||
@@ -194,7 +194,7 @@ export default function VacaySettings({ onClose }: VacaySettingsProps) {
|
||||
onCancel={() => setShowAddForm(false)}
|
||||
/>
|
||||
) : (
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={() => setShowAddForm(true)}
|
||||
className="w-full flex items-center justify-center gap-1.5 text-xs font-medium py-2.5 rounded-xl border border-dashed transition-colors"
|
||||
style={{ borderColor: 'var(--vg-line2)', background: 'var(--vg-surf)', color: 'var(--vg-ink2)' }}
|
||||
@@ -242,7 +242,7 @@ export default function VacaySettings({ onClose }: VacaySettingsProps) {
|
||||
onCancel={() => setShowAddSchoolForm(false)}
|
||||
/>
|
||||
) : (
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={() => setShowAddSchoolForm(true)}
|
||||
className="flex items-center gap-1.5 text-xs px-2 py-1.5 rounded-md transition-colors text-content-muted bg-surface-secondary"
|
||||
>
|
||||
@@ -278,7 +278,7 @@ export default function VacaySettings({ onClose }: VacaySettingsProps) {
|
||||
))}
|
||||
</div>
|
||||
<div className="px-4 py-3 border-t border-t-[rgba(239,68,68,0.1)]">
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={async () => {
|
||||
await dissolve()
|
||||
toast.success(t('vacay.dissolved'))
|
||||
@@ -363,7 +363,7 @@ function YearTypePicker() {
|
||||
<div className="flex-1 min-w-0">
|
||||
<CustomSelect
|
||||
value={String(yearSettings.year_start_month)}
|
||||
onChange={v => save({ year_start_month: parseInt(String(v), 10) })}
|
||||
onChange={v => save({ year_start_month: Number.parseInt(String(v), 10) })}
|
||||
options={monthNames.map((label, i) => ({ value: String(i + 1), label }))}
|
||||
placeholder={t('vacay.yearStartMonth')}
|
||||
/>
|
||||
@@ -371,7 +371,7 @@ function YearTypePicker() {
|
||||
<div className="w-[92px] shrink-0">
|
||||
<CustomSelect
|
||||
value={String(yearSettings.year_start_day)}
|
||||
onChange={v => save({ year_start_day: parseInt(String(v), 10) })}
|
||||
onChange={v => save({ year_start_day: Number.parseInt(String(v), 10) })}
|
||||
options={Array.from({ length: maxDay }, (_, i) => ({ value: String(i + 1), label: String(i + 1) }))}
|
||||
placeholder={t('vacay.yearStartDay')}
|
||||
/>
|
||||
@@ -425,7 +425,7 @@ function SettingToggle({ icon: Icon, label, hint, value, onChange }: SettingTogg
|
||||
<p className="text-[11px] text-content-faint">{hint}</p>
|
||||
</div>
|
||||
</div>
|
||||
<button onClick={onChange}
|
||||
<button type="button" onClick={onChange}
|
||||
className={`relative shrink-0 inline-flex h-6 w-11 items-center rounded-full transition-colors ${value ? 'bg-content' : 'bg-edge'}`}>
|
||||
<span className="absolute left-1 h-4 w-4 rounded-full transition-transform duration-200 bg-surface-card"
|
||||
style={{ transform: value ? 'translateX(20px)' : 'translateX(0)' }} />
|
||||
@@ -485,7 +485,7 @@ function CalendarRow({ cal, countries, calendarType, onUpdate, onDelete }: {
|
||||
return (
|
||||
<div className="flex gap-3 items-start p-3 rounded-xl" style={{ background: 'var(--vg-surf)', border: '1px solid var(--vg-line)' }}>
|
||||
<div style={{ position: 'relative', flexShrink: 0 }}>
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={() => setShowColorPicker(!showColorPicker)}
|
||||
style={{ width: 28, height: 28, borderRadius: 8, background: localColor, border: '2px solid var(--border-primary)', cursor: 'pointer' }}
|
||||
title={t('vacay.calendarColor')}
|
||||
@@ -493,7 +493,7 @@ function CalendarRow({ cal, countries, calendarType, onUpdate, onDelete }: {
|
||||
{showColorPicker && (
|
||||
<div style={{ position: 'absolute', top: 34, left: 0, zIndex: 50, background: 'var(--bg-card)', border: '1px solid var(--border-primary)', borderRadius: 12, padding: 8, boxShadow: '0 8px 24px rgba(0,0,0,0.12)', display: 'grid', gridTemplateColumns: 'repeat(4, 1fr)', gap: 4, width: 120 }}>
|
||||
{PRESET_COLORS.map(c => (
|
||||
<button key={c} onClick={() => { setLocalColor(c); setShowColorPicker(false); if (c !== cal.color) onUpdate({ color: c }) }}
|
||||
<button type="button" key={c} onClick={() => { setLocalColor(c); setShowColorPicker(false); if (c !== cal.color) onUpdate({ color: c }) }}
|
||||
style={{ width: 24, height: 24, borderRadius: 6, background: c, border: localColor === c ? '2px solid var(--text-primary)' : '2px solid transparent', cursor: 'pointer' }} />
|
||||
))}
|
||||
</div>
|
||||
@@ -526,7 +526,7 @@ function CalendarRow({ cal, countries, calendarType, onUpdate, onDelete }: {
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={onDelete}
|
||||
className="shrink-0 p-1.5 rounded-md transition-colors text-content-faint"
|
||||
onMouseEnter={e => { (e.currentTarget as HTMLButtonElement).style.background = 'rgba(239,68,68,0.1)' }}
|
||||
@@ -568,7 +568,7 @@ function AddCalendarForm({ countries, calendarType, onAdd, onCancel, defaultColo
|
||||
return (
|
||||
<div className="flex gap-3 items-start p-3 rounded-xl border border-dashed" style={{ borderColor: 'var(--vg-line2)', background: 'var(--vg-surf)' }}>
|
||||
<div style={{ position: 'relative', flexShrink: 0 }}>
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={() => setShowColorPicker(!showColorPicker)}
|
||||
style={{ width: 28, height: 28, borderRadius: 8, background: color, border: '2px solid var(--border-primary)', cursor: 'pointer' }}
|
||||
title={t('vacay.calendarColor')}
|
||||
@@ -576,7 +576,7 @@ function AddCalendarForm({ countries, calendarType, onAdd, onCancel, defaultColo
|
||||
{showColorPicker && (
|
||||
<div style={{ position: 'absolute', top: 34, left: 0, zIndex: 50, background: 'var(--bg-card)', border: '1px solid var(--border-primary)', borderRadius: 12, padding: 8, boxShadow: '0 8px 24px rgba(0,0,0,0.12)', display: 'grid', gridTemplateColumns: 'repeat(4, 1fr)', gap: 4, width: 120 }}>
|
||||
{PRESET_COLORS.map(c => (
|
||||
<button key={c} onClick={() => { setColor(c); setShowColorPicker(false) }}
|
||||
<button type="button" key={c} onClick={() => { setColor(c); setShowColorPicker(false) }}
|
||||
style={{ width: 24, height: 24, borderRadius: 6, background: c, border: color === c ? '2px solid var(--text-primary)' : '2px solid transparent', cursor: 'pointer' }} />
|
||||
))}
|
||||
</div>
|
||||
@@ -607,7 +607,7 @@ function AddCalendarForm({ countries, calendarType, onAdd, onCancel, defaultColo
|
||||
/>
|
||||
)}
|
||||
<div className="flex gap-1.5 pt-0.5">
|
||||
<button
|
||||
<button type="button"
|
||||
disabled={!canAdd}
|
||||
aria-busy={loadingRegions}
|
||||
onClick={() => onAdd({ region: region || selectedCountry, color, label: label.trim() || null })}
|
||||
@@ -616,7 +616,7 @@ function AddCalendarForm({ countries, calendarType, onAdd, onCancel, defaultColo
|
||||
{loadingRegions && <Loader2 size={12} className="animate-spin" />}
|
||||
{t('vacay.add')}
|
||||
</button>
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={onCancel}
|
||||
className="text-xs px-2 py-1.5 rounded-md transition-colors bg-surface-secondary text-content-muted"
|
||||
>
|
||||
|
||||
@@ -61,7 +61,7 @@ export default function VacaySharedCalendars() {
|
||||
<div className="vg-card rounded-[22px]" style={{ padding: '14px 18px' }}>
|
||||
<div className="flex items-center justify-between mb-2">
|
||||
<span style={{ fontSize: 11, fontWeight: 600, textTransform: 'uppercase', letterSpacing: '0.14em', color: 'var(--vg-ink3)' }}>{t('vacay.sharedCalendars')}</span>
|
||||
<button onClick={() => { setShowShare(true); loadAvailable() }}
|
||||
<button type="button" onClick={() => { setShowShare(true); loadAvailable() }}
|
||||
className="w-7 h-7 rounded-lg flex items-center justify-center transition-colors"
|
||||
style={{ color: 'var(--vg-ink3)' }}
|
||||
title={t('vacay.shareCalendar')}>
|
||||
@@ -88,7 +88,7 @@ export default function VacaySharedCalendars() {
|
||||
</span>
|
||||
<VacayBadge label={t('vacay.viewOnly')} />
|
||||
<span className="ml-auto flex items-center gap-1">
|
||||
<button onClick={e => { e.stopPropagation(); handleRemove(s.id) }}
|
||||
<button type="button" onClick={e => { e.stopPropagation(); handleRemove(s.id) }}
|
||||
className="opacity-0 group-hover:opacity-100 w-5 h-5 rounded flex items-center justify-center transition-all"
|
||||
style={{ color: 'var(--vg-ink3)' }}
|
||||
title={t('vacay.remove')}>
|
||||
@@ -115,7 +115,7 @@ export default function VacaySharedCalendars() {
|
||||
<span className="truncate min-w-0" style={{ fontSize: 13, color: 'var(--vg-ink2)' }}>
|
||||
{s.username}
|
||||
</span>
|
||||
<button onClick={() => handleRemove(s.id)}
|
||||
<button type="button" onClick={() => handleRemove(s.id)}
|
||||
className="ml-auto opacity-0 group-hover:opacity-100 text-[10px] px-1.5 py-0.5 rounded transition-all"
|
||||
style={{ color: 'var(--vg-ink3)' }}>
|
||||
{t('vacay.stopSharing')}
|
||||
@@ -133,7 +133,7 @@ export default function VacaySharedCalendars() {
|
||||
onClick={e => e.stopPropagation()}>
|
||||
<div className="flex items-center justify-between p-5 border-b border-edge-secondary">
|
||||
<h2 className="text-base font-semibold text-content">{t('vacay.shareCalendar')}</h2>
|
||||
<button onClick={() => setShowShare(false)} className="p-1.5 rounded-lg transition-colors text-content-faint">
|
||||
<button type="button" onClick={() => setShowShare(false)} className="p-1.5 rounded-lg transition-colors text-content-faint">
|
||||
<X size={16} />
|
||||
</button>
|
||||
</div>
|
||||
@@ -151,10 +151,10 @@ export default function VacaySharedCalendars() {
|
||||
/>
|
||||
)}
|
||||
<div className="flex gap-3 justify-end pt-2">
|
||||
<button onClick={() => setShowShare(false)} className="px-4 py-2 text-sm rounded-lg text-content-muted border border-edge">
|
||||
<button type="button" onClick={() => setShowShare(false)} className="px-4 py-2 text-sm rounded-lg text-content-muted border border-edge">
|
||||
{t('common.cancel')}
|
||||
</button>
|
||||
<button onClick={handleShare} disabled={!selectedUser || sharing}
|
||||
<button type="button" onClick={handleShare} disabled={!selectedUser || sharing}
|
||||
className="px-4 py-2 text-sm rounded-lg transition-colors flex items-center gap-1.5 disabled:opacity-40 bg-content text-surface-card">
|
||||
{sharing && <Loader2 size={13} className="animate-spin" />}
|
||||
{t('vacay.share')}
|
||||
|
||||
@@ -49,7 +49,7 @@ export default function VacayStats() {
|
||||
<div className="vg-card rounded-[22px]" style={{ padding: '14px 18px' }}>
|
||||
{/* The whole header is the fold handle — the sidebar gets long once several
|
||||
people are fused in, and this card is the one you stop needing. */}
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={toggleCollapsed}
|
||||
aria-expanded={!collapsed}
|
||||
className={`w-full flex items-start gap-2 text-left ${collapsed ? '' : 'mb-2.5'}`}
|
||||
@@ -116,7 +116,7 @@ function StatCard({ stat: s, isMe, canEdit, selectedYear, isShiftedYear, onSave,
|
||||
|
||||
const handleSave = () => {
|
||||
setEditing(false)
|
||||
const days = parseInt(String(localDays))
|
||||
const days = Number.parseInt(String(localDays))
|
||||
if (!isNaN(days) && days >= 0 && days <= 365 && days !== s.vacation_days) {
|
||||
onSave(selectedYear, days, s.user_id)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user