The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.
TypeScript budget-trackercollaborativedockeritinerarymcp-serveroffline-firstopen-sourceopenstreetmappacking-listpwareal-timeself-hostedselfhostedtraveltravel-apptravel-journaltravel-plannertripitwanderlog
import { useState } from 'react'
import { Moon } from 'lucide-react'
import { useTranslation } from '../../i18n/TranslationContext'
import ToggleSwitch from '../Settings/ToggleSwitch'
export interface EndDayControlProps {
active: boolean
/**
* Whatever it resolves to is ignored here: this control reads its state back from the
* trip. The writer reports success to callers that flip a switch optimistically, and the
* type has to let that through.
*/
onToggle: () => Promise<unknown>
}
export default function EndDayControl({ active, onToggle }: EndDayControlProps) {
const { t } = useTranslation()
const [pending, setPending] = useState(false)
return (
<fieldset disabled={pending} aria-busy={pending} className="flex min-h-[38px] min-w-0 items-center justify-between gap-2 rounded-[10px] border border-edge-faint bg-surface-card px-3 py-1.5 disabled:opacity-60">
<span className="flex flex-1 items-center gap-1.5 text-[length:calc(12.5px*var(--fs-scale-body,1))] font-medium text-content"><Moon size={13} className={`shrink-0 ${active ? 'text-accent-on' : 'text-content-faint'}`} aria-hidden />{t('roadtrip.window.endHere')}</span>
<ToggleSwitch on={active} label={t('roadtrip.window.endHere')} onToggle={async () => {
if (pending) return
setPending(true)
try { await onToggle() } finally { setPending(false) }
}} />
</fieldset>
)
}