A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
feat(launcher): remove a project from recents
yhhd5694b10d072
diff --git a/desktop/electron/launcher.ts b/desktop/electron/launcher.tsindex ed516205f..0c628a450 100644--- a/desktop/electron/launcher.ts+++ b/desktop/electron/launcher.ts@@ -78,6 +78,13 @@ export async function addRecent(root: string, name: string): Promise<void> {await writeFile(recentsFile(), JSON.stringify(stored.slice(0, MAX_RECENTS), null, 2));}+/** Drop a project from the recents list. The project on disk is untouched — this+ * only forgets it in the launcher (the user's explicit "remove from recents"). */+export async function removeRecent(root: string): Promise<void> {+ const stored = (await readStored()).filter((r) => r.root !== root);+ await writeFile(recentsFile(), JSON.stringify(stored, null, 2));+}+// New-project templates. In dev these are the in-repo examples (each is a real// project dir); a packaged build would point this at a bundled templates dir.const templatesDir = (): string => path.join(process.env.APP_ROOT ?? '', '..', 'examples');diff --git a/desktop/electron/main.ts b/desktop/electron/main.tsindex 911404f87..89bf09bbe 100644--- a/desktop/electron/main.ts+++ b/desktop/electron/main.ts@@ -20,7 +20,7 @@ import {resolveInRoot,META_EXT,} from './projectFs';-import { listRecents, addRecent, listTemplates, createFromTemplate } from './launcher';+import { listRecents, addRecent, removeRecent, listTemplates, createFromTemplate } from './launcher';import { buildProjectScripts } from './buildScripts';import { extractProjectSchemas } from './extractSchemas';import { scanAssetDatabase } from './assetDb';@@ -596,6 +596,7 @@ ipcMain.handle('project:preparePlayRealm', async () => {ipcMain.handle('recents:list', () => listRecents());ipcMain.handle('recents:add', (_e, root: string, name: string) => addRecent(root, name));+ipcMain.handle('recents:remove', (_e, root: string) => removeRecent(root));// New-project templates + creation (launcher New tab).ipcMain.handle('templates:list', () => listTemplates());diff --git a/desktop/electron/preload.ts b/desktop/electron/preload.tsindex a0a650084..dbeaf520e 100644--- a/desktop/electron/preload.ts+++ b/desktop/electron/preload.ts@@ -158,6 +158,7 @@ const api = {recents: {list: (): Promise<RecentEntry[]> => ipcRenderer.invoke('recents:list'),add: (root: string, name: string): Promise<void> => ipcRenderer.invoke('recents:add', root, name),+ remove: (root: string): Promise<void> => ipcRenderer.invoke('recents:remove', root),},};diff --git a/desktop/src/launcher/Launcher.tsx b/desktop/src/launcher/Launcher.tsxindex e7dd383cb..c5ee145c6 100644--- a/desktop/src/launcher/Launcher.tsx+++ b/desktop/src/launcher/Launcher.tsx@@ -1,7 +1,7 @@// SPDX-License-Identifier: Apache-2.0// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Teamimport { useEffect, useMemo, useState } from 'react';-import { ArrowRight, Clock, FolderOpen, LayoutGrid, Plus, Rows3, Search } from 'lucide-react';+import { ArrowRight, Clock, FolderOpen, LayoutGrid, Plus, Rows3, Search, X } from 'lucide-react';import { useEditorStore } from '@/store/editorStore';import { ProjectStore } from '@/project/ProjectStore';import { WindowControls } from '@/layout/WindowControls';@@ -82,6 +82,12 @@ function RecentView({[recents, query],);+ // Forget a project in the launcher only — the project on disk is untouched.+ const onRemove = (root: string) => {+ void window.estella?.recents?.remove?.(root).catch(() => {});+ setRecents((rs) => rs.filter((r) => r.root !== root));+ };+return (<><header className="lc-head">@@ -131,7 +137,14 @@ function RecentView({) : layout === 'grid' ? (<div className="proj-grid">{items.map((p) => (- <button key={p.root} type="button" className="proj-card" onClick={() => onOpen(p.root)}>+ <div+ key={p.root}+ className="proj-card"+ role="button"+ tabIndex={0}+ onClick={() => onOpen(p.root)}+ onKeyDown={(e) => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); onOpen(p.root); } }}+ ><Thumb label={p.name} src={p.thumbnail} /><div className="proj-card__body"><span className="proj-card__name">{p.name}</span>@@ -139,7 +152,16 @@ function RecentView({<span className="proj-card__path mono">{p.root}</span></div>{p.build && <span className="proj-card__build mono">{p.build}</span>}- </button>+ <button+ type="button"+ className="proj-card__remove"+ title="从最近列表移除"+ aria-label="从最近列表移除"+ onClick={(e) => { e.stopPropagation(); onRemove(p.root); }}+ >+ <X size={13} strokeWidth={2} />+ </button>+ </div>))}</div>) : (@@ -150,14 +172,30 @@ function RecentView({<span>Build</span></div>{items.map((p) => (- <button key={p.root} type="button" className="proj-row" onClick={() => onOpen(p.root)}>+ <div+ key={p.root}+ className="proj-row"+ role="button"+ tabIndex={0}+ onClick={() => onOpen(p.root)}+ onKeyDown={(e) => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); onOpen(p.root); } }}+ ><span className="proj-row__main"><span className="proj-row__name">{p.name}</span><span className="proj-row__path mono">{p.root}</span></span><span className="proj-row__col mono">{relTime(p.openedAt)}</span><span className="proj-row__col">{p.build && <span className="lc-badge mono">{p.build}</span>}</span>- </button>+ <button+ type="button"+ className="proj-row__remove"+ title="从最近列表移除"+ aria-label="从最近列表移除"+ onClick={(e) => { e.stopPropagation(); onRemove(p.root); }}+ >+ <X size={13} strokeWidth={2} />+ </button>+ </div>))}</div>)}diff --git a/desktop/src/theme/launcher.css b/desktop/src/theme/launcher.cssindex 2cdf455f1..2445d0dc6 100644--- a/desktop/src/theme/launcher.css+++ b/desktop/src/theme/launcher.css@@ -354,6 +354,30 @@color: var(--star-hi);border-color: var(--star-line);}+/* Remove-from-recents — top-LEFT so it never collides with the build badge; shown+ on hover/focus only, so the resting card stays clean. */+.proj-card__remove {+ position: absolute;+ top: 8px;+ left: 8px;+ display: inline-flex;+ align-items: center;+ justify-content: center;+ width: 22px;+ height: 22px;+ padding: 0;+ border-radius: 50%;+ background: rgba(var(--glass-rgb), 0.72);+ border: 1px solid var(--line);+ color: var(--text-dim);+ cursor: pointer;+ opacity: 0;+ transition: opacity 0.12s, color 0.12s, border-color 0.12s;+ backdrop-filter: blur(2px);+}+.proj-card:hover .proj-card__remove,+.proj-card:focus-within .proj-card__remove { opacity: 1; }+.proj-card__remove:hover { color: var(--danger, #e5484d); border-color: var(--danger, #e5484d); }/* ----------------------------------------------------------- list view --- */.proj-list {@@ -383,6 +407,7 @@.proj-row {/* A <button> won't stretch to its container even as a grid (Chromium quirk) —force full width so its columns line up with the (full-width) header. */+ position: relative;width: 100%;padding: 10px 12px;border-bottom: 1px solid var(--line-soft);@@ -395,6 +420,30 @@background: var(--hover);outline: none;}+/* Remove-from-recents — absolutely placed so it doesn't add a 4th grid column+ (the header has three); shown on hover/focus only. */+.proj-row__remove {+ position: absolute;+ top: 50%;+ right: 8px;+ transform: translateY(-50%);+ display: inline-flex;+ align-items: center;+ justify-content: center;+ width: 24px;+ height: 24px;+ padding: 0;+ border-radius: var(--r-xs);+ background: var(--panel);+ border: 1px solid var(--line);+ color: var(--text-dim);+ cursor: pointer;+ opacity: 0;+ transition: opacity 0.12s, color 0.12s, border-color 0.12s;+}+.proj-row:hover .proj-row__remove,+.proj-row:focus-within .proj-row__remove { opacity: 1; }+.proj-row__remove:hover { color: var(--danger, #e5484d); border-color: var(--danger, #e5484d); }/* Name over path, both left-aligned to the column edge — so every row's textstarts at the same x and lines up under the "Project" header. */.proj-row__main {