From a8c8e04343d59a828ac92d76dd0958d4818f2268 Mon Sep 17 00:00:00 2001 From: SylvainDruaux Date: Sun, 29 Nov 2026 15:53:24 +0100 Subject: [PATCH] feat(git): remind to commit once work has stayed uncommitted Once a project has held uncommitted changes for a chosen interval, Stacki says so quietly: one line above the commit message in the Git panel ("Uncommitted changes for 1 hour"), a dot on the title bar's branch chip, whose tooltip says the same, and a dot on the rail's Git tab while the Git panel is closed. The time shown moves on by itself, and the reminder stays until a commit or until it is turned off; nothing snoozes it. A clock beside "Commit to " picks the interval: Off, 30 minutes, 1, 2 or 4 hours, with 1 hour by default. Its tooltip names the interval, and it dims while the reminder is off. The choice is kept per project on this computer, beside the commit type and with the same bound, never in the project. Only uncommitted time counts: a project with nothing to commit is never reminded of anything, however long it stays open. When the uncommitted work began, and on which commit, is kept on this computer too, so a project reopened on the same commit picks up where it left off, and a reminder already due shows at once. On any other commit (one made elsewhere, an amend, another branch) the changes are newer, and the clock starts at opening. Why a reminder and not automatic backups like Webflow's: a safety net that saves work on its own teaches people new to Git that committing is optional, and it would add a second history beside Git's, with its own storage, restore flow and edge cases. A commit is the step people come back to, share and publish, so the reminder teaches that habit instead. Why it stays subtle: no toast, no dialog, nothing that interrupts the work. A reminder that nags gets turned off, and one that is turned off teaches nothing. A dot and one line are enough to be noticed when you look, and easy to leave for later when you are in the middle of something. Studio shows the line and the clock in its Git panel. It has no rail dot, and its clock runs only while the Git panel is open, because Studio reads Git status only there. No new source files: Studio's release targets 2,950 files, so the reminder lives in useGitSession.ts and GitChipView.tsx. The Apps rail badge's class becomes the shared .rail-badge, used by both dots. commitReminder.test.js covers the clock, the kept values and their bounds, and the hook in jsdom under a mocked clock, reopening included. commitReminderChromium.test.js draws the real Git panel in all 18 languages at 260, 340 and 600px, and checks that the line never reaches past the panel, takes at most two lines, and that the clock stays centred at the end of the heading. --- shared/properties/i18n/messages/ar/git.ts | 4 + shared/properties/i18n/messages/de/git.ts | 4 + shared/properties/i18n/messages/en/git.ts | 4 + shared/properties/i18n/messages/es/git.ts | 4 + shared/properties/i18n/messages/fr/git.ts | 4 + shared/properties/i18n/messages/he/git.ts | 4 + shared/properties/i18n/messages/hi/git.ts | 4 + shared/properties/i18n/messages/id/git.ts | 4 + shared/properties/i18n/messages/it/git.ts | 4 + shared/properties/i18n/messages/ja/git.ts | 4 + shared/properties/i18n/messages/ko/git.ts | 4 + shared/properties/i18n/messages/nl/git.ts | 4 + shared/properties/i18n/messages/pl/git.ts | 4 + shared/properties/i18n/messages/ptBR/git.ts | 4 + shared/properties/i18n/messages/ru/git.ts | 4 + shared/properties/i18n/messages/tr/git.ts | 4 + shared/properties/i18n/messages/zhCN/git.ts | 4 + shared/properties/i18n/messages/zhTW/git.ts | 4 + src/app/LeftRail.tsx | 17 +- src/app/shell/AppShell.tsx | 4 +- src/app/shell/DesktopGitPull.tsx | 30 +- src/app/shell/DesktopPublishButton.tsx | 4 +- src/app/styles.css | 72 ++++ src/features/apps/appUpdates.tsx | 2 +- src/features/apps/apps.css | 2 +- src/features/apps/marketplace/marketplace.css | 13 - src/features/git/BranchIndicator.tsx | 40 +- src/features/git/GitChip.tsx | 1 + src/features/git/GitChipView.tsx | 75 +++- src/features/git/branchIndicator.css | 9 + src/features/git/useGitSession.ts | 263 ++++++++++++- src/lib/projectPreference.ts | 19 +- test/renderer/apps/appsPanel.test.js | 6 +- test/renderer/git/commitReminder.test.js | 355 ++++++++++++++++++ .../git/commitReminderChromium.test.js | 246 ++++++++++++ 35 files changed, 1187 insertions(+), 43 deletions(-) create mode 100644 test/renderer/git/commitReminder.test.js create mode 100644 test/renderer/git/commitReminderChromium.test.js diff --git a/shared/properties/i18n/messages/ar/git.ts b/shared/properties/i18n/messages/ar/git.ts index 0e885f728..e9b6abb60 100644 --- a/shared/properties/i18n/messages/ar/git.ts +++ b/shared/properties/i18n/messages/ar/git.ts @@ -290,6 +290,10 @@ export const messages = { 'git.pull.none': 'لا توجد تغييرات للسحب', 'git.pull.unavailable': 'تعذّر فحص GitHub. تتم إعادة المحاولة تلقائيًا. {message}', 'git.pull.upToDate': 'محدّث بالفعل مع GitHub', + 'git.reminder.chip': 'تغييرات بلا commit منذ {duration}', + 'git.reminder.off': 'متوقف', + 'git.reminder.setting': 'ذكّرني بعمل commit', + 'git.reminder.settingValue': 'ذكّرني بعمل commit: {interval}', 'git.studio.branchExists': 'هذا الـ branch موجود بالفعل.', 'git.studio.branchGone': 'هذا الـ branch لم يعد موجودًا.', 'git.studio.branchLimit': 'يدعم Studio {max} branches كحد أقصى.', diff --git a/shared/properties/i18n/messages/de/git.ts b/shared/properties/i18n/messages/de/git.ts index 34c7d7415..339ae9ef7 100644 --- a/shared/properties/i18n/messages/de/git.ts +++ b/shared/properties/i18n/messages/de/git.ts @@ -249,6 +249,10 @@ export const messages = { 'git.pull.none': 'Keine Änderungen zum Abrufen', 'git.pull.unavailable': 'GitHub konnte nicht geprüft werden. Es wird automatisch erneut versucht. {message}', 'git.pull.upToDate': 'Bereits auf dem Stand von GitHub', + 'git.reminder.chip': 'Seit {duration} ungespeicherte Änderungen', + 'git.reminder.off': 'Aus', + 'git.reminder.setting': 'Ans Speichern erinnern', + 'git.reminder.settingValue': 'Ans Speichern erinnern: {interval}', 'git.studio.branchExists': 'Diesen Branch gibt es bereits.', 'git.studio.branchGone': 'Diesen Branch gibt es nicht mehr.', 'git.studio.branchLimit': 'Studio unterstützt höchstens {max} Branches.', diff --git a/shared/properties/i18n/messages/en/git.ts b/shared/properties/i18n/messages/en/git.ts index 29f505a20..9817270fa 100644 --- a/shared/properties/i18n/messages/en/git.ts +++ b/shared/properties/i18n/messages/en/git.ts @@ -239,6 +239,10 @@ export const messages = { 'git.pull.none': 'No changes to pull', 'git.pull.unavailable': 'Could not check GitHub. Retrying automatically. {message}', 'git.pull.upToDate': 'Already up to date with GitHub', + 'git.reminder.chip': 'Uncommitted changes for {duration}', + 'git.reminder.off': 'Off', + 'git.reminder.setting': 'Remind me to commit', + 'git.reminder.settingValue': 'Remind me to commit: {interval}', 'git.studio.branchExists': 'This branch already exists.', 'git.studio.branchGone': 'This branch no longer exists.', 'git.studio.branchLimit': 'Studio supports at most {max} branches.', diff --git a/shared/properties/i18n/messages/es/git.ts b/shared/properties/i18n/messages/es/git.ts index 51d308343..6288c482d 100644 --- a/shared/properties/i18n/messages/es/git.ts +++ b/shared/properties/i18n/messages/es/git.ts @@ -242,6 +242,10 @@ export const messages = { 'git.pull.none': 'No hay cambios que descargar', 'git.pull.unavailable': 'No se pudo consultar GitHub. Se reintentará automáticamente. {message}', 'git.pull.upToDate': 'Ya está al día con GitHub', + 'git.reminder.chip': 'Cambios sin guardar desde hace {duration}', + 'git.reminder.off': 'Desactivado', + 'git.reminder.setting': 'Recordarme guardar', + 'git.reminder.settingValue': 'Recordarme guardar: {interval}', 'git.studio.branchExists': 'Esta rama ya existe.', 'git.studio.branchGone': 'Esta rama ya no existe.', 'git.studio.branchLimit': 'Studio admite como máximo {max} ramas.', diff --git a/shared/properties/i18n/messages/fr/git.ts b/shared/properties/i18n/messages/fr/git.ts index 0ecefd374..2667e5435 100644 --- a/shared/properties/i18n/messages/fr/git.ts +++ b/shared/properties/i18n/messages/fr/git.ts @@ -246,6 +246,10 @@ export const messages = { 'git.pull.none': 'Aucune modification à récupérer', 'git.pull.unavailable': 'Impossible de joindre GitHub. Nouvelle tentative automatique. {message}', 'git.pull.upToDate': 'Déjà à jour avec GitHub', + 'git.reminder.chip': 'Modifications non enregistrées depuis {duration}', + 'git.reminder.off': 'Désactivé', + 'git.reminder.setting': 'Me rappeler d’enregistrer', + 'git.reminder.settingValue': 'Me rappeler d’enregistrer : {interval}', 'git.studio.branchExists': 'Cette branche existe déjà.', 'git.studio.branchGone': 'Cette branche n’existe plus.', 'git.studio.branchLimit': 'Studio prend en charge au plus {max} branches.', diff --git a/shared/properties/i18n/messages/he/git.ts b/shared/properties/i18n/messages/he/git.ts index 3de92247b..efaf733fc 100644 --- a/shared/properties/i18n/messages/he/git.ts +++ b/shared/properties/i18n/messages/he/git.ts @@ -238,6 +238,10 @@ export const messages = { 'git.pull.none': 'אין שינויים למשיכה', 'git.pull.unavailable': 'לא ניתן היה לבדוק את GitHub. מנסים שוב אוטומטית. {message}', 'git.pull.upToDate': 'כבר מעודכן מול GitHub', + 'git.reminder.chip': 'שינויים בלי קומיט כבר {duration}', + 'git.reminder.off': 'כבוי', + 'git.reminder.setting': 'להזכיר לי לעשות קומיט', + 'git.reminder.settingValue': 'להזכיר לי לעשות קומיט: {interval}', 'git.studio.branchExists': 'הענף הזה כבר קיים.', 'git.studio.branchGone': 'הענף הזה כבר לא קיים.', 'git.studio.branchLimit': 'Studio תומך בעד {max} ענפים.', diff --git a/shared/properties/i18n/messages/hi/git.ts b/shared/properties/i18n/messages/hi/git.ts index c232bdac3..1eabc3c60 100644 --- a/shared/properties/i18n/messages/hi/git.ts +++ b/shared/properties/i18n/messages/hi/git.ts @@ -241,6 +241,10 @@ export const messages = { 'git.pull.none': 'पुल करने के लिए कोई बदलाव नहीं', 'git.pull.unavailable': 'GitHub जाँचा नहीं जा सका। अपने आप फिर कोशिश हो रही है। {message}', 'git.pull.upToDate': 'GitHub के साथ पहले से अप-टू-डेट है', + 'git.reminder.chip': '{duration} से बदलाव कमिट नहीं हुए', + 'git.reminder.off': 'बंद', + 'git.reminder.setting': 'कमिट करने की याद दिलाएँ', + 'git.reminder.settingValue': 'कमिट करने की याद दिलाएँ: {interval}', 'git.studio.branchExists': 'यह ब्रांच पहले से मौजूद है।', 'git.studio.branchGone': 'यह ब्रांच अब मौजूद नहीं है।', 'git.studio.branchLimit': 'Studio अधिकतम {max} ब्रांच का समर्थन करता है।', diff --git a/shared/properties/i18n/messages/id/git.ts b/shared/properties/i18n/messages/id/git.ts index b5e630619..f9e042ac9 100644 --- a/shared/properties/i18n/messages/id/git.ts +++ b/shared/properties/i18n/messages/id/git.ts @@ -243,6 +243,10 @@ export const messages = { 'git.pull.none': 'Tidak ada perubahan untuk di-pull', 'git.pull.unavailable': 'Tidak dapat memeriksa GitHub. Mencoba lagi secara otomatis. {message}', 'git.pull.upToDate': 'Sudah mutakhir dengan GitHub', + 'git.reminder.chip': 'Perubahan belum di-commit selama {duration}', + 'git.reminder.off': 'Mati', + 'git.reminder.setting': 'Ingatkan saya untuk commit', + 'git.reminder.settingValue': 'Ingatkan saya untuk commit: {interval}', 'git.studio.branchExists': 'Branch ini sudah ada.', 'git.studio.branchGone': 'Branch ini sudah tidak ada.', 'git.studio.branchLimit': 'Studio mendukung paling banyak {max} branch.', diff --git a/shared/properties/i18n/messages/it/git.ts b/shared/properties/i18n/messages/it/git.ts index eea3672d5..82dfc2c6a 100644 --- a/shared/properties/i18n/messages/it/git.ts +++ b/shared/properties/i18n/messages/it/git.ts @@ -243,6 +243,10 @@ export const messages = { 'git.pull.none': 'Nessuna modifica da scaricare', 'git.pull.unavailable': 'Impossibile controllare GitHub. Nuovo tentativo automatico. {message}', 'git.pull.upToDate': 'Già aggiornato con GitHub', + 'git.reminder.chip': 'Modifiche senza commit da {duration}', + 'git.reminder.off': 'Disattivato', + 'git.reminder.setting': 'Ricordami di fare il commit', + 'git.reminder.settingValue': 'Ricordami di fare il commit: {interval}', 'git.studio.branchExists': 'Questo branch esiste già.', 'git.studio.branchGone': 'Questo branch non esiste più.', 'git.studio.branchLimit': 'Studio supporta al massimo {max} branch.', diff --git a/shared/properties/i18n/messages/ja/git.ts b/shared/properties/i18n/messages/ja/git.ts index f2834c8ff..e13673820 100644 --- a/shared/properties/i18n/messages/ja/git.ts +++ b/shared/properties/i18n/messages/ja/git.ts @@ -245,6 +245,10 @@ export const messages = { 'git.pull.none': 'プルする変更はありません', 'git.pull.unavailable': 'GitHub を確認できませんでした。自動で再試行します。{message}', 'git.pull.upToDate': 'GitHub と同期済みです', + 'git.reminder.chip': '{duration}コミットされていない変更があります', + 'git.reminder.off': 'オフ', + 'git.reminder.setting': 'コミットのリマインダー', + 'git.reminder.settingValue': 'コミットのリマインダー:{interval}', 'git.studio.branchExists': 'このブランチはすでに存在します。', 'git.studio.branchGone': 'このブランチはもう存在しません。', 'git.studio.branchLimit': 'Studio でサポートされるブランチは最大 {max} 個です。', diff --git a/shared/properties/i18n/messages/ko/git.ts b/shared/properties/i18n/messages/ko/git.ts index c9dc2425d..49858240c 100644 --- a/shared/properties/i18n/messages/ko/git.ts +++ b/shared/properties/i18n/messages/ko/git.ts @@ -238,6 +238,10 @@ export const messages = { 'git.pull.none': '가져올 변경 사항 없음', 'git.pull.unavailable': 'GitHub를 확인할 수 없습니다. 자동으로 다시 시도합니다. {message}', 'git.pull.upToDate': '이미 GitHub와 최신 상태입니다', + 'git.reminder.chip': '{duration} 동안 커밋하지 않은 변경 사항', + 'git.reminder.off': '끔', + 'git.reminder.setting': '커밋 알림', + 'git.reminder.settingValue': '커밋 알림: {interval}', 'git.studio.branchExists': '이 브랜치는 이미 있습니다.', 'git.studio.branchGone': '이 브랜치는 더 이상 존재하지 않습니다.', 'git.studio.branchLimit': 'Studio는 최대 {max}개의 브랜치를 지원합니다.', diff --git a/shared/properties/i18n/messages/nl/git.ts b/shared/properties/i18n/messages/nl/git.ts index 36814190f..bd639d719 100644 --- a/shared/properties/i18n/messages/nl/git.ts +++ b/shared/properties/i18n/messages/nl/git.ts @@ -245,6 +245,10 @@ export const messages = { 'git.pull.none': 'Geen wijzigingen om te pullen', 'git.pull.unavailable': 'GitHub kon niet worden gecontroleerd. Er wordt automatisch opnieuw geprobeerd. {message}', 'git.pull.upToDate': 'Al up-to-date met GitHub', + 'git.reminder.chip': 'Al {duration} niet-gecommitte wijzigingen', + 'git.reminder.off': 'Uit', + 'git.reminder.setting': 'Herinner me aan committen', + 'git.reminder.settingValue': 'Herinner me aan committen: {interval}', 'git.studio.branchExists': 'Deze branch bestaat al.', 'git.studio.branchGone': 'Deze branch bestaat niet meer.', 'git.studio.branchLimit': 'Studio ondersteunt maximaal {max} branches.', diff --git a/shared/properties/i18n/messages/pl/git.ts b/shared/properties/i18n/messages/pl/git.ts index 4c17d87b0..bf1497a73 100644 --- a/shared/properties/i18n/messages/pl/git.ts +++ b/shared/properties/i18n/messages/pl/git.ts @@ -268,6 +268,10 @@ export const messages = { 'git.pull.none': 'Brak zmian do pobrania', 'git.pull.unavailable': 'Nie udało się sprawdzić GitHub. Ponawiam automatycznie. {message}', 'git.pull.upToDate': 'Aktualne względem GitHub', + 'git.reminder.chip': 'Niezatwierdzone zmiany od {duration}', + 'git.reminder.off': 'Wyłączone', + 'git.reminder.setting': 'Przypominaj o zatwierdzaniu', + 'git.reminder.settingValue': 'Przypominaj o zatwierdzaniu: {interval}', 'git.studio.branchExists': 'Ta gałąź już istnieje.', 'git.studio.branchGone': 'Ta gałąź już nie istnieje.', 'git.studio.branchLimit': 'Studio obsługuje co najwyżej {max} gałęzi.', diff --git a/shared/properties/i18n/messages/ptBR/git.ts b/shared/properties/i18n/messages/ptBR/git.ts index 64362803a..27ab3ffc9 100644 --- a/shared/properties/i18n/messages/ptBR/git.ts +++ b/shared/properties/i18n/messages/ptBR/git.ts @@ -243,6 +243,10 @@ export const messages = { 'git.pull.none': 'Nenhuma alteração para baixar', 'git.pull.unavailable': 'Não foi possível consultar o GitHub. Tentando novamente de forma automática. {message}', 'git.pull.upToDate': 'Já está em dia com o GitHub', + 'git.reminder.chip': 'Alterações não salvas há {duration}', + 'git.reminder.off': 'Desativado', + 'git.reminder.setting': 'Lembrar de salvar', + 'git.reminder.settingValue': 'Lembrar de salvar: {interval}', 'git.studio.branchExists': 'Este branch já existe.', 'git.studio.branchGone': 'Este branch não existe mais.', 'git.studio.branchLimit': 'O Studio aceita no máximo {max} branches.', diff --git a/shared/properties/i18n/messages/ru/git.ts b/shared/properties/i18n/messages/ru/git.ts index a3b802a93..159180c02 100644 --- a/shared/properties/i18n/messages/ru/git.ts +++ b/shared/properties/i18n/messages/ru/git.ts @@ -274,6 +274,10 @@ export const messages = { 'git.pull.none': 'Нет изменений для получения', 'git.pull.unavailable': 'Не удалось проверить GitHub. Повтор выполняется автоматически. {message}', 'git.pull.upToDate': 'Уже синхронизировано с GitHub', + 'git.reminder.chip': 'Незакоммиченные изменения: {duration}', + 'git.reminder.off': 'Выкл.', + 'git.reminder.setting': 'Напоминать о коммите', + 'git.reminder.settingValue': 'Напоминать о коммите: {interval}', 'git.studio.branchExists': 'Такая ветка уже существует.', 'git.studio.branchGone': 'Этой ветки больше нет.', 'git.studio.branchLimit': 'Studio поддерживает не более {max} веток.', diff --git a/shared/properties/i18n/messages/tr/git.ts b/shared/properties/i18n/messages/tr/git.ts index b7eec1c90..a0137d89b 100644 --- a/shared/properties/i18n/messages/tr/git.ts +++ b/shared/properties/i18n/messages/tr/git.ts @@ -242,6 +242,10 @@ export const messages = { 'git.pull.none': 'Çekilecek değişiklik yok', 'git.pull.unavailable': 'GitHub denetlenemedi. Otomatik olarak yeniden deneniyor. {message}', 'git.pull.upToDate': 'GitHub ile zaten güncel', + 'git.reminder.chip': '{duration} süredir commit edilmemiş değişiklikler', + 'git.reminder.off': 'Kapalı', + 'git.reminder.setting': 'Commit etmeyi hatırlat', + 'git.reminder.settingValue': 'Commit etmeyi hatırlat: {interval}', 'git.studio.branchExists': 'Bu dal zaten var.', 'git.studio.branchGone': 'Bu dal artık yok.', 'git.studio.branchLimit': 'Studio en fazla {max} dalı destekler.', diff --git a/shared/properties/i18n/messages/zhCN/git.ts b/shared/properties/i18n/messages/zhCN/git.ts index c70385779..dd0c5089a 100644 --- a/shared/properties/i18n/messages/zhCN/git.ts +++ b/shared/properties/i18n/messages/zhCN/git.ts @@ -235,6 +235,10 @@ export const messages = { 'git.pull.none': '没有可拉取的更改', 'git.pull.unavailable': '无法检查 GitHub,正在自动重试。{message}', 'git.pull.upToDate': '已与 GitHub 保持同步', + 'git.reminder.chip': '已有 {duration} 未提交的更改', + 'git.reminder.off': '关闭', + 'git.reminder.setting': '提醒我提交', + 'git.reminder.settingValue': '提醒我提交:{interval}', 'git.studio.branchExists': '此分支已存在。', 'git.studio.branchGone': '此分支已不存在。', 'git.studio.branchLimit': 'Studio 最多支持 {max} 个分支。', diff --git a/shared/properties/i18n/messages/zhTW/git.ts b/shared/properties/i18n/messages/zhTW/git.ts index 4f796ec49..cf5ac8dd4 100644 --- a/shared/properties/i18n/messages/zhTW/git.ts +++ b/shared/properties/i18n/messages/zhTW/git.ts @@ -235,6 +235,10 @@ export const messages = { 'git.pull.none': '沒有可提取的變更', 'git.pull.unavailable': '無法檢查 GitHub。將自動重試。{message}', 'git.pull.upToDate': '已與 GitHub 同步', + 'git.reminder.chip': '已有 {duration} 未提交的變更', + 'git.reminder.off': '關閉', + 'git.reminder.setting': '提醒我提交', + 'git.reminder.settingValue': '提醒我提交:{interval}', 'git.studio.branchExists': '此分支已存在。', 'git.studio.branchGone': '此分支已不存在。', 'git.studio.branchLimit': 'Studio 最多支援 {max} 個分支。', diff --git a/src/app/LeftRail.tsx b/src/app/LeftRail.tsx index a4bf33792..381624227 100644 --- a/src/app/LeftRail.tsx +++ b/src/app/LeftRail.tsx @@ -7,6 +7,7 @@ import { shownSettingsView, subscribeShownSettingsView, type SettingsFocusTarget import { shortcutOf, railActionOf, type RailAction } from './railShortcuts'; import { FEATURE_ICONS, type FeatureIconComponent } from './featureIcons'; import { AppsRailBadge } from '../features/apps/appUpdates'; +import { CommitReminderRailBadge } from './shell/DesktopGitPull'; import { AppTile } from '../features/apps/AppTile'; import { RailAppFace, openPinnedApp, railAppId, usePinnedRailApps, useShownPinnedApp } from './railApps'; import { useAppsRuntime } from '../features/apps/appsRuntime'; @@ -140,7 +141,7 @@ export default function LeftRail({ tooltip: translate('rail.withShortcut', { label: translate(titleKey), shortcut }), pressed: activeId === id, select: () => onSelect(id), - badge: id === 'apps' ? : undefined, + badge: railBadge(id, { admin: role.isAdmin, pressed: activeId === id }), }); } // A Settings view moved onto the rail opens Settings at it, and closes the panel when that view already shows. @@ -421,6 +422,20 @@ export default function LeftRail({ ); } +/** + * What a panel button carries in its corner: the Apps tab its count and waiting updates, the Git tab a due reminder to + * commit, except while the Git panel is open, where the reminder's note already shows. Exported so a test can pin that. + */ +export function railBadge(id: RailPanelId, { admin, pressed }: { readonly admin: boolean; readonly pressed: boolean }): ReactNode { + if (id === 'apps') { + return ; + } + if (id === 'history') { + return pressed ? undefined : ; + } + return undefined; +} + function useRailKeys({ componentOpen }: { readonly componentOpen: boolean }, onAction: (action: RailAction) => void): void { // The chords are the table's (railShortcuts.ts); they are ignored while typing in a field. useEffect(() => { diff --git a/src/app/shell/AppShell.tsx b/src/app/shell/AppShell.tsx index 4c78b9091..f07acf1b2 100644 --- a/src/app/shell/AppShell.tsx +++ b/src/app/shell/AppShell.tsx @@ -37,7 +37,7 @@ import StructurePanel from '../../features/structure/StructurePanel'; import PanelBoundary from '../../ui/PanelBoundary'; import GitChip from '../../features/git/GitChip'; import { GitSessionDialogs } from '../../features/git/GitSessionDialogs'; -import { DesktopGitContext, TitleBarPull, useDesktopGit, useDesktopGitControls } from './DesktopGitPull'; +import { DesktopGitContext, TitleBarPull, useDesktopGit, useDesktopGitControls, useCommitReminderText } from './DesktopGitPull'; import HistoryPanel from '../../features/history/HistoryPanel'; import { ConfirmHost, confirmDialog } from '../../ui/ConfirmDialog'; import { UpdatePopupHost } from '../../features/update/UpdatePopup'; @@ -311,6 +311,7 @@ export function AppOverlays({ app }: { readonly app: ShellView }) { export function TitleBar({ app }: { readonly app: ShellView }) { const translate = useTranslate(); const canPublish = can(useCurrentRole(), 'publish'); + const commitReminder = useCommitReminderText(); const componentCanvas = useComponentCanvas(); // On the canvas page the way back leaves the canvas; inside an instance, back steps out one level as anywhere, and // Close canvas beside it leaves from any depth. @@ -386,6 +387,7 @@ export function TitleBar({ app }: { readonly app: ShellView }) { withBranchChange={app.withBranchChange} onBranchSwitched={app.reloadFromDisk} beforeBranch={} + commitReminder={commitReminder} /> )} {/* A role that may pull but not publish has no branch chip; the button stands in its place. */} diff --git a/src/app/shell/DesktopGitPull.tsx b/src/app/shell/DesktopGitPull.tsx index 27a228e7d..da2139d8e 100644 --- a/src/app/shell/DesktopGitPull.tsx +++ b/src/app/shell/DesktopGitPull.tsx @@ -9,7 +9,8 @@ import { useGitSession, type GitSession } from '../../features/git/useGitSession import type { ComponentCanvasControl } from '../../features/preview/componentCanvas/componentCanvasSession'; import { currentDesktopPlatform } from '../../lib/shortcutLabel'; import { translateFailure } from '../../lib/i18n/translateErrorText'; -import { useTranslate } from '../../lib/i18n/useTranslate'; +import { useFormat, useTranslate } from '../../lib/i18n/useTranslate'; +import { commitReminderDuration } from '../../features/git/useGitSession'; import { useCurrentRole } from '../../lib/useCurrentRole'; import { canRailTab } from '../../lib/roleAccess'; import { windowHeld } from '../../ui/busyLock'; @@ -175,6 +176,33 @@ export function useDesktopGitControls(): { readonly session: GitSession; readonl return { session: git.session, shortcut: git.access === 'allowed' ? git.shortcut : undefined }; } +/** The rail's Git tab once the reminder to commit is due: the rail's dot, with the branch chip's sentence for a screen reader. */ +export function CommitReminderRailBadge() { + const text = useCommitReminderText(); + if (text === undefined) { + return undefined; + } + return ; +} + +/** + * What the branch chip and the Git tab say once the reminder to commit is due (features/git/useGitSession.ts), or + * undefined: while it is quiet, and for a role without the Git panel, which has nowhere to commit from. + */ +export function useCommitReminderText(): string | undefined { + const git = useContext(DesktopGitContext); + const translate = useTranslate(); + const format = useFormat(); + if (git === undefined || git.access === 'denied') { + return undefined; + } + const { reminder } = git.session; + if (reminder.state.kind === 'quiet') { + return undefined; + } + return translate('git.reminder.chip', { duration: commitReminderDuration(reminder.nowMs - reminder.state.sinceMs, format) }); +} + /** The title bar's button: absent without something to pull, or where pulling is refused. */ export function TitleBarPull() { const git = useContext(DesktopGitContext); diff --git a/src/app/shell/DesktopPublishButton.tsx b/src/app/shell/DesktopPublishButton.tsx index d8d43086b..68e749c24 100644 --- a/src/app/shell/DesktopPublishButton.tsx +++ b/src/app/shell/DesktopPublishButton.tsx @@ -42,6 +42,8 @@ interface Props { readonly onBranchSwitched?: (() => Promise) | undefined; /** Drawn just before the branch chip (the pull button), so Publish and the chip hold still as it comes and goes. */ readonly beforeBranch?: ReactNode; + /** The reminder to commit, once due: the branch chip carries a dot and says it (features/git/useGitSession.ts). */ + readonly commitReminder?: string | undefined; } export function DesktopPublishButton(props: Props) { @@ -82,7 +84,7 @@ function DesktopPublishSession(props: Props) { return (
{props.beforeBranch} - + .git-commit-destination { + min-width: 0; +} +/* The clock is the app's dropdown with only its icon showing: the label stays in the DOM, the chevron goes, and the + menu keeps its usual rows without the repeated clock. */ +.git-commit-reminder-interval.dd-trigger { + flex: none; + width: auto; + height: 22px; + padding: 0 4px; + background: transparent; + color: var(--text-dim); +} +.git-commit-reminder-interval.dd-trigger:hover, +.git-commit-reminder-interval.dd-trigger:focus-visible { + background: var(--bg-active); + color: var(--text); +} +.git-commit-reminder-interval.is-off { + color: var(--text-faint); + opacity: 0.6; +} +.git-commit-reminder-interval .dd-label, +.git-commit-reminder-interval .dd-chevron, +.git-commit-reminder-menu .dd-icon { + display: none; +} +/* The line once due: an accent dot and the sentence the branch chip shows. The sentence has a column of its own that + never outgrows the panel: it wraps under itself, never under the dot, and a word too long for the column breaks + rather than sticking out. At the panel's narrowest, every language fits in two lines (commitReminderChromium.test.js). */ +.git-commit-reminder { + display: grid; + grid-template-columns: 6px minmax(0, 1fr); + align-items: start; + column-gap: 6px; + width: 100%; + margin: 0; + font-size: 11px; + line-height: 1.45; + color: var(--text-dim); + overflow-wrap: anywhere; +} +/* The dot sits on the middle of the first line. */ +.git-commit-reminder::before { + content: ''; + width: 6px; + height: 6px; + margin-top: calc((1.45em - 6px) / 2); + border-radius: 50%; + background: var(--accent); +} + /* Keep the main action prominent while file selection stays within the same row. */ .git-commit-action-row { display: flex; diff --git a/src/features/apps/appUpdates.tsx b/src/features/apps/appUpdates.tsx index 24f72ebe7..9677a406a 100644 --- a/src/features/apps/appUpdates.tsx +++ b/src/features/apps/appUpdates.tsx @@ -102,7 +102,7 @@ function UpdateDot() { if (count === 0) { return undefined; } - return ; + return ; } /** How a row names a waiting update. */ diff --git a/src/features/apps/apps.css b/src/features/apps/apps.css index 60ea3aed2..ac7d15ef4 100644 --- a/src/features/apps/apps.css +++ b/src/features/apps/apps.css @@ -845,7 +845,7 @@ pointer-events: none; } /* With a count in the corner, a waiting update's dot moves below it. */ -.apps-rail-count + .apps-rail-badge { +.apps-rail-count + .rail-badge { top: auto; bottom: 5px; } diff --git a/src/features/apps/marketplace/marketplace.css b/src/features/apps/marketplace/marketplace.css index 26a5c081f..031c91d08 100644 --- a/src/features/apps/marketplace/marketplace.css +++ b/src/features/apps/marketplace/marketplace.css @@ -142,19 +142,6 @@ align-items: center; gap: 4px; } -.rail-btn { - position: relative; -} -.apps-rail-badge { - position: absolute; - top: 5px; - inset-inline-end: 5px; - width: 7px; - height: 7px; - border-radius: 50%; - background: var(--accent); - pointer-events: none; -} .apps-row-description.apps-row-update { color: var(--accent); } diff --git a/src/features/git/BranchIndicator.tsx b/src/features/git/BranchIndicator.tsx index 4482764a4..a6754c5de 100644 --- a/src/features/git/BranchIndicator.tsx +++ b/src/features/git/BranchIndicator.tsx @@ -16,6 +16,8 @@ interface Props { readonly info: IpcResults['git:info'] | undefined; /** Opens the panel that already holds the branch switcher. */ readonly onOpen: (() => void) | undefined; + /** Once the reminder to commit is due, what it says (useGitSession.ts): the chip carries a dot and adds the sentence. */ + readonly reminder?: string | undefined; } /** Projects whose last branch is remembered for the first frame of the next open; the oldest is forgotten first. */ @@ -47,7 +49,7 @@ export function forgetRememberedBranches(): void { remembered.clear(); } -export function BranchIndicator({ projectPath, info, onOpen }: Props) { +export function BranchIndicator({ projectPath, info, onOpen, reminder }: Props) { const translate = useTranslate(); const read = branchStatusOf(info); rememberBranchStatus(projectPath, read); @@ -59,12 +61,28 @@ export function BranchIndicator({ projectPath, info, onOpen }: Props) { case 'hidden': return undefined; case 'default': - return ; + return ( + + ); case 'other': - return ; + return ( + + ); case 'detached': return ( - + ); default: { const exhaustive: never = status; @@ -73,19 +91,27 @@ export function BranchIndicator({ projectPath, info, onOpen }: Props) { } } -function Chip(props: { readonly state: 'quiet' | 'warning'; readonly label: string; readonly title: string; readonly onOpen: (() => void) | undefined }) { +function Chip(props: { + readonly state: 'quiet' | 'warning'; + readonly label: string; + readonly title: string; + readonly reminder: string | undefined; + readonly onOpen: (() => void) | undefined; +}) { + const title = props.reminder === undefined ? props.title : `${props.title}\n${props.reminder}`; return (