MCPcopy Create free account
hub / github.com/esengine/esengine / AboutDialog

Function AboutDialog

packages/editor-app/src/components/AboutDialog.tsx:14–222  ·  view source on GitHub ↗
({ onClose }: AboutDialogProps)

Source from the content-addressed store, hash-verified

12}
13
14export function AboutDialog({ onClose }: AboutDialogProps) {
15 const { t } = useLocale();
16 const [checking, setChecking] = useState(false);
17 const [installing, setInstalling] = useState(false);
18 const [updateStatus, setUpdateStatus] = useState<'idle' | 'checking' | 'available' | 'latest' | 'error' | 'installing'>('idle');
19 const [version, setVersion] = useState<string>('1.0.0');
20 const [newVersion, setNewVersion] = useState<string>('');
21
22 useEffect(() => {
23 // Fetch version on mount
24 const fetchVersion = async () => {
25 try {
26 const currentVersion = await getVersion();
27 setVersion(currentVersion);
28 } catch (error) {
29 console.error('Failed to get version:', error);
30 }
31 };
32 fetchVersion();
33 }, []);
34
35 const handleCheckUpdate = async () => {
36 setChecking(true);
37 setUpdateStatus('checking');
38
39 try {
40 const currentVersion = await getVersion();
41 setVersion(currentVersion);
42
43 // 使用我们的 updater 工具检查更新(仅检查,不自动安装)
44 const result = await checkForUpdates();
45
46 if (result.error) {
47 setUpdateStatus('error');
48 } else if (result.available) {
49 setUpdateStatus('available');
50 if (result.version) {
51 setNewVersion(result.version);
52 }
53 } else {
54 setUpdateStatus('latest');
55 }
56 } catch (error) {
57 console.error('Check update failed:', error);
58 setUpdateStatus('error');
59 } finally {
60 setChecking(false);
61 }
62 };
63
64 const handleInstallUpdate = async () => {
65 setInstalling(true);
66 setUpdateStatus('installing');
67
68 try {
69 const success = await installUpdate();
70 if (!success) {
71 setUpdateStatus('error');

Callers

nothing calls this directly

Calls 5

useLocaleFunction · 0.90
fetchVersionFunction · 0.85
getStatusIconFunction · 0.85
getStatusTextFunction · 0.85
handleOpenGithubFunction · 0.85

Tested by

no test coverage detected