Files
buzz/desktop/src/features/settings/UpdateChecker.tsx
klopez4212 43e53fc349 Standardize settings section layout (#5855)
## Summary

- move Settings section labels outside their framed containers and
centralize the spacing
- apply the shared hierarchy across Appearance, Notifications, Voice,
Agents, Shortcuts, Members, and Profile
- give Identity and Sign out complete section treatments while removing
redundant in-cell labels

## Testing

- desktop pre-push checks, including 4,791 tests
- focused Settings layout and sign-out Playwright coverage

---------

Signed-off-by: kenny lopez <klopez4212@gmail.com>
Signed-off-by: Princess Donut <b238ea756dee4d98afa5883fc7f1de61eeabe65bf700e3a5a5a80db5e42e2c2b@buzz.block.builderlab.xyz>
Co-authored-by: Princess Donut <b238ea756dee4d98afa5883fc7f1de61eeabe65bf700e3a5a5a80db5e42e2c2b@buzz.block.builderlab.xyz>
2026-08-14 16:25:40 +01:00

174 lines
5.4 KiB
TypeScript

import { openUrl } from "@tauri-apps/plugin-opener";
import { useUpdaterContext } from "./hooks/UpdaterProvider";
import { Button } from "@/shared/ui/button";
import {
SettingsOptionGroup,
SettingsOptionRow,
} from "./ui/SettingsOptionGroup";
import { SettingsSectionHeader } from "./ui/SettingsSectionHeader";
export function UpdateChecker() {
const { status, checkForUpdate, installAndRelaunch } = useUpdaterContext();
return (
<section className="min-w-0" data-testid="settings-updates">
<SettingsSectionHeader
title="Software Updates"
description="Keep Buzz up to date with the latest features and fixes."
/>
<SettingsOptionGroup title="Update status">
{status.state === "idle" && (
<SettingsOptionRow>
<div className="min-w-0">
<p
className="text-sm font-normal text-muted-foreground/70"
data-settings-subcopy
>
Check if a new version is available.
</p>
</div>
<Button size="sm" onClick={checkForUpdate}>
Check for Updates
</Button>
</SettingsOptionRow>
)}
{status.state === "checking" && (
<SettingsOptionRow>
<div className="min-w-0">
<p
className="text-sm font-normal text-muted-foreground/70"
data-settings-subcopy
>
Checking for updates...
</p>
</div>
</SettingsOptionRow>
)}
{status.state === "up-to-date" && (
<SettingsOptionRow>
<div className="min-w-0">
<p
className="text-sm font-normal text-muted-foreground/70"
data-settings-subcopy
>
You're on the latest version.
</p>
</div>
<Button variant="outline" size="sm" onClick={checkForUpdate}>
Check Again
</Button>
</SettingsOptionRow>
)}
{status.state === "unavailable" && (
<SettingsOptionRow>
<div className="min-w-0">
<p
className="text-sm font-normal text-muted-foreground/70"
data-settings-subcopy
>
Automatic updates aren't available on this build. Download the
latest release manually.
</p>
</div>
<Button variant="outline" size="sm" onClick={checkForUpdate}>
Check Again
</Button>
</SettingsOptionRow>
)}
{status.state === "manual-required" && (
<SettingsOptionRow>
<div className="min-w-0">
<p className="text-sm font-medium">
Update available — v{status.version}
</p>
<p
className="text-sm font-normal text-muted-foreground/70"
data-settings-subcopy
>
In-app updates aren't supported on this Linux package. Download
the new version from GitHub.{" "}
<span>Switch to the AppImage build for automatic updates.</span>
</p>
</div>
<Button size="sm" onClick={() => void openUrl(status.releaseUrl)}>
Download Update
</Button>
</SettingsOptionRow>
)}
{status.state === "available" && (
<SettingsOptionRow>
<div className="min-w-0">
<p
className="text-sm font-normal text-muted-foreground/70"
data-settings-subcopy
>
Preparing update...
</p>
</div>
</SettingsOptionRow>
)}
{status.state === "downloading" && (
<SettingsOptionRow>
<div className="min-w-0">
<p
className="text-sm font-normal text-muted-foreground/70"
data-settings-subcopy
>
Downloading update...
</p>
</div>
</SettingsOptionRow>
)}
{status.state === "installing" && (
<SettingsOptionRow>
<div className="min-w-0">
<p
className="text-sm font-normal text-muted-foreground/70"
data-settings-subcopy
>
Installing update...
</p>
</div>
</SettingsOptionRow>
)}
{status.state === "ready" && (
<SettingsOptionRow>
<div className="min-w-0">
<p
className="text-sm font-normal text-muted-foreground/70"
data-settings-subcopy
>
Update downloaded. Click to apply.
</p>
</div>
<Button size="sm" onClick={installAndRelaunch}>
Update Now
</Button>
</SettingsOptionRow>
)}
{status.state === "error" && (
<SettingsOptionRow>
<div className="min-w-0">
<p className="text-sm font-normal text-destructive">
Update failed: {status.message}
</p>
</div>
<Button variant="outline" size="sm" onClick={checkForUpdate}>
Retry
</Button>
</SettingsOptionRow>
)}
</SettingsOptionGroup>
</section>
);
}