pc 앱 배포,다운로드 기능
This commit is contained in:
@@ -26,9 +26,11 @@ export async function openWidgetWindow(instance: FloatingWidgetInstance): Promis
|
||||
return;
|
||||
}
|
||||
|
||||
const title = `GoldenChart — 위젯 ${instance.rows}×${instance.cols}`;
|
||||
|
||||
const win = new WebviewWindow(label, {
|
||||
url: widgetUrl(instance),
|
||||
title: 'GoldenChart Widget',
|
||||
title,
|
||||
width: instance.width,
|
||||
height: instance.height,
|
||||
minWidth: 320,
|
||||
@@ -38,6 +40,7 @@ export async function openWidgetWindow(instance: FloatingWidgetInstance): Promis
|
||||
center: false,
|
||||
x: instance.position.x,
|
||||
y: instance.position.y,
|
||||
backgroundColor: '#1a1b26',
|
||||
});
|
||||
|
||||
widgetWindows.set(instance.id, win);
|
||||
|
||||
@@ -2,6 +2,7 @@ import './forceServerApi';
|
||||
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import ReactDOM from 'react-dom/client';
|
||||
import { getCurrentWindow } from '@tauri-apps/api/window';
|
||||
import { LogicalSize } from '@tauri-apps/api/dpi';
|
||||
import { initStorage, refreshApiBaseFromStorage } from '@goldenchart/shared';
|
||||
import { ensureDesktopApiBase } from './ensureDesktopApiBase';
|
||||
import FloatingWidgetWindow from '@frontend/components/floatingWidgets/FloatingWidgetWindow';
|
||||
@@ -23,10 +24,15 @@ import {
|
||||
import { PAPER_TRADES_CHANGED_EVENT } from '@frontend/utils/paperTradeEvents';
|
||||
import { WidgetDashboardProvider } from '@frontend/widgets/WidgetDashboardContext';
|
||||
import { readDesktopSync, subscribeDesktopSync } from '@frontend/utils/desktopSync';
|
||||
import { syncDocumentTheme } from '@frontend/utils/documentTheme';
|
||||
import '@frontend/App.css';
|
||||
import '@frontend/styles/appPopup.css';
|
||||
import '@frontend/styles/paperDashboard.css';
|
||||
import '@frontend/styles/widgetDashboard.css';
|
||||
import '@frontend/styles/floatingWidget.css';
|
||||
|
||||
document.documentElement.classList.add('fw-native-widget');
|
||||
|
||||
function parseInstanceFromUrl(): FloatingWidgetInstance | null {
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
const id = params.get('id');
|
||||
@@ -101,9 +107,29 @@ const WidgetApp: React.FC = () => {
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
document.documentElement.setAttribute('data-theme', theme);
|
||||
syncDocumentTheme(theme);
|
||||
}, [theme]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!instance) return;
|
||||
const title = `GoldenChart — 위젯 ${instance.rows}×${instance.cols}`;
|
||||
void getCurrentWindow().setTitle(title);
|
||||
}, [instance?.rows, instance?.cols, instance]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!instance) return;
|
||||
let unlisten: (() => void) | undefined;
|
||||
void (async () => {
|
||||
unlisten = await getCurrentWindow().onResized(async () => {
|
||||
const size = await getCurrentWindow().innerSize();
|
||||
setInstance(prev => (
|
||||
prev ? { ...prev, width: size.width, height: size.height } : prev
|
||||
));
|
||||
});
|
||||
})();
|
||||
return () => { unlisten?.(); };
|
||||
}, [instance?.id]);
|
||||
|
||||
const handleClose = useCallback(() => {
|
||||
void getCurrentWindow().close();
|
||||
}, []);
|
||||
@@ -132,10 +158,14 @@ const WidgetApp: React.FC = () => {
|
||||
<FloatingWidgetWindow
|
||||
instance={instance}
|
||||
focused
|
||||
nativeShell
|
||||
onClose={handleClose}
|
||||
onFocus={() => {}}
|
||||
onUpdateSlots={slots => setInstance(prev => (prev ? { ...prev, slots } : prev))}
|
||||
onUpdateSize={(width, height) => setInstance(prev => (prev ? { ...prev, width, height } : prev))}
|
||||
onUpdateSize={(width, height) => {
|
||||
setInstance(prev => (prev ? { ...prev, width, height } : prev));
|
||||
void getCurrentWindow().setSize(new LogicalSize(width, height));
|
||||
}}
|
||||
onUpdateGridFr={(rowFr, colFr) => setInstance(prev => (prev ? { ...prev, rowFr, colFr } : prev))}
|
||||
/>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user