From c9cd25d18f00964bf7bb551c6df57829980cb745 Mon Sep 17 00:00:00 2001 From: lilyzhaun <90462695+lilyzhaun@users.noreply.github.com> Date: Fri, 12 Jun 2026 02:51:01 +0800 Subject: [PATCH] fix(ui): keep a close control in empty mobile changes states (#1525) The newer mobile Changes surface returns early for non-interactive list states (no directory selected, repository status still loading, or current directory is not a Git repository). Those branches rendered only MobileChangesState and skipped the standard header row entirely. On Android PWA this leaves the sheet with no visible close/back affordance. Because the surface is hosted inside MobileSurfaceShell as a modal sheet, the browser/system back gesture does not reliably dismiss it, so users were forced to tap sparse overlay whitespace to escape. Fix the regression by wrapping those early-return states in the same top header used by the normal Changes list, including the close button and current path label. This keeps dismissal available even when the new mobile UI is showing an empty/error state. While touching the file, switch the remaining direct @remixicon/react usages in this component to the shared Icon system to match current UI conventions. Validated with packages/ui type-check and a packages/web build. Co-authored-by: lilyzhaun --- packages/ui/src/apps/MobileChangesSurface.tsx | 41 +++++++++++++++---- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/packages/ui/src/apps/MobileChangesSurface.tsx b/packages/ui/src/apps/MobileChangesSurface.tsx index 01fa8cba..6818fec3 100644 --- a/packages/ui/src/apps/MobileChangesSurface.tsx +++ b/packages/ui/src/apps/MobileChangesSurface.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { RiArrowLeftLine, RiCloseLine, RiGitBranchLine, RiLoader4Line } from '@remixicon/react'; +import { Icon } from '@/components/icon/Icon'; import { toast } from '@/components/ui'; import { Button } from '@/components/ui/button'; @@ -443,16 +443,41 @@ export const MobileChangesSurface: React.FC = ({ onCl return groups; }, [handleRevertFile, handleViewChangeDiff, moveChangePaths, stagedChangeEntries, t, unstagedChangeEntries]); + const renderListState = (state: React.ReactNode) => ( +
+
+ {onClose ? ( + + ) : null} +
+

{t('mobile.nav.changes')}

+

+ {status?.current || currentDirectory || ''} +

+
+
+
{state}
+
+ ); + if (!currentDirectory) { - return ; + return renderListState(); } if (isLoadingStatus && isGitRepo === null) { - return ; + return renderListState(); } if (isGitRepo === false) { - return ; + return renderListState(); } if (route.type === 'diff') { @@ -479,7 +504,7 @@ export const MobileChangesSurface: React.FC = ({ onCl onClick={onClose} style={{ touchAction: 'manipulation' }} > - + ) : null}
@@ -548,8 +573,8 @@ const MobileChangesState: React.FC<{ }> = ({ message, description, loading = false, icon = false }) => (
- {loading ? : null} - {icon ? : null} + {loading ? : null} + {icon ? : null}

{message}

{description ?

{description}

: null}
@@ -576,7 +601,7 @@ const MobileDiffDetail: React.FC<{ aria-label={t('header.actions.backAria')} onClick={onBack} > - +

{path}