Skip to content

Commit 8bfc963

Browse files
feat: enhance settings UI with update notifications and improved button styles
Added a new accent style for update-related buttons in the settings, improving visibility and user interaction. Updated the About and System tabs to display available updates with version information, enhancing user awareness of software updates. Adjusted the footnote prop in SettingsSection for better documentation clarity.
1 parent ef2d9a3 commit 8bfc963

5 files changed

Lines changed: 60 additions & 13 deletions

File tree

apps/desktop/src/features/settings/_components/about-tab.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { useEffect, useState } from "react";
22
import appIcon from "../../../../src-tauri/icons/128x128@2x.png";
33
import { useSettings } from "../../../shared/context/settings-context";
4+
import { useUpdater } from "../../../shared/context/updater-context";
45
import { openExternalLink } from "../../../shared/lib/external-link";
56

67
const REPO_URL = "https://github.com/adarshaacharya/sajilo";
@@ -23,7 +24,9 @@ function QuietLink({ label, href }: { label: string; href: string }) {
2324

2425
export function AboutTab() {
2526
const { t } = useSettings();
27+
const { state: updateState, update } = useUpdater();
2628
const [version, setVersion] = useState<string | null>(null);
29+
const newVersion = updateState === "available" && update ? update.version : null;
2730

2831
useEffect(() => {
2932
import("@tauri-apps/api/app")
@@ -40,8 +43,15 @@ export function AboutTab() {
4043
<p className="text-[11px] text-text-secondary">{t("about.tagline")}</p>
4144
<QuietLink label="sajilo.fyi" href={WEBSITE_URL} />
4245
{version && (
43-
<p className="mt-0.5 text-[10px] text-text-muted">
44-
{t("about.version")} {version}
46+
<p className="mt-1 inline-flex items-center gap-1 rounded-full border border-accent/25 bg-accent/10 px-2 py-0.5 text-[10px] text-text-muted">
47+
{t("about.version")}
48+
<span className="font-medium tabular-nums text-accent">{version}</span>
49+
</p>
50+
)}
51+
{newVersion && (
52+
<p className="mt-1 inline-flex items-center gap-1 rounded-full bg-accent-fill px-2 py-0.5 text-[10px] text-accent-ink">
53+
{t("settings.update-found")}
54+
<span className="font-medium tabular-nums">{newVersion}</span>
4555
</p>
4656
)}
4757

apps/desktop/src/features/settings/_components/settings-section.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ export function SettingsSection({
77
children,
88
}: {
99
title: string;
10-
footnote?: string;
10+
/** Text, or a fragment when part of it needs its own emphasis. */
11+
footnote?: ReactNode;
1112
children: ReactNode;
1213
}) {
1314
return (

apps/desktop/src/features/settings/_components/system-tab.tsx

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,16 +73,30 @@ export function SystemTab() {
7373
setMessage(t("settings.backup-imported"));
7474
};
7575

76+
// The version number is the part of this line a reader is actually looking
77+
// for, so it is picked out rather than left to dissolve into grey.
78+
const version = (value: string) => (
79+
<span className="font-medium tabular-nums text-accent">{value}</span>
80+
);
81+
7682
const updateNote = {
7783
idle: null,
7884
checking: t("settings.update-checking"),
7985
"up-to-date": t("settings.update-up-to-date"),
80-
available: update
81-
? `${t("settings.update-found")} ${update.version}`
82-
: t("settings.update-checking"),
83-
downloading: update
84-
? `${t("settings.update-available")} ${update.version}…`
85-
: t("settings.update-checking"),
86+
available: update ? (
87+
<>
88+
{t("settings.update-found")} {version(update.version)}
89+
</>
90+
) : (
91+
t("settings.update-checking")
92+
),
93+
downloading: update ? (
94+
<>
95+
{t("settings.update-available")} {version(update.version)}
96+
</>
97+
) : (
98+
t("settings.update-checking")
99+
),
86100
installed: t("settings.update-installed"),
87101
failed: updateError
88102
? `${t("settings.update-failed")}${updateError}`
@@ -94,7 +108,11 @@ export function SystemTab() {
94108
{updaterEnabled && (
95109
<SettingsSection title={t("settings.updates")} footnote={updateNote ?? undefined}>
96110
{updateState === "installed" ? (
97-
<button type="button" onClick={() => restartToUpdate()} className="settings-btn">
111+
<button
112+
type="button"
113+
onClick={() => restartToUpdate()}
114+
className="settings-btn settings-btn--accent"
115+
>
98116
<Icon name="refresh" className="size-3 shrink-0" />
99117
{t("settings.update-restart")}
100118
</button>
@@ -103,7 +121,7 @@ export function SystemTab() {
103121
type="button"
104122
onClick={() => installUpdate()}
105123
disabled={!update}
106-
className="settings-btn"
124+
className="settings-btn settings-btn--accent"
107125
>
108126
<Icon name="refresh" className="size-3 shrink-0" />
109127
{t("settings.install-update")}

apps/desktop/src/index.css

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,24 @@ html {
491491
background: var(--color-surface-hover);
492492
}
493493

494+
/* An update waiting to be installed, or installed and waiting for a restart,
495+
is the one thing in Settings asking to be clicked, so it is marked — but in
496+
the same voice as the version pill in About: gold edge, gold text, the
497+
faintest gold behind it. A solid fill would shout across a 380px popover
498+
where nothing else does. Deliberately not used on "Check for updates",
499+
which is routine. */
500+
.settings-btn--accent {
501+
border-color: color-mix(in srgb, var(--color-accent-mark) 40%, transparent);
502+
background: color-mix(in srgb, var(--color-accent-mark) 10%, transparent);
503+
color: var(--color-accent);
504+
font-weight: 500;
505+
}
506+
507+
.settings-btn--accent:hover {
508+
background: color-mix(in srgb, var(--color-accent-mark) 18%, transparent);
509+
border-color: color-mix(in srgb, var(--color-accent-mark) 55%, transparent);
510+
}
511+
494512
/* macOS NSSwitch — used in Settings, planner, VAT tool. */
495513
.mac-switch {
496514
position: relative;

apps/landing/style.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,9 +321,9 @@ img {
321321

322322
.hero-copy h1 {
323323
font-family: var(--display);
324-
font-weight: 700;
324+
font-weight: 800;
325325
font-size: clamp(2.5rem, 4.2vw + 1rem, 4.25rem);
326-
letter-spacing: -0.03em;
326+
letter-spacing: -0.035em;
327327
line-height: 1.04;
328328
margin: 0 0 18px;
329329
text-wrap: balance;

0 commit comments

Comments
 (0)