From 3bc96ba975a19743637bbedd9a05a876de1a759c Mon Sep 17 00:00:00 2001 From: CatsJuice Date: Wed, 21 May 2025 01:39:16 +0000 Subject: [PATCH] feat(mobile): move selfhost sign-in from menu to list (#12379) --- .../components/workspace-selector/menu.css.ts | 11 +++++ .../components/workspace-selector/menu.tsx | 42 +++++++++++-------- 2 files changed, 35 insertions(+), 18 deletions(-) diff --git a/packages/frontend/core/src/mobile/components/workspace-selector/menu.css.ts b/packages/frontend/core/src/mobile/components/workspace-selector/menu.css.ts index f5573db7cb..1ec308b10a 100644 --- a/packages/frontend/core/src/mobile/components/workspace-selector/menu.css.ts +++ b/packages/frontend/core/src/mobile/components/workspace-selector/menu.css.ts @@ -85,6 +85,17 @@ export const wsName = style([ textAlign: 'left', }, ]); +export const signInIcon = style({ + width: 32, + height: 32, + borderRadius: 6, + border: `1px solid ${cssVarV2.tab.divider.divider}`, + color: cssVarV2.icon.primary, + display: 'flex', + alignItems: 'center', + justifyContent: 'center', + fontSize: 20, +}); export const serverInfo = style({ padding: '6px 20px', diff --git a/packages/frontend/core/src/mobile/components/workspace-selector/menu.tsx b/packages/frontend/core/src/mobile/components/workspace-selector/menu.tsx index 0229a5094e..62f07542c2 100644 --- a/packages/frontend/core/src/mobile/components/workspace-selector/menu.tsx +++ b/packages/frontend/core/src/mobile/components/workspace-selector/menu.tsx @@ -78,6 +78,20 @@ export const WorkspaceList = (props: WorkspaceListProps) => { )); }; +const CloudSignIn = ({ onClick }: { onClick: () => void }) => { + const t = useI18n(); + return ( +
  • + +
  • + ); +}; + const WorkspaceServerInfo = ({ server, name, @@ -85,7 +99,6 @@ const WorkspaceServerInfo = ({ accountStatus, onDeleteServer, onSignOut, - onSignIn, }: { server: string; name: string; @@ -93,7 +106,6 @@ const WorkspaceServerInfo = ({ accountStatus?: 'authenticated' | 'unauthenticated'; onDeleteServer?: () => void; onSignOut?: () => void; - onSignIn?: () => void; }) => { const t = useI18n(); const isCloud = server !== 'local'; @@ -121,17 +133,8 @@ const WorkspaceServerInfo = ({ {t['Sign out']()} ), - accountStatus === 'unauthenticated' && ( - } - key="sign-in" - onClick={onSignIn} - > - {t['Sign in']()} - - ), ].filter(Boolean), - [accountStatus, onDeleteServer, onSignIn, onSignOut, server, t] + [accountStatus, onDeleteServer, onSignOut, server, t] ); return ( @@ -243,13 +246,16 @@ const CloudWorkSpaceList = ({ accountStatus={accountStatus} onDeleteServer={handleDeleteServer} onSignOut={handleSignOut} - onSignIn={handleSignIn} - /> - + {accountStatus === 'unauthenticated' ? ( + + ) : ( + + )} ); };