Файли
openidea/src/features/welcome/RecentProjectsPopup.tsx
T
l0ng-ai 76d33f0306 feat(ui): IDEA-style message dialogs, project widget popup and Chinese UI text
Message dialogs: `Dialog` gets an `icon` (question / info / warning / error)
that renders IDEA's alert layout: no title bar, a 32px icon, bold title,
text, checkbox under it. Every confirmation helper (prompt, VCS, services,
project tree, keymap, LSP choices, run, database, Replace All) uses it. Open
Project matches IDEA: "This Window" is the default and has focus. The Code
Analysis and TODO commit checks default to Review.

Project widget: the title bar project button opens a popup like IDEA's
ProjectWidget, with Open… / Clone Repository…, the projects open in other
windows (new `window_open_projects` command) and recent projects, filtered by
typing.

Chinese UI: UI text stays written in English and is translated through a
source-text catalog (`locales/text/zh.json`, about 2300 strings). The UI
primitives (buttons, checkboxes, selects, tabs, dialogs, menus, tooltips,
toasts, settings labels and hints) translate the strings they are given.
Action titles and categories are localised in the registry, and static JSX
text uses `<T>`, so text follows a locale switch without a reload. The
Settings window now syncs the locale too. Settings search matches both
languages.

Claude-Session: https://claude.ai/code/session_01B65qLEKnkeYTGdbwhLpjCu
2026-10-23 22:18:50 +08:00

41 рядки
1.2 KiB
TypeScript
Неформатований Анотація Історія

Цей файл містить неоднозначні символи Юнікоду
Цей файл містить символи Юнікоду, які можна сплутати з іншими символами. Якщо ви вважаєте, що це зроблено навмисно, можете сміливо ігнорувати це попередження. Щоб показати їх, скористайтеся кнопкою Escape.
import { useEffect } from "react";
import { create } from "zustand";
import { useProject } from "@/platform/project";
import { Dialog, T } from "@/ui";
import { RecentList } from "./RecentList";
import { loadRecent } from "./recent";
import styles from "./Welcome.module.css";
export const useRecentPopup = create<{ open: boolean }>(() => ({ open: false }));
export function showRecentProjectsPopup() {
useRecentPopup.setState({ open: true });
}
const close = () => useRecentPopup.setState({ open: false });
/** File › Open Recent: chooser over recent projects (overlay contribution). */
export function RecentProjectsPopup() {
const open = useRecentPopup((s) => s.open);
const current = useProject((s) => s.project?.root ?? null);
useEffect(() => {
if (open) void loadRecent();
}, [open]);
return (
<Dialog
open={open}
onClose={close}
position="top"
width={560}
transparentBackdrop
aria-label="Recent Projects"
className={styles.popup}
>
<div className={styles.popupHeader}>
<T>Recent Projects</T>
</div>
<RecentList compact autoFocus exclude={current} onOpened={close} className={styles.popupList} />
</Dialog>
);
}