Add Update section to Settings page as toast fallback#18
Conversation
Co-authored-by: vanister <7736967+vanister@users.noreply.github.com>
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
evchargetracker | feec08c | Commit Preview URL Branch Preview URL |
Mar 04 2026, 11:56 AM |
…ction styles Co-authored-by: vanister <7736967+vanister@users.noreply.github.com>
src/pages/settings/Settings.tsx
Outdated
| <div className="p-2 bg-primary/10 rounded-lg"> | ||
| <Icon name="zap" size="md" className="text-primary" /> | ||
| <SettingsSection title="Storage" cardClassName="space-y-3"> | ||
| {state.storageUsed !== null && state.storageQuota !== null ? ( |
There was a problem hiding this comment.
Should you handle null and undefined with != null?
There was a problem hiding this comment.
Done in 5b5a77b. The null check now uses != null (covers both null and undefined). It's a single guard clause at the top of StorageSectionBody, so storagePercent is computed after and only needs to check storageQuota > 0.
… guard clause Co-authored-by: vanister <7736967+vanister@users.noreply.github.com>
src/pages/settings/Settings.tsx
Outdated
| state.storageUsed !== null && state.storageQuota !== null && state.storageQuota > 0 | ||
| ? Math.min(100, (state.storageUsed / state.storageQuota) * 100) | ||
| : null; | ||
| const { needsUpdate, applyUpdate } = useAppUpdateAvailable(); |
There was a problem hiding this comment.
Move this into the update app section.
There was a problem hiding this comment.
Done in 2e220be. UpdateSectionBody now owns the hook call (useAppUpdateAvailable(true)). Settings.tsx no longer imports or calls it.
src/pages/settings/Settings.tsx
Outdated
| {needsUpdate && ( | ||
| <SettingsSection title="Update"> | ||
| <UpdateSectionBody onApply={applyUpdate} /> | ||
| </SettingsSection> | ||
| )} |
There was a problem hiding this comment.
Let's always show this section and show an app is up to date or the reload button when there's a new version
There was a problem hiding this comment.
Done in 2e220be. The Update section always renders. UpdateSectionBody shows "App is up to date" with a check-circle icon when !needsUpdate, and the reload button when a new version is available.
src/pages/settings/Settings.tsx
Outdated
| <div className="max-w-2xl mx-auto space-y-8"> | ||
| <section> | ||
| <SectionHeader title="Locations" /> | ||
| <LocationsSection /> |
There was a problem hiding this comment.
Why is this location section not a child of settings section?
There was a problem hiding this comment.
Done in 2e220be. LocationsSection had its own <section> + <SectionHeader> from when it wasn't a SettingsSection child — that was the previous design where Locations didn't follow the card pattern. Now it's <SettingsSection title="Locations"><LocationsSectionBody /></SettingsSection> just like the other sections.
…e Update section; LocationsSection as SettingsSection child Co-authored-by: vanister <7736967+vanister@users.noreply.github.com>
…ponent Co-authored-by: vanister <7736967+vanister@users.noreply.github.com>
useAppUpdateAvailable.tsto return{ needsUpdate, applyUpdate }Settings.tsxthat conditionally renders whenneedsUpdateis trueSettingsSectionwrapper component to consolidate repeatingsection + SectionHeader + card divpattern!= null(loose equality) for storage null checks — guard clause beforestoragePercenteliminates duplicate checkLocationsSection,StorageSectionBody,UpdateSectionBody,AboutSectionBody)dontToast = falseparameter touseAppUpdateAvailable;UpdateSectionBodypassestrueto suppress toastuseAppUpdateAvailablecall fromSettings.tsxintoUpdateSectionBody(self-contained)LocationsSectionBodyinsideSettingsSectioninSettings.tsxwindow.ref fromconfirm()inLocationsSectionalert()on delete failure with persistent error toast<button>inUpdateSectionBodywith sharedButtoncomponentOriginal prompt
This pull request was created from Copilot chat.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.