mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-26 06:37:33 +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:
@@ -104,7 +104,7 @@ function AdminPageDesktop(): React.ReactElement {
|
||||
<p className="text-sm font-semibold text-amber-900">Demo Baseline</p>
|
||||
<p className="text-xs text-amber-700">Save current state as the hourly reset point. All admin trips and settings will be preserved.</p>
|
||||
</div>
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={async () => {
|
||||
try {
|
||||
await adminApi.saveDemoBaseline()
|
||||
|
||||
@@ -183,7 +183,7 @@ function AtlasPageDesktop(): React.ReactElement {
|
||||
|
||||
{confirmAction.type === 'choose' && (
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>
|
||||
<button onClick={async () => {
|
||||
<button type="button" onClick={async () => {
|
||||
try {
|
||||
await apiClient.post(`/addons/atlas/country/${confirmAction.code}/mark`)
|
||||
setData(prev => (prev ? withCountryMarkedVisited(prev, confirmAction.code) : prev))
|
||||
@@ -217,7 +217,7 @@ function AtlasPageDesktop(): React.ReactElement {
|
||||
const wishlistItems = bucketList.filter(b => b.country_code === confirmAction.code)
|
||||
if (wishlistItems.length === 0) return null
|
||||
return (
|
||||
<button onClick={async () => {
|
||||
<button type="button" onClick={async () => {
|
||||
await Promise.all(wishlistItems.map(item => handleDeleteBucketItem(item.id)))
|
||||
setConfirmAction(null)
|
||||
}}
|
||||
@@ -285,12 +285,12 @@ function AtlasPageDesktop(): React.ReactElement {
|
||||
<>
|
||||
<p className="text-content-muted" style={{ margin: '0 0 20px', fontSize: 'calc(13px * var(--fs-scale-body, 1))' }}>{t('atlas.confirmUnmark')}</p>
|
||||
<div style={{ display: 'flex', gap: 8, justifyContent: 'center' }}>
|
||||
<button onClick={() => setConfirmAction(null)}
|
||||
<button type="button" onClick={() => setConfirmAction(null)}
|
||||
className="border border-edge text-content-muted"
|
||||
style={{ padding: '8px 20px', borderRadius: 10, background: 'none', fontSize: 'calc(13px * var(--fs-scale-body, 1))', cursor: 'pointer', fontFamily: 'inherit' }}>
|
||||
{t('common.cancel')}
|
||||
</button>
|
||||
<button onClick={executeConfirmAction}
|
||||
<button type="button" onClick={executeConfirmAction}
|
||||
className="bg-[#ef4444] text-white"
|
||||
style={{ padding: '8px 20px', borderRadius: 10, border: 'none', fontSize: 'calc(13px * var(--fs-scale-body, 1))', fontWeight: 600, cursor: 'pointer', fontFamily: 'inherit' }}>
|
||||
{t('atlas.unmark')}
|
||||
@@ -306,7 +306,7 @@ function AtlasPageDesktop(): React.ReactElement {
|
||||
)}
|
||||
<p className="text-content-muted" style={{ margin: '0 0 20px', fontSize: 'calc(13px * var(--fs-scale-body, 1))' }}>{t('atlas.confirmUnmarkRegion')}</p>
|
||||
<div style={{ display: 'flex', gap: 8, justifyContent: 'center' }}>
|
||||
<button onClick={() => setConfirmAction(null)}
|
||||
<button type="button" onClick={() => setConfirmAction(null)}
|
||||
className="border border-edge text-content-muted"
|
||||
style={{ padding: '8px 20px', borderRadius: 10, background: 'none', fontSize: 'calc(13px * var(--fs-scale-body, 1))', cursor: 'pointer', fontFamily: 'inherit' }}>
|
||||
{t('common.cancel')}
|
||||
@@ -391,7 +391,7 @@ function AtlasPageDesktop(): React.ReactElement {
|
||||
style={{ padding: '8px 20px', borderRadius: 10, background: 'none', fontSize: 'calc(13px * var(--fs-scale-body, 1))', cursor: 'pointer', fontFamily: 'inherit' }}>
|
||||
{t('common.back')}
|
||||
</button>
|
||||
<button onClick={async () => {
|
||||
<button type="button" onClick={async () => {
|
||||
const targetDate = bucketMonth > 0 && bucketYear > 0 ? `${bucketYear}-${String(bucketMonth).padStart(2, '0')}` : null
|
||||
// #1898: one entry per target date. The dialog stays open on a
|
||||
// duplicate so another month can be picked right away.
|
||||
@@ -424,12 +424,12 @@ function AtlasPageDesktop(): React.ReactElement {
|
||||
<>
|
||||
<p className="text-content-muted" style={{ margin: '0 0 20px', fontSize: 'calc(13px * var(--fs-scale-body, 1))' }}>{t('atlas.confirmMark')}</p>
|
||||
<div style={{ display: 'flex', gap: 8, justifyContent: 'center' }}>
|
||||
<button onClick={() => setConfirmAction(null)}
|
||||
<button type="button" onClick={() => setConfirmAction(null)}
|
||||
className="border border-edge text-content-muted"
|
||||
style={{ padding: '8px 20px', borderRadius: 10, background: 'none', fontSize: 'calc(13px * var(--fs-scale-body, 1))', cursor: 'pointer', fontFamily: 'inherit' }}>
|
||||
{t('common.cancel')}
|
||||
</button>
|
||||
<button onClick={executeConfirmAction}
|
||||
<button type="button" onClick={executeConfirmAction}
|
||||
className="bg-content text-white"
|
||||
style={{ padding: '8px 20px', borderRadius: 10, border: 'none', fontSize: 'calc(13px * var(--fs-scale-body, 1))', fontWeight: 600, cursor: 'pointer', fontFamily: 'inherit' }}>
|
||||
{t('atlas.markVisited')}
|
||||
@@ -506,7 +506,7 @@ function SidebarContent({ data, stats, countries, selectedCountry, countryDetail
|
||||
const tabBar = (
|
||||
<div style={{ display: 'flex', gap: 4, padding: '12px 16px 0', marginBottom: 4 }}>
|
||||
{[{ id: 'stats', label: t('atlas.statsTab'), icon: Globe }, { id: 'bucket', label: t('atlas.bucketTab'), icon: Star }].map(tab => (
|
||||
<button key={tab.id} onClick={() => setBucketTab(tab.id as any)}
|
||||
<button type="button" key={tab.id} onClick={() => setBucketTab(tab.id as any)}
|
||||
style={{
|
||||
flex: 1, display: 'flex', alignItems: 'center', justifyContent: 'center', gap: 5,
|
||||
padding: '7px 0', borderRadius: 10, border: 'none', cursor: 'pointer', fontFamily: 'inherit',
|
||||
@@ -552,7 +552,7 @@ function SidebarContent({ data, stats, countries, selectedCountry, countryDetail
|
||||
return <span className="text-[9px] mt-0.5 text-center" style={{ color: tf }}>{label}</span>
|
||||
})()}
|
||||
{!item.target_date && item.notes && <span className="text-[9px] mt-0.5 text-center" style={{ color: tf, maxWidth: 90, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>{item.notes}</span>}
|
||||
<button onClick={() => onDeleteBucket(item.id)}
|
||||
<button type="button" onClick={() => onDeleteBucket(item.id)}
|
||||
className="opacity-0 group-hover:opacity-100"
|
||||
style={{ position: 'absolute', top: 4, right: 4, background: 'none', border: 'none', cursor: 'pointer', padding: 2, color: tf, display: 'flex', transition: 'opacity 0.15s' }}>
|
||||
<X size={10} />
|
||||
@@ -579,7 +579,7 @@ function SidebarContent({ data, stats, countries, selectedCountry, countryDetail
|
||||
style={{ flex: 1, padding: '6px 10px', borderRadius: 8, fontSize: 'calc(12px * var(--fs-scale-body, 1))', fontFamily: 'inherit', outline: 'none', boxSizing: 'border-box' }}
|
||||
/>
|
||||
{!bucketForm.name && (
|
||||
<button onClick={onSearchBucket} disabled={bucketSearching}
|
||||
<button type="button" onClick={onSearchBucket} disabled={bucketSearching}
|
||||
className="bg-accent text-accent-text"
|
||||
style={{ padding: '6px 10px', borderRadius: 8, border: 'none', cursor: 'pointer', display: 'flex', alignItems: 'center' }}>
|
||||
<Search size={12} />
|
||||
@@ -616,7 +616,7 @@ function SidebarContent({ data, stats, countries, selectedCountry, countryDetail
|
||||
zIndex: 99999, borderRadius: 8, boxShadow: '0 4px 12px rgba(0,0,0,0.12)', overflowY: 'auto',
|
||||
}}>
|
||||
{bucketSearchResults.slice(0, 6).map((r, i) => (
|
||||
<button key={i} onClick={() => onSelectBucketPoi(r)} className="border-b border-edge-faint" style={{ display: 'flex', flexDirection: 'column', gap: 1, width: '100%', padding: '6px 10px', borderTop: 'none', borderLeft: 'none', borderRight: 'none', background: 'none', cursor: 'pointer', textAlign: 'left', fontFamily: 'inherit' }}>
|
||||
<button type="button" key={i} onClick={() => onSelectBucketPoi(r)} className="border-b border-edge-faint" style={{ display: 'flex', flexDirection: 'column', gap: 1, width: '100%', padding: '6px 10px', borderTop: 'none', borderLeft: 'none', borderRight: 'none', background: 'none', cursor: 'pointer', textAlign: 'left', fontFamily: 'inherit' }}>
|
||||
<span className="text-content" style={{ fontSize: 'calc(12px * var(--fs-scale-body, 1))', fontWeight: 500 }}>{r.name}</span>
|
||||
{r.address && <span className="text-content-faint" style={{ fontSize: 'calc(10px * var(--fs-scale-caption, 1))' }}>{r.address}</span>}
|
||||
</button>
|
||||
@@ -643,12 +643,12 @@ function SidebarContent({ data, stats, countries, selectedCountry, countryDetail
|
||||
</div>
|
||||
</div>
|
||||
<div style={{ display: 'flex', gap: 6, justifyContent: 'flex-end' }}>
|
||||
<button onClick={() => { setShowBucketAdd(false); setBucketForm({ name: '', notes: '', lat: '', lng: '', target_date: '' }); setBucketSearch(''); setBucketSearchResults([]); setBucketPoiMonth(0); setBucketPoiYear(0) }}
|
||||
<button type="button" onClick={() => { setShowBucketAdd(false); setBucketForm({ name: '', notes: '', lat: '', lng: '', target_date: '' }); setBucketSearch(''); setBucketSearchResults([]); setBucketPoiMonth(0); setBucketPoiYear(0) }}
|
||||
className="border border-edge text-content-muted"
|
||||
style={{ fontSize: 'calc(11px * var(--fs-scale-caption, 1))', padding: '4px 10px', borderRadius: 6, background: 'none', cursor: 'pointer', fontFamily: 'inherit' }}>
|
||||
{t('common.cancel')}
|
||||
</button>
|
||||
<button onClick={onAddBucket} disabled={!bucketForm.name.trim()}
|
||||
<button type="button" onClick={onAddBucket} disabled={!bucketForm.name.trim()}
|
||||
className="bg-[#fbbf24] text-[#1a1a1a]"
|
||||
style={{ fontSize: 'calc(11px * var(--fs-scale-caption, 1))', padding: '4px 12px', borderRadius: 6, border: 'none', fontWeight: 600, cursor: 'pointer', fontFamily: 'inherit', opacity: bucketForm.name.trim() ? 1 : 0.5 }}>
|
||||
{t('common.add')}
|
||||
@@ -657,7 +657,7 @@ function SidebarContent({ data, stats, countries, selectedCountry, countryDetail
|
||||
</div>
|
||||
) : (
|
||||
<div style={{ padding: '4px 16px 8px' }}>
|
||||
<button onClick={() => setShowBucketAdd(true)}
|
||||
<button type="button" onClick={() => setShowBucketAdd(true)}
|
||||
className="border border-dashed border-edge"
|
||||
style={{ display: 'flex', alignItems: 'center', justifyContent: 'center', gap: 4, width: '100%', padding: '5px 0', borderRadius: 8, background: 'none', fontSize: 'calc(11px * var(--fs-scale-caption, 1))', color: tf, cursor: 'pointer', fontFamily: 'inherit' }}>
|
||||
<Plus size={11} /> {t('atlas.addPoi')}
|
||||
@@ -756,7 +756,7 @@ function SidebarContent({ data, stats, countries, selectedCountry, countryDetail
|
||||
<p className="text-[10px] mb-1" style={{ color: tf }}>{countryDetail.places.length} {t('atlas.places')} · {countryDetail.trips.length} {t('atlas.tripPlural')}</p>
|
||||
<div className="flex flex-wrap gap-1">
|
||||
{countryDetail.trips.slice(0, 3).map(trip => (
|
||||
<button key={trip.id} onClick={() => onTripClick(trip.id)}
|
||||
<button type="button" key={trip.id} onClick={() => onTripClick(trip.id)}
|
||||
className="flex items-center gap-1 px-2 py-0.5 rounded text-[10px] font-semibold transition-opacity hover:opacity-75"
|
||||
style={{ background: bg(0.08), color: tp }}>
|
||||
<Briefcase size={9} style={{ color: tm }} />
|
||||
@@ -764,7 +764,7 @@ function SidebarContent({ data, stats, countries, selectedCountry, countryDetail
|
||||
</button>
|
||||
))}
|
||||
{countryDetail.manually_marked && onUnmarkCountry && (
|
||||
<button onClick={() => onUnmarkCountry(selectedCountry!)}
|
||||
<button type="button" onClick={() => onUnmarkCountry(selectedCountry!)}
|
||||
className="flex items-center gap-1 px-2 py-0.5 rounded text-[10px] font-semibold transition-opacity hover:opacity-75 bg-[rgba(239,68,68,0.1)] text-[#ef4444]">
|
||||
<X size={9} />
|
||||
{t('atlas.unmark')}
|
||||
|
||||
@@ -151,7 +151,7 @@ function DashboardPageDesktop(): React.ReactElement {
|
||||
{loadError && (
|
||||
<div className="dash-error" role="alert">
|
||||
<span className="dash-error-txt">{t('dashboard.loadErrorBanner')}</span>
|
||||
<button className="dash-error-retry" onClick={retryLoad}>
|
||||
<button type="button" className="dash-error-retry" onClick={retryLoad}>
|
||||
<RefreshCw size={15} />
|
||||
{t('dashboard.retry')}
|
||||
</button>
|
||||
@@ -177,11 +177,11 @@ function DashboardPageDesktop(): React.ReactElement {
|
||||
<h3 className="sec-title">{t('dashboard.title')}</h3>
|
||||
<div className="sec-tools">
|
||||
<div className="seg">
|
||||
<button className={tripFilter === 'planned' ? 'on' : ''} onClick={() => setTripFilter('planned')}>{t('dashboard.filter.planned')}</button>
|
||||
<button className={tripFilter === 'archive' ? 'on' : ''} onClick={() => setTripFilter('archive')}>{t('dashboard.archived')}</button>
|
||||
<button className={tripFilter === 'completed' ? 'on' : ''} onClick={() => setTripFilter('completed')}>{t('dashboard.mobile.completed')}</button>
|
||||
<button type="button" className={tripFilter === 'planned' ? 'on' : ''} onClick={() => setTripFilter('planned')}>{t('dashboard.filter.planned')}</button>
|
||||
<button type="button" className={tripFilter === 'archive' ? 'on' : ''} onClick={() => setTripFilter('archive')}>{t('dashboard.archived')}</button>
|
||||
<button type="button" className={tripFilter === 'completed' ? 'on' : ''} onClick={() => setTripFilter('completed')}>{t('dashboard.mobile.completed')}</button>
|
||||
</div>
|
||||
<button
|
||||
<button type="button"
|
||||
className="tool-action"
|
||||
aria-label="Subscribe to all trips calendar"
|
||||
title="Subscribe to all trips"
|
||||
@@ -190,7 +190,7 @@ function DashboardPageDesktop(): React.ReactElement {
|
||||
>
|
||||
<CalendarPlus size={17} />
|
||||
</button>
|
||||
<button className="tool-action" aria-label={t('dashboard.aria.toggleView')} onClick={toggleViewMode} style={{ width: 38, height: 38, borderRadius: 11 }}>
|
||||
<button type="button" className="tool-action" aria-label={t('dashboard.aria.toggleView')} onClick={toggleViewMode} style={{ width: 38, height: 38, borderRadius: 11 }}>
|
||||
{viewMode === 'grid' ? <List size={17} /> : <LayoutGrid size={17} />}
|
||||
</button>
|
||||
</div>
|
||||
@@ -228,7 +228,7 @@ function DashboardPageDesktop(): React.ReactElement {
|
||||
/>
|
||||
))}
|
||||
{tripFilter === 'planned' && !isLoading && (
|
||||
<button className="add-trip-card" onClick={() => { setEditingTrip(null); setShowForm(true) }}>
|
||||
<button type="button" className="add-trip-card" onClick={() => { setEditingTrip(null); setShowForm(true) }}>
|
||||
<div>
|
||||
<div className="circ"><Plus size={20} /></div>
|
||||
<div className="ttl">{t('dashboard.newTrip')}</div>
|
||||
@@ -252,7 +252,7 @@ function DashboardPageDesktop(): React.ReactElement {
|
||||
</main>
|
||||
</div>
|
||||
|
||||
<button
|
||||
<button type="button"
|
||||
className="fab-new-trip"
|
||||
onClick={() => { setEditingTrip(null); setShowForm(true) }}
|
||||
aria-label={t('dashboard.newTrip')}
|
||||
@@ -405,10 +405,10 @@ function BoardingPassHero({ trip, bundle, locale, onOpen, onEdit, onCopy, onArch
|
||||
{badge}
|
||||
</div>
|
||||
<div className="hero-tools">
|
||||
<button className="hero-tool" aria-label={t('common.edit')} title={t('common.edit')} onClick={(e) => stop(e, onEdit)}><Edit2 size={17} strokeWidth={2.2} /></button>
|
||||
<button className="hero-tool" aria-label={t('dashboard.aria.duplicate')} title={t('dashboard.aria.duplicate')} onClick={(e) => stop(e, onCopy)}><Copy size={17} strokeWidth={2.2} /></button>
|
||||
<button className="hero-tool" aria-label={archiveLabel} title={archiveLabel} onClick={(e) => stop(e, onArchive)}>{trip.is_archived ? <ArchiveRestore size={17} strokeWidth={2.2} /> : <Archive size={17} strokeWidth={2.2} />}</button>
|
||||
<button className="hero-tool" aria-label={t('common.delete')} title={t('common.delete')} onClick={(e) => stop(e, onDelete)}><Trash2 size={17} strokeWidth={2.2} /></button>
|
||||
<button type="button" className="hero-tool" aria-label={t('common.edit')} title={t('common.edit')} onClick={(e) => stop(e, onEdit)}><Edit2 size={17} strokeWidth={2.2} /></button>
|
||||
<button type="button" className="hero-tool" aria-label={t('dashboard.aria.duplicate')} title={t('dashboard.aria.duplicate')} onClick={(e) => stop(e, onCopy)}><Copy size={17} strokeWidth={2.2} /></button>
|
||||
<button type="button" className="hero-tool" aria-label={archiveLabel} title={archiveLabel} onClick={(e) => stop(e, onArchive)}>{trip.is_archived ? <ArchiveRestore size={17} strokeWidth={2.2} /> : <Archive size={17} strokeWidth={2.2} />}</button>
|
||||
<button type="button" className="hero-tool" aria-label={t('common.delete')} title={t('common.delete')} onClick={(e) => stop(e, onDelete)}><Trash2 size={17} strokeWidth={2.2} /></button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -559,10 +559,10 @@ function TripCard({ trip, locale, badges, onOpen, onEdit, onCopy, onArchive, onD
|
||||
: <div style={{ width: '100%', height: '100%', background: tripGradient(trip.id) }} />}
|
||||
<div className={`trip-status ${statusClass}`}><span className="indicator" /> {statusLabel}</div>
|
||||
<div className="trip-actions">
|
||||
<button className="trip-action-btn" aria-label={t('common.edit')} title={t('common.edit')} onClick={(e) => stop(e, onEdit)}><Edit2 size={17} strokeWidth={2.2} /></button>
|
||||
<button className="trip-action-btn" aria-label={t('dashboard.aria.duplicate')} title={t('dashboard.aria.duplicate')} onClick={(e) => stop(e, onCopy)}><Copy size={17} strokeWidth={2.2} /></button>
|
||||
<button className="trip-action-btn" aria-label={archiveLabel} title={archiveLabel} onClick={(e) => stop(e, onArchive)}>{trip.is_archived ? <ArchiveRestore size={17} strokeWidth={2.2} /> : <Archive size={17} strokeWidth={2.2} />}</button>
|
||||
<button className="trip-action-btn" aria-label={t('common.delete')} title={t('common.delete')} onClick={(e) => stop(e, onDelete)}><Trash2 size={17} strokeWidth={2.2} /></button>
|
||||
<button type="button" className="trip-action-btn" aria-label={t('common.edit')} title={t('common.edit')} onClick={(e) => stop(e, onEdit)}><Edit2 size={17} strokeWidth={2.2} /></button>
|
||||
<button type="button" className="trip-action-btn" aria-label={t('dashboard.aria.duplicate')} title={t('dashboard.aria.duplicate')} onClick={(e) => stop(e, onCopy)}><Copy size={17} strokeWidth={2.2} /></button>
|
||||
<button type="button" className="trip-action-btn" aria-label={archiveLabel} title={archiveLabel} onClick={(e) => stop(e, onArchive)}>{trip.is_archived ? <ArchiveRestore size={17} strokeWidth={2.2} /> : <Archive size={17} strokeWidth={2.2} />}</button>
|
||||
<button type="button" className="trip-action-btn" aria-label={t('common.delete')} title={t('common.delete')} onClick={(e) => stop(e, onDelete)}><Trash2 size={17} strokeWidth={2.2} /></button>
|
||||
</div>
|
||||
<div className="trip-cover-content">
|
||||
<h3 className="trip-name">{trip.title}</h3>
|
||||
@@ -636,7 +636,7 @@ function CurrencyTool(): React.ReactElement {
|
||||
const currencies = rates ? Object.keys(rates).sort() : CURRENCIES
|
||||
const ccyOptions = currencies.map(c => ({ value: c, label: c }))
|
||||
const rate = rates?.[to] ?? null
|
||||
const converted = rate != null ? (parseFloat(amount.replace(',', '.')) || 0) * rate : null
|
||||
const converted = rate != null ? (Number.parseFloat(amount.replace(',', '.')) || 0) * rate : null
|
||||
|
||||
const swap = () => { setFrom(to); setTo(from) }
|
||||
|
||||
@@ -644,7 +644,7 @@ function CurrencyTool(): React.ReactElement {
|
||||
<div className="tool">
|
||||
<div className="tool-head">
|
||||
<div className="tool-title"><RefreshCw size={14} /> {t('dashboard.currency')}</div>
|
||||
<button className="tool-action" aria-label={t('dashboard.aria.refreshRates')} onClick={fetchRate}><RefreshCw size={14} /></button>
|
||||
<button type="button" className="tool-action" aria-label={t('dashboard.aria.refreshRates')} onClick={fetchRate}><RefreshCw size={14} /></button>
|
||||
</div>
|
||||
<div className="fx-input">
|
||||
<div className="fx-field">
|
||||
@@ -652,7 +652,7 @@ function CurrencyTool(): React.ReactElement {
|
||||
<input className="amt mono" value={amount} onChange={e => setAmount(e.target.value)} inputMode="decimal" />
|
||||
<CustomSelect value={from} onChange={v => setFrom(String(v))} options={ccyOptions} searchable size="sm" style={{ marginTop: 6 }} />
|
||||
</div>
|
||||
<button className="fx-swap" aria-label={t('dashboard.aria.swapCurrencies')} onClick={swap}><ArrowRightLeft size={14} /></button>
|
||||
<button type="button" className="fx-swap" aria-label={t('dashboard.aria.swapCurrencies')} onClick={swap}><ArrowRightLeft size={14} /></button>
|
||||
<div className="fx-field">
|
||||
<div className="lbl">{t('dashboard.fx.to')}</div>
|
||||
<input className="amt mono" value={converted != null ? converted.toFixed(2) : '—'} readOnly />
|
||||
@@ -739,7 +739,7 @@ function TimezoneTool({ locale }: { locale: string }): React.ReactElement {
|
||||
<div className="tool">
|
||||
<div className="tool-head">
|
||||
<div className="tool-title"><Clock size={14} /> {t('dashboard.timezone')}</div>
|
||||
<button className="tool-action" aria-label={t('dashboard.aria.addTimezone')} onClick={() => setAdding(a => !a)}>
|
||||
<button type="button" className="tool-action" aria-label={t('dashboard.aria.addTimezone')} onClick={() => setAdding(a => !a)}>
|
||||
{adding ? <X size={14} /> : <Plus size={14} />}
|
||||
</button>
|
||||
</div>
|
||||
@@ -757,7 +757,7 @@ function TimezoneTool({ locale }: { locale: string }): React.ReactElement {
|
||||
<div className="tz-sub">{offsetLabel(tz)}</div>
|
||||
</div>
|
||||
<div className="tz-time mono">{timeIn(tz)}</div>
|
||||
<button className="tz-del" aria-label={t('dashboard.aria.removeTimezone', { city: shortZone(tz) })} onClick={() => removeZone(tz)}><X size={13} /></button>
|
||||
<button type="button" className="tz-del" aria-label={t('dashboard.aria.removeTimezone', { city: shortZone(tz) })} onClick={() => removeZone(tz)}><X size={13} /></button>
|
||||
</div>
|
||||
))}
|
||||
{zones.length === 0 && (
|
||||
|
||||
@@ -72,7 +72,7 @@ export default function HelpPage() {
|
||||
{/* Content */}
|
||||
<main className="flex-1 min-w-0" ref={contentRef}>
|
||||
{/* Mobile nav toggle */}
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={() => setNavOpen(true)}
|
||||
className="lg:hidden inline-flex items-center gap-2 mb-4 px-3 py-2 rounded-lg bg-surface-card border border-edge text-[13px] font-medium text-content"
|
||||
>
|
||||
@@ -109,7 +109,7 @@ export default function HelpPage() {
|
||||
<span className="text-[14px] font-bold text-content flex items-center gap-2">
|
||||
<BookOpen size={16} className="text-accent" /> {t('help.title')}
|
||||
</span>
|
||||
<button onClick={() => setNavOpen(false)} className="text-content-faint">
|
||||
<button type="button" onClick={() => setNavOpen(false)} className="text-content-faint">
|
||||
<X size={18} />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -44,7 +44,7 @@ function InAppNotificationsPageDesktop(): React.ReactElement {
|
||||
{/* Bulk actions */}
|
||||
<div className="flex items-center gap-2">
|
||||
{unreadCount > 0 && (
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={markAllRead}
|
||||
className="flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-sm transition-colors text-content-secondary bg-surface-hover"
|
||||
onMouseEnter={e => e.currentTarget.style.background = 'var(--bg-tertiary)'}
|
||||
@@ -55,7 +55,7 @@ function InAppNotificationsPageDesktop(): React.ReactElement {
|
||||
</button>
|
||||
)}
|
||||
{notifications.length > 0 && (
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={deleteAll}
|
||||
className="flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-sm transition-colors text-red-500 hover:bg-red-500/10"
|
||||
>
|
||||
@@ -68,13 +68,13 @@ function InAppNotificationsPageDesktop(): React.ReactElement {
|
||||
|
||||
{/* Filter toggle */}
|
||||
<div className="flex gap-2 mb-4">
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={() => setUnreadOnly(false)}
|
||||
className={`px-3 py-1.5 rounded-lg text-sm font-medium transition-colors ${!unreadOnly ? 'bg-content text-surface' : 'bg-surface-hover text-content-secondary'}`}
|
||||
>
|
||||
{t('notifications.all')}
|
||||
</button>
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={() => setUnreadOnly(true)}
|
||||
className={`px-3 py-1.5 rounded-lg text-sm font-medium transition-colors ${unreadOnly ? 'bg-content text-surface' : 'bg-surface-hover text-content-secondary'}`}
|
||||
>
|
||||
|
||||
@@ -34,7 +34,7 @@ export default function JoinTripPage() {
|
||||
<>
|
||||
<h1 style={{ fontSize: 18, fontWeight: 700, marginBottom: 8 }}>{t('trip.invite.invalidTitle')}</h1>
|
||||
<p className="text-content-secondary" style={{ fontSize: 14, marginBottom: 20 }}>{t('trip.invite.invalid')}</p>
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={goToDashboard}
|
||||
className="bg-surface-hover text-content"
|
||||
style={{ border: 'none', borderRadius: 10, padding: '10px 18px', fontWeight: 600, cursor: 'pointer', fontFamily: 'inherit' }}
|
||||
@@ -49,14 +49,14 @@ export default function JoinTripPage() {
|
||||
{state === 'loading' ? t('common.loading') : t('trip.invite.joinPrompt', { title })}
|
||||
</p>
|
||||
<div style={{ display: 'flex', gap: 10, justifyContent: 'center' }}>
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={goToDashboard}
|
||||
className="bg-surface-hover text-content"
|
||||
style={{ border: 'none', borderRadius: 10, padding: '10px 18px', fontWeight: 600, cursor: 'pointer', fontFamily: 'inherit' }}
|
||||
>
|
||||
{t('common.cancel')}
|
||||
</button>
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={accept}
|
||||
disabled={state !== 'ready'}
|
||||
className="bg-accent text-accent-text"
|
||||
|
||||
@@ -126,7 +126,7 @@ function JourneyDetailPageDesktop() {
|
||||
className="fixed left-0 right-0 z-30 flex items-start justify-between gap-2 px-4"
|
||||
style={{ top: 'calc(var(--nav-h, 56px) + 12px)' }}
|
||||
>
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={() => navigate('/journey')}
|
||||
aria-label={t('journey.detail.backToJourney')}
|
||||
className={barButton}
|
||||
@@ -136,7 +136,7 @@ function JourneyDetailPageDesktop() {
|
||||
|
||||
<div className="flex-1 min-w-0 flex justify-center">
|
||||
<div className="flex bg-surface-elevated backdrop-blur-lg border border-edge rounded-lg overflow-hidden shadow-lg">
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={() => setView('timeline')}
|
||||
className={`flex items-center gap-1.5 px-3 py-[7px] text-[12px] font-medium ${
|
||||
view === 'timeline'
|
||||
@@ -147,7 +147,7 @@ function JourneyDetailPageDesktop() {
|
||||
<MapPin size={13} />
|
||||
{t('journey.detail.journeyTab') || 'Journey'}
|
||||
</button>
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={() => setView('gallery')}
|
||||
className={`flex items-center gap-1.5 px-3 py-[7px] text-[12px] font-medium ${
|
||||
view === 'gallery'
|
||||
@@ -162,7 +162,7 @@ function JourneyDetailPageDesktop() {
|
||||
</div>
|
||||
|
||||
<div className="flex items-center gap-1.5">
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={openStudio}
|
||||
onMouseEnter={prefetchStudio}
|
||||
aria-label={t('journey.studio.openAria')}
|
||||
@@ -170,7 +170,7 @@ function JourneyDetailPageDesktop() {
|
||||
>
|
||||
<BookOpen size={16} />
|
||||
</button>
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={toggleSkeletons}
|
||||
aria-label={skeletonLabel}
|
||||
className={`${barButton} ${hideSkeletons ? 'bg-surface-selected' : ''}`}
|
||||
@@ -178,7 +178,7 @@ function JourneyDetailPageDesktop() {
|
||||
{hideSkeletons ? <EyeOff size={16} /> : <Eye size={16} />}
|
||||
</button>
|
||||
{canEditJourney && (
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={() => setShowSettings(true)}
|
||||
aria-label={t('journey.settings.title')}
|
||||
className={barButton}
|
||||
@@ -230,7 +230,7 @@ function JourneyDetailPageDesktop() {
|
||||
|
||||
<div className="relative z-[3] flex items-center justify-between mb-5">
|
||||
<div className="flex items-center gap-2">
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={() => navigate('/journey')}
|
||||
aria-label={t('journey.detail.backToJourney')}
|
||||
className="w-[34px] h-[34px] rounded-full bg-white/15 backdrop-blur flex items-center justify-center hover:bg-white/25"
|
||||
@@ -252,7 +252,7 @@ function JourneyDetailPageDesktop() {
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex items-center gap-1.5">
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={openStudio}
|
||||
onMouseEnter={prefetchStudio}
|
||||
className="inline-flex h-[34px] items-center gap-1.5 px-3.5 rounded-full bg-white/15 backdrop-blur border border-white/15 text-[12px] font-semibold hover:bg-white/25"
|
||||
@@ -261,7 +261,7 @@ function JourneyDetailPageDesktop() {
|
||||
{t('journey.studio.open')}
|
||||
</button>
|
||||
<div className="relative group">
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={toggleSkeletons}
|
||||
aria-label={skeletonLabel}
|
||||
className={`w-[34px] h-[34px] rounded-full backdrop-blur flex items-center justify-center ${hideSkeletons ? 'bg-white/30' : 'bg-white/15 hover:bg-white/25'}`}
|
||||
@@ -273,7 +273,7 @@ function JourneyDetailPageDesktop() {
|
||||
</span>
|
||||
</div>
|
||||
{canEditJourney && (
|
||||
<button onClick={() => setShowSettings(true)} aria-label={t('journey.settings.title')} className="w-[34px] h-[34px] rounded-full bg-white/15 backdrop-blur flex items-center justify-center hover:bg-white/25"><MoreHorizontal size={14} /></button>
|
||||
<button type="button" onClick={() => setShowSettings(true)} aria-label={t('journey.settings.title')} className="w-[34px] h-[34px] rounded-full bg-white/15 backdrop-blur flex items-center justify-center hover:bg-white/25"><MoreHorizontal size={14} /></button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
@@ -320,7 +320,7 @@ function JourneyDetailPageDesktop() {
|
||||
{ id: 'gallery' as const, icon: Grid, label: t('journey.share.gallery') },
|
||||
]
|
||||
).map(v => (
|
||||
<button
|
||||
<button type="button"
|
||||
key={v.id}
|
||||
onClick={() => setView(v.id)}
|
||||
className="flex items-center gap-1.5 px-3.5 py-[6px] text-[12px] font-semibold rounded-full transition-colors"
|
||||
@@ -334,7 +334,7 @@ function JourneyDetailPageDesktop() {
|
||||
))}
|
||||
</div>
|
||||
{canEditEntries && view === 'timeline' && (
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={() => {
|
||||
setEditingEntry(createDraftJourneyEntry(current.id))
|
||||
}}
|
||||
@@ -346,7 +346,7 @@ function JourneyDetailPageDesktop() {
|
||||
</button>
|
||||
)}
|
||||
{canEditEntries && view === 'gallery' && (
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={() => galleryUploadRef.current?.()}
|
||||
className="inline-flex items-center gap-1.5 h-9 px-4 rounded-full text-[13px] font-semibold transition-transform hover:-translate-y-0.5"
|
||||
style={{ background: 'var(--vg-ink)', color: 'var(--vg-bg)' }}
|
||||
@@ -472,7 +472,7 @@ function JourneyDetailPageDesktop() {
|
||||
<div className="sticky bottom-0 z-20 h-0 pointer-events-none">
|
||||
<div className="absolute bottom-6 left-1/2 -translate-x-1/2 flex gap-1.5 pointer-events-auto">
|
||||
{!feedEdge.atTop && (
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={() => scrollFeedTo('top')}
|
||||
aria-label={t('journey.detail.jumpToTop')}
|
||||
title={t('journey.detail.jumpToTop')}
|
||||
@@ -483,7 +483,7 @@ function JourneyDetailPageDesktop() {
|
||||
</button>
|
||||
)}
|
||||
{!feedEdge.atBottom && (
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={() => scrollFeedTo('bottom')}
|
||||
aria-label={t('journey.detail.jumpToLast')}
|
||||
title={t('journey.detail.jumpToLast')}
|
||||
|
||||
@@ -48,7 +48,7 @@ function JourneyPageDesktop() {
|
||||
{/* Header — mobile */}
|
||||
<div className="md:hidden px-5 pt-5 pb-4 flex flex-col gap-2">
|
||||
<div className="flex items-center gap-2">
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={() => {
|
||||
if (searchOpen) {
|
||||
setSearchOpen(false)
|
||||
@@ -62,7 +62,7 @@ function JourneyPageDesktop() {
|
||||
>
|
||||
{searchOpen ? <X size={15} /> : <Search size={15} />}
|
||||
</button>
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={() => openCreateModal()}
|
||||
className="flex-1 flex items-center justify-center gap-2 py-2.5 rounded-xl bg-zinc-900 dark:bg-white text-white dark:text-zinc-900 text-[14px] font-semibold active:scale-[0.98] transition-transform"
|
||||
>
|
||||
@@ -102,13 +102,13 @@ function JourneyPageDesktop() {
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex items-center gap-2 flex-shrink-0">
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={() => setDismissedSuggestions(prev => new Set([...prev, activeSuggestion.id]))}
|
||||
className="px-3 py-1.5 rounded-lg bg-white/10 border border-white/20 text-[12px] font-medium text-white hover:bg-white/20"
|
||||
>
|
||||
{t('journey.frontpage.dismiss')}
|
||||
</button>
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={() => openCreateModal(activeSuggestion.id)}
|
||||
className="px-3 py-1.5 rounded-lg !bg-white !text-zinc-900 text-[12px] font-medium hover:!bg-zinc-100"
|
||||
>
|
||||
@@ -221,7 +221,7 @@ function JourneyPageDesktop() {
|
||||
))}
|
||||
|
||||
{/* Create card */}
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={() => openCreateModal()}
|
||||
className="group min-h-[200px] rounded-[24px] flex flex-col items-center justify-center gap-3 transition-transform duration-200 ease-[cubic-bezier(0.23,1,0.32,1)] cursor-pointer hover:-translate-y-1"
|
||||
style={{ border: '1.5px dashed var(--vg-line2)', background: 'var(--vg-surf2)' }}
|
||||
@@ -335,13 +335,13 @@ function JourneyPageDesktop() {
|
||||
{selectedTripIds.size > 0 && <> · <strong className="text-zinc-900 dark:text-white">{totalPlaces}</strong> <span className="hidden md:inline">{t('journey.frontpage.placesImported')}</span><span className="md:hidden">{t('journey.frontpage.places')}</span></>}
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={() => setShowCreate(false)}
|
||||
className="px-3.5 py-2 rounded-lg border border-zinc-200 dark:border-zinc-600 text-[13px] font-medium text-zinc-700 dark:text-zinc-300 hover:bg-zinc-100 dark:hover:bg-zinc-700"
|
||||
>
|
||||
{t('common.cancel')}
|
||||
</button>
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={handleCreate}
|
||||
disabled={!newTitle.trim()}
|
||||
className="px-3.5 py-2 rounded-lg bg-zinc-900 dark:bg-white text-white dark:text-zinc-900 text-[13px] font-medium hover:bg-zinc-800 dark:hover:bg-zinc-100 disabled:opacity-40 disabled:cursor-not-allowed"
|
||||
|
||||
@@ -496,7 +496,7 @@ export default function JourneyPublicPage() {
|
||||
views.length > 1 && (
|
||||
<div className="mb-6 flex w-fit overflow-hidden rounded-lg border border-zinc-200 bg-white dark:border-zinc-700 dark:bg-zinc-800">
|
||||
{views.map((v) => (
|
||||
<button
|
||||
<button type="button"
|
||||
key={v.id}
|
||||
onClick={() => setView(v.id)}
|
||||
className={`flex items-center gap-1.5 px-3 py-[7px] text-[12px] font-medium ${
|
||||
@@ -560,7 +560,7 @@ export default function JourneyPublicPage() {
|
||||
|
||||
{/* Language picker */}
|
||||
<div style={{ position: 'absolute', top: 12, right: 12, zIndex: 10 }}>
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={() => setShowLangPicker((v) => !v)}
|
||||
style={{
|
||||
padding: '5px 12px',
|
||||
@@ -802,7 +802,7 @@ export default function JourneyPublicPage() {
|
||||
>
|
||||
<div className="flex overflow-hidden rounded-lg border border-zinc-200 bg-white/90 shadow-lg backdrop-blur-lg dark:border-zinc-700 dark:bg-zinc-800/90">
|
||||
{availableViews.map((v) => (
|
||||
<button
|
||||
<button type="button"
|
||||
key={v.id}
|
||||
onClick={() => setView(v.id)}
|
||||
className={`flex items-center gap-1.5 px-3 py-[7px] text-[12px] font-medium ${
|
||||
|
||||
@@ -223,7 +223,7 @@ export default function LoginPage(): React.ReactElement {
|
||||
<div style={{ minHeight: '100vh', display: 'flex', fontFamily: 'var(--font-system)', position: 'relative' }}>
|
||||
{/* Language dropdown */}
|
||||
<div style={{ position: 'absolute', top: 16, right: 16, zIndex: 10 }}>
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
setLangDropdownOpen((o) => !o);
|
||||
@@ -281,7 +281,7 @@ export default function LoginPage(): React.ReactElement {
|
||||
}}
|
||||
>
|
||||
{SUPPORTED_LANGUAGES.map(({ value, label }) => (
|
||||
<button
|
||||
<button type="button"
|
||||
key={value}
|
||||
role="option"
|
||||
aria-selected={value === language}
|
||||
@@ -1049,7 +1049,7 @@ export default function LoginPage(): React.ReactElement {
|
||||
}}
|
||||
>
|
||||
{mode === 'login' ? t('login.noAccount') + ' ' : t('login.hasAccount') + ' '}
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={() => {
|
||||
setMode((m) => (m === 'login' ? 'register' : 'login'));
|
||||
setError('');
|
||||
@@ -1185,7 +1185,7 @@ export default function LoginPage(): React.ReactElement {
|
||||
|
||||
{/* Demo login button */}
|
||||
{appConfig?.demo_mode && (
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={handleDemoLogin}
|
||||
disabled={isLoading}
|
||||
style={{
|
||||
|
||||
@@ -50,7 +50,7 @@ export default function OAuthAuthorizePage(): React.ReactElement {
|
||||
{t('oauth.authorize.loginDescription', { client: validation?.client?.name || clientId })}
|
||||
</p>
|
||||
</div>
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={handleLoginRedirect}
|
||||
className="w-full flex items-center justify-center gap-2 px-4 py-2.5 rounded-lg text-sm font-medium text-white"
|
||||
style={{ background: 'var(--accent-primary, #4f46e5)' }}>
|
||||
@@ -88,7 +88,7 @@ export default function OAuthAuthorizePage(): React.ReactElement {
|
||||
<p className="text-xs mb-3" style={{ color: 'var(--text-tertiary)' }}>
|
||||
{t('oauth.authorize.trustNote')}
|
||||
</p>
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={() => submitConsent(true)}
|
||||
disabled={submitting || (validation?.scopeSelectable === true && selectedScopes.length === 0)}
|
||||
className="w-full px-4 py-2.5 rounded-lg text-sm font-medium text-white disabled:opacity-60 transition-opacity"
|
||||
@@ -106,7 +106,7 @@ export default function OAuthAuthorizePage(): React.ReactElement {
|
||||
)
|
||||
: t('oauth.authorize.approveAccess')}
|
||||
</button>
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={() => submitConsent(false)}
|
||||
disabled={submitting}
|
||||
className="w-full px-4 py-2.5 rounded-lg text-sm font-medium border transition-colors hover:bg-slate-50 dark:hover:bg-slate-800 disabled:opacity-60"
|
||||
|
||||
@@ -327,7 +327,7 @@ export default function SharedTripPage() {
|
||||
|
||||
{/* Language picker - top right */}
|
||||
<div style={{ position: 'absolute', top: 12, right: 12, zIndex: 10 }}>
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={() => setShowLangPicker((v) => !v)}
|
||||
className="bg-[rgba(255,255,255,0.1)] text-[rgba(255,255,255,0.7)]"
|
||||
style={{
|
||||
@@ -400,7 +400,7 @@ export default function SharedTripPage() {
|
||||
...(permissions?.share_budget ? [{ id: 'budget', label: t('shared.tabBudget'), Icon: Wallet }] : []),
|
||||
...(permissions?.share_collab ? [{ id: 'collab', label: t('shared.tabChat'), Icon: MessageCircle }] : []),
|
||||
].map((tab) => (
|
||||
<button
|
||||
<button type="button"
|
||||
key={tab.id}
|
||||
onClick={() => setActiveTab(tab.id)}
|
||||
className={activeTab === tab.id ? 'bg-[#111827] text-white' : 'bg-surface-card text-[#6b7280]'}
|
||||
@@ -1022,7 +1022,7 @@ export default function SharedTripPage() {
|
||||
return g;
|
||||
}, {});
|
||||
const sumIn = (items: any[]) =>
|
||||
items.reduce((s: number, i: any) => s + convert(parseFloat(i.total_price) || 0, curOf(i)), 0);
|
||||
items.reduce((s: number, i: any) => s + convert(Number.parseFloat(i.total_price) || 0, curOf(i)), 0);
|
||||
const total = sumIn(budget || []);
|
||||
return (
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 12 }}>
|
||||
|
||||
@@ -130,7 +130,7 @@ function ListsContainer({ tripId, packingItems, todoItems }: { tripId: number; p
|
||||
const active = subTab === tab.id
|
||||
const Icon = tab.icon
|
||||
return (
|
||||
<button key={tab.id} onClick={() => setSubTabPersist(tab.id)}
|
||||
<button type="button" key={tab.id} onClick={() => setSubTabPersist(tab.id)}
|
||||
className={active ? 'bg-surface-card text-content' : 'bg-transparent text-content-muted'}
|
||||
style={{
|
||||
appearance: 'none', border: 'none', cursor: 'pointer', fontFamily: 'inherit',
|
||||
@@ -162,7 +162,7 @@ function ListsContainer({ tripId, packingItems, todoItems }: { tripId: number; p
|
||||
return (
|
||||
<div style={{ display: 'flex', gap: 6, flexShrink: 0, marginLeft: 'auto', flexWrap: 'wrap' }}>
|
||||
{packingAbgehakt > 0 && (
|
||||
<button onClick={() => setClearCheckedSignal(s => s + 1)}
|
||||
<button type="button" onClick={() => setClearCheckedSignal(s => s + 1)}
|
||||
className={`hidden sm:inline-flex items-center gap-1.5 px-[14px] py-[9px] hover:opacity-[0.88] bg-[rgba(239,68,68,0.14)] text-[#ef4444]`}
|
||||
style={sharedBtnStyle}
|
||||
>
|
||||
@@ -177,7 +177,7 @@ function ListsContainer({ tripId, packingItems, todoItems }: { tripId: number; p
|
||||
style={sharedBtnStyle}
|
||||
/>
|
||||
{isAdmin && packingItems.length > 0 && (
|
||||
<button onClick={() => setSaveTemplateSignal(s => s + 1)}
|
||||
<button type="button" onClick={() => setSaveTemplateSignal(s => s + 1)}
|
||||
className={`${sharedBtnClass} bg-accent text-accent-text`}
|
||||
style={sharedBtnStyle}
|
||||
>
|
||||
@@ -185,7 +185,7 @@ function ListsContainer({ tripId, packingItems, todoItems }: { tripId: number; p
|
||||
<span className="hidden sm:inline">{t('packing.saveAsTemplate')}</span>
|
||||
</button>
|
||||
)}
|
||||
<button onClick={() => setImportPackingSignal(s => s + 1)}
|
||||
<button type="button" onClick={() => setImportPackingSignal(s => s + 1)}
|
||||
className={`${sharedBtnClass} bg-accent text-accent-text`}
|
||||
style={sharedBtnStyle}
|
||||
>
|
||||
@@ -196,7 +196,7 @@ function ListsContainer({ tripId, packingItems, todoItems }: { tripId: number; p
|
||||
)
|
||||
})()}
|
||||
{subTab === 'todo' && (
|
||||
<button onClick={() => setAddTodoSignal(s => s + 1)}
|
||||
<button type="button" onClick={() => setAddTodoSignal(s => s + 1)}
|
||||
className="hover:opacity-[0.88] bg-accent text-accent-text"
|
||||
style={{
|
||||
appearance: 'none', border: 'none', cursor: 'pointer', fontFamily: 'inherit',
|
||||
@@ -424,7 +424,7 @@ function TripPlannerPageDesktop(): React.ReactElement | null {
|
||||
)}
|
||||
|
||||
<div className="hidden md:block" style={{ position: 'absolute', left: 10, top: 10, bottom: 10, zIndex: 20 }}>
|
||||
<button onClick={() => setLeftCollapsed(c => !c)}
|
||||
<button type="button" onClick={() => setLeftCollapsed(c => !c)}
|
||||
style={{
|
||||
position: leftCollapsed ? 'fixed' : 'absolute', top: leftCollapsed ? 'calc(var(--nav-h) + 44px + 14px)' : 14, left: leftCollapsed ? 10 : undefined, right: leftCollapsed ? undefined : -28, zIndex: -1,
|
||||
width: 36, height: 36, borderRadius: leftCollapsed ? 10 : '0 10px 10px 0',
|
||||
@@ -512,7 +512,7 @@ function TripPlannerPageDesktop(): React.ReactElement | null {
|
||||
</div>
|
||||
|
||||
<div className="hidden md:block" style={{ position: 'absolute', right: 10, top: 10, bottom: 10, zIndex: 20 }}>
|
||||
<button onClick={() => setRightCollapsed(c => !c)}
|
||||
<button type="button" onClick={() => setRightCollapsed(c => !c)}
|
||||
style={{
|
||||
position: rightCollapsed ? 'fixed' : 'absolute', top: rightCollapsed ? 'calc(var(--nav-h) + 44px + 14px)' : 14, right: rightCollapsed ? 10 : undefined, left: rightCollapsed ? undefined : -28, zIndex: -1,
|
||||
width: 36, height: 36, borderRadius: rightCollapsed ? 10 : '10px 0 0 10px',
|
||||
@@ -571,12 +571,12 @@ function TripPlannerPageDesktop(): React.ReactElement | null {
|
||||
{/* Mobile sidebar buttons — portal to body to escape Leaflet touch handling */}
|
||||
{activeTab === 'plan' && !mobileSidebarOpen && !showPlaceForm && !showMembersModal && !showReservationModal && createPortal(
|
||||
<div className="flex md:hidden" style={{ position: 'fixed', top: 'calc(var(--nav-h) + 44px + 12px)', left: 12, right: 12, justifyContent: 'space-between', zIndex: 100, pointerEvents: 'none' }}>
|
||||
<button onClick={() => setMobileSidebarOpen('left')}
|
||||
<button type="button" onClick={() => setMobileSidebarOpen('left')}
|
||||
className="bg-surface-card text-content border border-edge"
|
||||
style={{ pointerEvents: 'auto', backdropFilter: 'blur(12px)', borderRadius: 24, padding: '11px 24px', fontSize: 'calc(15px * var(--fs-scale-subtitle, 1))', fontWeight: 600, cursor: 'pointer', boxShadow: '0 2px 12px rgba(0,0,0,0.15)', minHeight: 44, fontFamily: 'inherit', touchAction: 'manipulation' }}>
|
||||
{t('trip.mobilePlan')}
|
||||
</button>
|
||||
<button onClick={() => setMobileSidebarOpen('right')}
|
||||
<button type="button" onClick={() => setMobileSidebarOpen('right')}
|
||||
className="bg-surface-card text-content border border-edge"
|
||||
style={{ pointerEvents: 'auto', backdropFilter: 'blur(12px)', borderRadius: 24, padding: '11px 24px', fontSize: 'calc(15px * var(--fs-scale-subtitle, 1))', fontWeight: 600, cursor: 'pointer', boxShadow: '0 2px 12px rgba(0,0,0,0.15)', minHeight: 44, fontFamily: 'inherit', touchAction: 'manipulation' }}>
|
||||
{t('trip.mobilePlaces')}
|
||||
@@ -702,7 +702,7 @@ function TripPlannerPageDesktop(): React.ReactElement | null {
|
||||
<div className="bg-surface-card" style={{ position: 'absolute', top: 'var(--nav-h)', left: 0, right: 0, bottom: 0, display: 'flex', flexDirection: 'column', overflow: 'hidden' }} onClick={e => e.stopPropagation()}>
|
||||
<div className="border-b border-edge-secondary" style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', padding: '14px 16px' }}>
|
||||
<span className="text-content" style={{ fontWeight: 600, fontSize: 'calc(14px * var(--fs-scale-body, 1))' }}>{mobileSidebarOpen === 'left' ? t('trip.mobilePlan') : t('trip.mobilePlaces')}</span>
|
||||
<button onClick={() => setMobileSidebarOpen(null)} className="bg-surface-tertiary text-content" style={{ border: 'none', borderRadius: '50%', width: 28, height: 28, cursor: 'pointer', display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
|
||||
<button type="button" onClick={() => setMobileSidebarOpen(null)} className="bg-surface-tertiary text-content" style={{ border: 'none', borderRadius: '50%', width: 28, height: 28, cursor: 'pointer', display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
|
||||
<X size={14} />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -48,19 +48,19 @@ function VacayPageDesktop(): React.ReactElement {
|
||||
</div>
|
||||
<div className="flex items-center justify-between mb-3">
|
||||
<div className="flex items-center gap-0.5">
|
||||
<button onClick={handleAddPrevYear} className="w-7 h-7 rounded-lg flex items-center justify-center transition-colors" style={{ color: 'var(--vg-ink3)' }} title={t('vacay.addPrevYear')}>
|
||||
<button type="button" onClick={handleAddPrevYear} className="w-7 h-7 rounded-lg flex items-center justify-center transition-colors" style={{ color: 'var(--vg-ink3)' }} title={t('vacay.addPrevYear')}>
|
||||
<Plus size={14} />
|
||||
</button>
|
||||
<button onClick={() => { const idx = years.indexOf(selectedYear); if (idx > 0) setSelectedYear(years[idx - 1]) }} disabled={years.indexOf(selectedYear) <= 0} className="w-7 h-7 rounded-lg flex items-center justify-center disabled:opacity-20 transition-colors" style={{ color: 'var(--vg-ink3)' }}>
|
||||
<button type="button" onClick={() => { const idx = years.indexOf(selectedYear); if (idx > 0) setSelectedYear(years[idx - 1]) }} disabled={years.indexOf(selectedYear) <= 0} className="w-7 h-7 rounded-lg flex items-center justify-center disabled:opacity-20 transition-colors" style={{ color: 'var(--vg-ink3)' }}>
|
||||
<ChevronLeft size={16} />
|
||||
</button>
|
||||
</div>
|
||||
<span className="tabular-nums" style={{ fontSize: 22, fontWeight: 700, color: 'var(--vg-ink)' }}>{selectedYear}</span>
|
||||
<div className="flex items-center gap-0.5">
|
||||
<button onClick={() => { const idx = years.indexOf(selectedYear); if (idx < years.length - 1) setSelectedYear(years[idx + 1]) }} disabled={years.indexOf(selectedYear) >= years.length - 1} className="w-7 h-7 rounded-lg flex items-center justify-center disabled:opacity-20 transition-colors" style={{ color: 'var(--vg-ink3)' }}>
|
||||
<button type="button" onClick={() => { const idx = years.indexOf(selectedYear); if (idx < years.length - 1) setSelectedYear(years[idx + 1]) }} disabled={years.indexOf(selectedYear) >= years.length - 1} className="w-7 h-7 rounded-lg flex items-center justify-center disabled:opacity-20 transition-colors" style={{ color: 'var(--vg-ink3)' }}>
|
||||
<ChevronRight size={16} />
|
||||
</button>
|
||||
<button onClick={handleAddNextYear} className="w-7 h-7 rounded-lg flex items-center justify-center transition-colors" style={{ color: 'var(--vg-ink3)' }} title={t('vacay.addYear')}>
|
||||
<button type="button" onClick={handleAddNextYear} className="w-7 h-7 rounded-lg flex items-center justify-center transition-colors" style={{ color: 'var(--vg-ink3)' }} title={t('vacay.addYear')}>
|
||||
<Plus size={14} />
|
||||
</button>
|
||||
</div>
|
||||
@@ -129,13 +129,13 @@ function VacayPageDesktop(): React.ReactElement {
|
||||
<h1 className="text-lg font-bold text-content">{t('admin.addons.catalog.vacay.name')}</h1>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={() => setShowMobileSidebar(true)}
|
||||
className="lg:hidden flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-sm transition-colors bg-surface-secondary text-content-muted"
|
||||
>
|
||||
<SlidersHorizontal size={14} />
|
||||
</button>
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={() => setShowSettings(true)}
|
||||
className="flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-sm transition-colors bg-surface-secondary text-content-muted"
|
||||
>
|
||||
@@ -149,7 +149,7 @@ function VacayPageDesktop(): React.ReactElement {
|
||||
{/* Desktop Sidebar */}
|
||||
<div className="hidden lg:flex w-[300px] shrink-0 flex-col gap-[12px] sticky top-[84px]">
|
||||
{sidebarContent}
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={() => setShowSettings(true)}
|
||||
className="vg-card flex items-center justify-center gap-2.5 rounded-[18px] transition-transform hover:-translate-y-px"
|
||||
style={{ padding: '13px 16px', fontSize: 14, fontWeight: 600, color: 'var(--vg-ink)', cursor: 'pointer' }}
|
||||
@@ -197,10 +197,10 @@ function VacayPageDesktop(): React.ReactElement {
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex gap-3 justify-end">
|
||||
<button onClick={() => setDeleteYear(null)} className="px-4 py-2 text-sm rounded-lg transition-colors border text-content-muted border-edge">
|
||||
<button type="button" onClick={() => setDeleteYear(null)} className="px-4 py-2 text-sm rounded-lg transition-colors border text-content-muted border-edge">
|
||||
{t('common.cancel')}
|
||||
</button>
|
||||
<button onClick={async () => { await removeYear(deleteYear); setDeleteYear(null) }} className="px-4 py-2 text-sm bg-red-500 hover:bg-red-600 text-white rounded-lg transition-colors">
|
||||
<button type="button" onClick={async () => { await removeYear(deleteYear); setDeleteYear(null) }} className="px-4 py-2 text-sm bg-red-500 hover:bg-red-600 text-white rounded-lg transition-colors">
|
||||
{t('vacay.remove')}
|
||||
</button>
|
||||
</div>
|
||||
@@ -232,11 +232,11 @@ function VacayPageDesktop(): React.ReactElement {
|
||||
<InfoItem icon={Unlink} text={t('vacay.fuseInfo5')} />
|
||||
</div>
|
||||
<div className="px-6 pb-6 flex gap-3">
|
||||
<button onClick={() => declineInvite(inv.plan_id)}
|
||||
<button type="button" onClick={() => declineInvite(inv.plan_id)}
|
||||
className="flex-1 px-4 py-2.5 text-sm font-medium rounded-xl transition-colors border text-content-muted border-edge">
|
||||
{t('vacay.decline')}
|
||||
</button>
|
||||
<button onClick={() => acceptInvite(inv.plan_id)}
|
||||
<button type="button" onClick={() => acceptInvite(inv.plan_id)}
|
||||
className="flex-1 px-4 py-2.5 text-sm font-medium rounded-xl transition-colors bg-content text-surface-card">
|
||||
{t('vacay.acceptFusion')}
|
||||
</button>
|
||||
|
||||
@@ -93,7 +93,7 @@ export default function AdminNotificationsPanel({ t, toast }: { t: (k: string) =
|
||||
const isOn = matrix.preferences[eventType]?.[ch] ?? true
|
||||
return (
|
||||
<div key={ch} style={{ display: 'flex', justifyContent: 'center' }}>
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={() => toggle(eventType, ch)}
|
||||
className={`relative inline-flex h-5 w-9 items-center rounded-full transition-colors flex-shrink-0 ${isOn ? 'bg-content' : 'bg-edge'}`}
|
||||
>
|
||||
|
||||
@@ -69,7 +69,7 @@ export default function AdminNotificationsTab({ admin, t }: AdminNotificationsTa
|
||||
<h2 className="font-semibold text-slate-900">{t('admin.notifications.emailPanel.title')}</h2>
|
||||
<p className="text-xs text-slate-400 mt-1">{t('admin.smtp.hint')}</p>
|
||||
</div>
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={() => setChannels(!emailActive, webhookActive, ntfyActive)}
|
||||
className={`relative inline-flex h-6 w-11 items-center rounded-full transition-colors flex-shrink-0 ${emailActive ? 'bg-content' : 'bg-edge'}`}
|
||||
>
|
||||
@@ -112,11 +112,11 @@ export default function AdminNotificationsTab({ admin, t }: AdminNotificationsTa
|
||||
</div>
|
||||
</div>
|
||||
<div className="px-6 pb-4 flex items-center gap-2 border-t border-slate-100 pt-4">
|
||||
<button onClick={saveNotifications}
|
||||
<button type="button" onClick={saveNotifications}
|
||||
className="flex items-center gap-2 px-4 py-2 bg-slate-900 text-white rounded-lg text-sm font-medium hover:bg-slate-800 transition-colors">
|
||||
<Save className="w-4 h-4" />{t('common.save')}
|
||||
</button>
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={async () => {
|
||||
const smtpKeys = ['smtp_host', 'smtp_port', 'smtp_user', 'smtp_pass', 'smtp_from', 'smtp_skip_tls_verify']
|
||||
const payload: Record<string, string> = {}
|
||||
@@ -144,7 +144,7 @@ export default function AdminNotificationsTab({ admin, t }: AdminNotificationsTa
|
||||
<h2 className="font-semibold text-slate-900">{t('admin.notifications.webhookPanel.title')}</h2>
|
||||
<p className="text-xs text-slate-400 mt-1">{t('admin.webhook.hint')}</p>
|
||||
</div>
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={() => setChannels(emailActive, !webhookActive, ntfyActive)}
|
||||
className={`relative inline-flex h-6 w-11 items-center rounded-full transition-colors flex-shrink-0 ${webhookActive ? 'bg-content' : 'bg-edge'}`}
|
||||
>
|
||||
@@ -161,7 +161,7 @@ export default function AdminNotificationsTab({ admin, t }: AdminNotificationsTa
|
||||
<h2 className="font-semibold text-slate-900">{t('admin.notifications.ntfy')}</h2>
|
||||
<p className="text-xs text-slate-400 mt-1">{t('admin.ntfy.hint') || 'Allow users to configure their own ntfy topics for push notifications.'}</p>
|
||||
</div>
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={() => setChannels(emailActive, webhookActive, !ntfyActive)}
|
||||
className={`relative inline-flex h-6 w-11 items-center rounded-full transition-colors flex-shrink-0 ${ntfyActive ? 'bg-content' : 'bg-edge'}`}
|
||||
>
|
||||
@@ -240,7 +240,7 @@ export default function AdminNotificationsTab({ admin, t }: AdminNotificationsTa
|
||||
)}
|
||||
</div>
|
||||
<div className="px-6 pb-4 flex items-center gap-2 border-t border-slate-100 pt-4">
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={async () => {
|
||||
try {
|
||||
await authApi.updateAppSettings({ admin_webhook_url: smtpValues.admin_webhook_url || '' })
|
||||
@@ -250,7 +250,7 @@ export default function AdminNotificationsTab({ admin, t }: AdminNotificationsTa
|
||||
className="flex items-center gap-2 px-4 py-2 bg-slate-900 text-white rounded-lg text-sm font-medium hover:bg-slate-800 transition-colors">
|
||||
<Save className="w-4 h-4" />{t('common.save')}
|
||||
</button>
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={async () => {
|
||||
// A masked value means the URL only lives on the server — send no url and let
|
||||
// the server test the stored one instead of pre-saving the mask.
|
||||
@@ -331,7 +331,7 @@ export default function AdminNotificationsTab({ admin, t }: AdminNotificationsTa
|
||||
)}
|
||||
</div>
|
||||
<div className="px-6 pb-4 flex items-center gap-2 border-t border-slate-100 pt-4">
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={async () => {
|
||||
try {
|
||||
await authApi.updateAppSettings({
|
||||
@@ -347,7 +347,7 @@ export default function AdminNotificationsTab({ admin, t }: AdminNotificationsTa
|
||||
className="flex items-center gap-2 px-4 py-2 bg-slate-900 text-white rounded-lg text-sm font-medium hover:bg-slate-800 transition-colors">
|
||||
<Save className="w-4 h-4" />{t('common.save')}
|
||||
</button>
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={async () => {
|
||||
const topic = smtpValues.admin_ntfy_topic?.trim()
|
||||
if (!topic) return
|
||||
|
||||
@@ -54,7 +54,7 @@ export default function AdminSettingsTab({ admin, t }: AdminSettingsTabProps): R
|
||||
<p className="text-sm font-medium text-slate-700">{t('admin.passwordLogin')}</p>
|
||||
<p className="text-xs text-slate-400 mt-0.5">{t('admin.passwordLoginHint')}</p>
|
||||
</div>
|
||||
<button
|
||||
<button type="button"
|
||||
disabled={envOverrideOidcOnly || (!passwordLogin && !oidcLogin)}
|
||||
onClick={() => handleToggleAuthSetting('password_login', !passwordLogin, setPasswordLogin)}
|
||||
title={!passwordLogin && !oidcLogin ? t('admin.lockoutWarning') : undefined}
|
||||
@@ -72,7 +72,7 @@ export default function AdminSettingsTab({ admin, t }: AdminSettingsTabProps): R
|
||||
<p className="text-sm font-medium text-slate-700">{t('admin.passwordRegistration')}</p>
|
||||
<p className="text-xs text-slate-400 mt-0.5">{t('admin.passwordRegistrationHint')}</p>
|
||||
</div>
|
||||
<button
|
||||
<button type="button"
|
||||
disabled={envOverrideOidcOnly}
|
||||
onClick={() => handleToggleAuthSetting('password_registration', !passwordRegistration, setPasswordRegistration)}
|
||||
className={`relative inline-flex h-6 w-11 items-center rounded-full transition-colors disabled:opacity-50 ${passwordRegistration ? 'bg-content' : 'bg-edge'}`}
|
||||
@@ -90,7 +90,7 @@ export default function AdminSettingsTab({ admin, t }: AdminSettingsTabProps): R
|
||||
<p className="text-sm font-medium text-slate-700">{t('admin.oidcLogin')}</p>
|
||||
<p className="text-xs text-slate-400 mt-0.5">{t('admin.oidcLoginHint')}</p>
|
||||
</div>
|
||||
<button
|
||||
<button type="button"
|
||||
disabled={!passwordLogin && oidcLogin}
|
||||
onClick={() => handleToggleAuthSetting('oidc_login', !oidcLogin, setOidcLogin)}
|
||||
title={!passwordLogin && oidcLogin ? t('admin.lockoutWarning') : undefined}
|
||||
@@ -110,7 +110,7 @@ export default function AdminSettingsTab({ admin, t }: AdminSettingsTabProps): R
|
||||
<p className="text-sm font-medium text-slate-700">{t('admin.oidcRegistration')}</p>
|
||||
<p className="text-xs text-slate-400 mt-0.5">{t('admin.oidcRegistrationHint')}</p>
|
||||
</div>
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={() => handleToggleAuthSetting('oidc_registration', !oidcRegistration, setOidcRegistration)}
|
||||
className={`relative inline-flex h-6 w-11 flex-shrink-0 items-center rounded-full transition-colors ${oidcRegistration ? 'bg-content' : 'bg-edge'}`}
|
||||
>
|
||||
@@ -237,7 +237,7 @@ export default function AdminSettingsTab({ admin, t }: AdminSettingsTabProps): R
|
||||
className="w-full px-3 py-2 border border-slate-300 rounded-lg text-sm focus:ring-2 focus:ring-slate-400 focus:border-transparent"
|
||||
/>
|
||||
<p className="text-xs text-slate-400 mt-2">{t('admin.fileTypesFormat')}</p>
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={async () => {
|
||||
setSavingFileTypes(true)
|
||||
try {
|
||||
@@ -293,7 +293,7 @@ export default function AdminSettingsTab({ admin, t }: AdminSettingsTabProps): R
|
||||
{showKeys.maps ? <EyeOff className="w-4 h-4" /> : <Eye className="w-4 h-4" />}
|
||||
</button>
|
||||
</div>
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={() => handleValidateKey('maps')}
|
||||
disabled={!mapsKey || validating.maps}
|
||||
className="px-3 py-2 text-sm border border-slate-300 rounded-lg hover:bg-slate-50 disabled:opacity-40 disabled:cursor-not-allowed flex items-center gap-1.5"
|
||||
@@ -451,7 +451,7 @@ export default function AdminSettingsTab({ admin, t }: AdminSettingsTabProps): R
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={handleSaveApiKeys}
|
||||
disabled={savingKeys}
|
||||
className="flex items-center gap-2 px-4 py-2 bg-slate-900 text-white rounded-lg text-sm hover:bg-slate-700 disabled:bg-slate-400"
|
||||
@@ -525,7 +525,7 @@ export default function AdminSettingsTab({ admin, t }: AdminSettingsTabProps): R
|
||||
className="w-full px-3 py-2 border border-slate-300 rounded-lg text-sm focus:ring-2 focus:ring-slate-400 focus:border-transparent"
|
||||
/>
|
||||
</div>
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={async () => {
|
||||
setSavingOidc(true)
|
||||
try {
|
||||
@@ -565,7 +565,7 @@ export default function AdminSettingsTab({ admin, t }: AdminSettingsTabProps): R
|
||||
<p className="text-sm font-medium text-slate-700">Rotate JWT Secret</p>
|
||||
<p className="text-xs text-slate-400 mt-0.5">Generate a new JWT signing secret. All active sessions will be invalidated immediately.</p>
|
||||
</div>
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={() => setShowRotateJwtModal(true)}
|
||||
className="flex items-center gap-2 px-4 py-2 bg-red-600 hover:bg-red-700 text-white rounded-lg text-sm font-medium transition-colors"
|
||||
>
|
||||
|
||||
@@ -37,7 +37,7 @@ export default function AdminUpdateBanner({ updateInfo, t, onHowTo }: AdminUpdat
|
||||
{t('admin.update.button')}
|
||||
</a>
|
||||
)}
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={onHowTo}
|
||||
className="flex items-center gap-1.5 px-4 py-2 rounded-lg text-sm font-semibold transition-colors bg-slate-900 dark:bg-white text-white dark:text-slate-900 hover:bg-slate-700 dark:hover:bg-gray-200"
|
||||
>
|
||||
|
||||
@@ -58,13 +58,13 @@ export default function AdminUserModals({ admin, t }: AdminUserModalsProps): Rea
|
||||
size="sm"
|
||||
footer={
|
||||
<div className="flex justify-end gap-3">
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={() => setShowCreateUser(false)}
|
||||
className="rounded-lg border border-slate-200 px-4 py-2 text-sm text-slate-600 hover:bg-slate-50"
|
||||
>
|
||||
{t('common.cancel')}
|
||||
</button>
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={handleCreateUser}
|
||||
className="rounded-lg bg-slate-900 px-4 py-2 text-sm text-white hover:bg-slate-700"
|
||||
>
|
||||
@@ -137,13 +137,13 @@ export default function AdminUserModals({ admin, t }: AdminUserModalsProps): Rea
|
||||
size="sm"
|
||||
footer={
|
||||
<div className="flex justify-end gap-3">
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={() => setEditingUser(null)}
|
||||
className="rounded-lg border border-slate-200 px-4 py-2 text-sm text-slate-600 hover:bg-slate-50"
|
||||
>
|
||||
{t('common.cancel')}
|
||||
</button>
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={handleSaveUser}
|
||||
className="rounded-lg bg-slate-900 px-4 py-2 text-sm text-white hover:bg-slate-700"
|
||||
>
|
||||
@@ -392,7 +392,7 @@ docker run -d --name trek \\
|
||||
</div>
|
||||
|
||||
<div style={{ padding: '0 24px 20px', display: 'flex', justifyContent: 'flex-end' }}>
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={() => setShowUpdateModal(false)}
|
||||
className="bg-slate-900 text-white hover:bg-slate-700 dark:bg-white dark:text-slate-900 dark:hover:bg-gray-200"
|
||||
style={{
|
||||
@@ -420,14 +420,14 @@ docker run -d --name trek \\
|
||||
size="sm"
|
||||
footer={
|
||||
<div className="flex justify-end gap-3">
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={() => setShowRotateJwtModal(false)}
|
||||
disabled={rotatingJwt}
|
||||
className="rounded-lg border border-slate-200 px-4 py-2 text-sm text-slate-600 hover:bg-slate-50 disabled:opacity-50"
|
||||
>
|
||||
{t('common.cancel')}
|
||||
</button>
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={async () => {
|
||||
setRotatingJwt(true);
|
||||
try {
|
||||
|
||||
@@ -32,7 +32,7 @@ export default function AdminUsersTab({ admin, t, locale }: AdminUsersTabProps):
|
||||
<h2 className="font-semibold text-slate-900">{t('admin.tabs.users')}</h2>
|
||||
<p className="text-xs text-slate-400 mt-1">{users.length} {t('admin.stats.users')}</p>
|
||||
</div>
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={() => setShowCreateUser(true)}
|
||||
className="flex items-center gap-1.5 px-3 py-1.5 text-sm bg-slate-900 text-white rounded-lg hover:bg-slate-700 transition-colors"
|
||||
>
|
||||
@@ -100,14 +100,14 @@ export default function AdminUsersTab({ admin, t, locale }: AdminUsersTabProps):
|
||||
</td>
|
||||
<td className="px-5 py-3">
|
||||
<div className="flex items-center gap-2 justify-end">
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={() => handleEditUser(u)}
|
||||
className="p-1.5 text-slate-400 hover:text-slate-900 hover:bg-slate-100 rounded-lg transition-colors"
|
||||
title={t('admin.editUser')}
|
||||
>
|
||||
<Edit2 className="w-4 h-4" />
|
||||
</button>
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={() => handleDeleteUser(u)}
|
||||
disabled={u.id === currentUser?.id}
|
||||
className="p-1.5 text-slate-400 hover:text-red-600 hover:bg-red-50 rounded-lg transition-colors disabled:opacity-30 disabled:cursor-not-allowed"
|
||||
@@ -132,7 +132,7 @@ export default function AdminUsersTab({ admin, t, locale }: AdminUsersTabProps):
|
||||
<h2 className="font-semibold text-slate-900">{t('admin.invite.title')}</h2>
|
||||
<p className="text-xs text-slate-400 mt-1">{t('admin.invite.subtitle')}</p>
|
||||
</div>
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={() => setShowCreateInvite(true)}
|
||||
className="flex items-center gap-1.5 px-3 py-1.5 text-sm bg-slate-900 text-white rounded-lg hover:bg-slate-700 transition-colors"
|
||||
>
|
||||
@@ -169,12 +169,12 @@ export default function AdminUsersTab({ admin, t, locale }: AdminUsersTabProps):
|
||||
</div>
|
||||
</div>
|
||||
{isActive && (
|
||||
<button onClick={() => copyInviteLink(inv.token)} title={t('admin.invite.copyLink')}
|
||||
<button type="button" onClick={() => copyInviteLink(inv.token)} title={t('admin.invite.copyLink')}
|
||||
className="p-1.5 rounded-lg hover:bg-slate-100 text-slate-400 hover:text-slate-700 transition-colors">
|
||||
<Copy className="w-3.5 h-3.5" />
|
||||
</button>
|
||||
)}
|
||||
<button onClick={() => handleDeleteInvite(inv.id)} title={t('common.delete')}
|
||||
<button type="button" onClick={() => handleDeleteInvite(inv.id)} title={t('common.delete')}
|
||||
className="p-1.5 rounded-lg hover:bg-red-50 text-slate-400 hover:text-red-500 transition-colors">
|
||||
<Trash2 className="w-3.5 h-3.5" />
|
||||
</button>
|
||||
@@ -239,8 +239,8 @@ export default function AdminUsersTab({ admin, t, locale }: AdminUsersTabProps):
|
||||
</div>
|
||||
)}
|
||||
<div className="flex justify-end gap-2 pt-2 border-t border-slate-100">
|
||||
<button onClick={() => setShowCreateInvite(false)} className="px-4 py-2 text-sm text-slate-500 hover:text-slate-700">{t('common.cancel')}</button>
|
||||
<button onClick={handleCreateInvite} className="px-4 py-2 text-sm bg-slate-900 text-white rounded-lg hover:bg-slate-700">{t('admin.invite.createAndCopy')}</button>
|
||||
<button type="button" onClick={() => setShowCreateInvite(false)} className="px-4 py-2 text-sm text-slate-500 hover:text-slate-700">{t('common.cancel')}</button>
|
||||
<button type="button" onClick={handleCreateInvite} className="px-4 py-2 text-sm bg-slate-900 text-white rounded-lg hover:bg-slate-700">{t('admin.invite.createAndCopy')}</button>
|
||||
</div>
|
||||
</div>
|
||||
</Modal>
|
||||
|
||||
@@ -113,7 +113,7 @@ export default function AtlasCountrySearch({
|
||||
}}
|
||||
/>
|
||||
{search.trim() && (
|
||||
<button
|
||||
<button type="button"
|
||||
onClick={() => {
|
||||
setSearch('')
|
||||
setResults([])
|
||||
@@ -142,7 +142,7 @@ export default function AtlasCountrySearch({
|
||||
}}
|
||||
>
|
||||
{results.map((r) => (
|
||||
<button
|
||||
<button type="button"
|
||||
key={r.code}
|
||||
onClick={() => onSelect(r.code)}
|
||||
style={{
|
||||
@@ -187,7 +187,7 @@ export default function AtlasCountrySearch({
|
||||
</div>
|
||||
)}
|
||||
{placeResults.map((p) => (
|
||||
<button
|
||||
<button type="button"
|
||||
key={`${p.lat},${p.lng},${p.name}`}
|
||||
onClick={() => onSelectPlace(p)}
|
||||
style={{
|
||||
|
||||
@@ -14,9 +14,9 @@ const PLANNED_KEY = 'trek_atlas_show_planned'
|
||||
|
||||
function hexToRgba(hex: string, alpha: number): string {
|
||||
const clean = hex.replace('#', '')
|
||||
const r = parseInt(clean.substring(0, 2), 16)
|
||||
const g = parseInt(clean.substring(2, 4), 16)
|
||||
const b = parseInt(clean.substring(4, 6), 16)
|
||||
const r = Number.parseInt(clean.substring(0, 2), 16)
|
||||
const g = Number.parseInt(clean.substring(2, 4), 16)
|
||||
const b = Number.parseInt(clean.substring(4, 6), 16)
|
||||
return `rgba(${r},${g},${b},${alpha})`
|
||||
}
|
||||
|
||||
@@ -988,8 +988,8 @@ export function useAtlas() {
|
||||
const handleAddBucketItem = async (): Promise<void> => {
|
||||
if (!bucketForm.name.trim()) return
|
||||
const hasCoords = !!(bucketForm.lat && bucketForm.lng)
|
||||
const lat = hasCoords ? parseFloat(bucketForm.lat) : null
|
||||
const lng = hasCoords ? parseFloat(bucketForm.lng) : null
|
||||
const lat = hasCoords ? Number.parseFloat(bucketForm.lat) : null
|
||||
const lng = hasCoords ? Number.parseFloat(bucketForm.lng) : null
|
||||
const targetDate = bucketForm.target_date || (bucketPoiMonth > 0 && bucketPoiYear > 0 ? `${bucketPoiYear}-${String(bucketPoiMonth).padStart(2, '0')}` : null)
|
||||
// #1898: this form never sends a country code, so the entry it would create
|
||||
// is identified by name, date and coordinates alone. Keep the form filled so
|
||||
|
||||
@@ -126,7 +126,7 @@ export function sortProviderPhotos<T extends ProviderPhotoAsset>(photos: T[], lo
|
||||
.map((photo, index) => ({
|
||||
photo,
|
||||
index,
|
||||
distance: isValidGeoPoint({ lat: photo.lat ?? NaN, lng: photo.lng ?? NaN })
|
||||
distance: isValidGeoPoint({ lat: photo.lat ?? Number.NaN, lng: photo.lng ?? Number.NaN })
|
||||
? distanceBetweenGeoPoints(location, { lat: photo.lat!, lng: photo.lng! })
|
||||
: null,
|
||||
}))
|
||||
|
||||
@@ -295,11 +295,11 @@ export function useJourneyStudio() {
|
||||
*/
|
||||
const points = stats?.points ?? []
|
||||
const dayCount = stats?.days ?? null
|
||||
const first = stats?.start ? Date.parse(`${stats.start}T00:00:00`) : NaN
|
||||
const first = stats?.start ? Date.parse(`${stats.start}T00:00:00`) : Number.NaN
|
||||
const placed = withPhotos.map(entry => {
|
||||
const point = points.find(p => p.date && entry.date && p.date === entry.date)
|
||||
?? points.find(p => p.label && entry.location && p.label === entry.location)
|
||||
const at = entry.date ? Date.parse(`${entry.date}T00:00:00`) : NaN
|
||||
const at = entry.date ? Date.parse(`${entry.date}T00:00:00`) : Number.NaN
|
||||
const dayNumber = Number.isFinite(at) && Number.isFinite(first)
|
||||
? Math.floor((at - first) / 86_400_000) + 1
|
||||
: null
|
||||
|
||||
@@ -16,7 +16,7 @@ export function worldDots(): { x: number; y: number }[] {
|
||||
const out: { x: number; y: number }[] = [];
|
||||
let cursor = 0;
|
||||
for (const part of PACKED.split('.')) {
|
||||
cursor += parseInt(part, 36);
|
||||
cursor += Number.parseInt(part, 36);
|
||||
out.push({ x: cursor % WORLD_GRID_W, y: Math.floor(cursor / WORLD_GRID_W) });
|
||||
}
|
||||
return out;
|
||||
|
||||
@@ -48,7 +48,7 @@ export function useTripPlanner() {
|
||||
// The route param is a string; convert once here so every downstream component
|
||||
// prop and store call gets a real number. An absent/invalid id becomes NaN,
|
||||
// which stays falsy in the `if (tripId)` guards below.
|
||||
const tripId = id ? Number(id) : NaN
|
||||
const tripId = id ? Number(id) : Number.NaN
|
||||
const navigate = useNavigate()
|
||||
const toast = useToast()
|
||||
const { t, language } = useTranslation()
|
||||
|
||||
Reference in New Issue
Block a user