From a8ce8048f8ee8522e88d4caefb4b53244bee3d37 Mon Sep 17 00:00:00 2001 From: l0ng-ai <24760907+l0ng-ai@users.noreply.github.com> Date: Tue, 27 Oct 2026 22:16:22 +0800 Subject: [PATCH] feat(remote): Show the connection progress while reopening a remote project at startup --- src/features/welcome/Welcome.module.css | 22 +++++++++++++- src/features/welcome/WelcomeView.tsx | 38 ++++++++++++++++++------- src/platform/locales/text/zh.json | 4 +-- 3 files changed, 50 insertions(+), 14 deletions(-) diff --git a/src/features/welcome/Welcome.module.css b/src/features/welcome/Welcome.module.css index ec8cb2d7..0daaacdc 100644 --- a/src/features/welcome/Welcome.module.css +++ b/src/features/welcome/Welcome.module.css @@ -386,13 +386,33 @@ .reopening { flex: 1; display: flex; + flex-direction: column; align-items: center; justify-content: center; - gap: 10px; + gap: 14px; color: var(--fg-muted); padding-bottom: 38px; } +.reopeningTitle { + display: flex; + align-items: center; + gap: 10px; +} + +.reopeningStage { + width: 320px; + display: flex; + flex-direction: column; + align-items: center; + gap: 8px; + font-size: 0.92em; +} + +.reopeningStage > [role="progressbar"] { + align-self: stretch; +} + /* ---- Recent projects popup -------------------------------------------- */ .popup { diff --git a/src/features/welcome/WelcomeView.tsx b/src/features/welcome/WelcomeView.tsx index bc9301cb..4ac6ecfb 100644 --- a/src/features/welcome/WelcomeView.tsx +++ b/src/features/welcome/WelcomeView.tsx @@ -2,10 +2,12 @@ import { useEffect, useRef, useState } from "react"; import clsx from "clsx"; import { executeAction } from "@/platform/actions"; -import { useT } from "@/platform/i18n"; +import { useT, useTx } from "@/platform/i18n"; import { isTauri } from "@/platform/ipc"; import { useProject } from "@/platform/project"; -import { Icon, IconButton, Menu, Spinner, type MenuItem, T } from "@/ui"; +import { useRemoteProgress } from "@/platform/remote"; +import { stageLabel } from "@/features/remote-dev/model"; +import { Icon, IconButton, Menu, ProgressBar, Spinner, type MenuItem, T } from "@/ui"; import { useSettingsPages } from "@/workbench/contributions"; import { ErrorBoundary, Slot } from "@/workbench/ErrorBoundary"; import logo from "../../../src-tauri/icons/128x128.png"; @@ -111,6 +113,28 @@ function useFolderDrop(): boolean { return over; } +/** The last session's project opening at startup; a remote one shows how far connecting is. */ +function Reopening({ location }: { location: string }) { + const tx = useTx(); + const progress = useRemoteProgress((s) => s.progress); + const name = location.slice(location.lastIndexOf("/") + 1); + const percent = progress?.fraction == null ? "" : ` ${Math.round(progress.fraction * 100)}%`; + return ( +