수정
This commit is contained in:
@@ -10,7 +10,7 @@ import type { AuthSession } from '../utils/auth';
|
||||
import type { TradeAlertPopupLayout, TradeAlertPopupPosition } from '../utils/tradeAlertPopupLayout';
|
||||
import { canAccessMenu } from '../utils/permissions';
|
||||
import { isDesktop } from '../utils/platform';
|
||||
import { checkDesktopUpdates } from '../utils/desktopBridge';
|
||||
import DesktopUpdateModal from './DesktopUpdateModal';
|
||||
|
||||
export type MenuPage = 'dashboard' | 'chart' | 'paper' | 'virtual' | 'trend-search' | 'verification-board' | 'strategy' | 'strategy-editor' | 'strategy-evaluation' | 'backtest' | 'analysis-report' | 'notifications' | 'settings' | 'widget-dashboard';
|
||||
|
||||
@@ -266,24 +266,9 @@ export const TopMenuBar = memo(function TopMenuBar({
|
||||
menuPermissions,
|
||||
}: TopMenuBarProps) {
|
||||
const [isFullscreen, setIsFullscreen] = useState(() => !!document.fullscreenElement);
|
||||
const [desktopUpdateBusy, setDesktopUpdateBusy] = useState(false);
|
||||
const [desktopUpdateHint, setDesktopUpdateHint] = useState('');
|
||||
const [desktopUpdateOpen, setDesktopUpdateOpen] = useState(false);
|
||||
const desktopClient = isDesktop();
|
||||
|
||||
const handleDesktopUpdate = useCallback(async () => {
|
||||
if (desktopUpdateBusy) return;
|
||||
setDesktopUpdateBusy(true);
|
||||
setDesktopUpdateHint('업데이트 확인 중…');
|
||||
try {
|
||||
const res = await checkDesktopUpdates();
|
||||
setDesktopUpdateHint(res.message ?? (res.available ? `v${res.version ?? ''} 설치` : '최신 버전'));
|
||||
} catch {
|
||||
setDesktopUpdateHint('업데이트 확인 실패');
|
||||
} finally {
|
||||
setDesktopUpdateBusy(false);
|
||||
}
|
||||
}, [desktopUpdateBusy]);
|
||||
|
||||
useEffect(() => {
|
||||
const sync = () => setIsFullscreen(!!document.fullscreenElement);
|
||||
document.addEventListener('fullscreenchange', sync);
|
||||
@@ -295,6 +280,7 @@ export const TopMenuBar = memo(function TopMenuBar({
|
||||
? MENU_ITEMS.filter(({ page }) => canAccessMenu(menuPermissions, page))
|
||||
: MENU_ITEMS;
|
||||
return (
|
||||
<>
|
||||
<header className="top-menubar">
|
||||
{/* 로고 */}
|
||||
<div className="tmb-logo">
|
||||
@@ -356,10 +342,9 @@ export const TopMenuBar = memo(function TopMenuBar({
|
||||
{desktopClient ? (
|
||||
<button
|
||||
type="button"
|
||||
className={`tmb-app-download-btn tmb-desktop-update-btn${desktopUpdateBusy ? ' busy' : ''}`}
|
||||
onClick={() => { void handleDesktopUpdate(); }}
|
||||
disabled={desktopUpdateBusy}
|
||||
title={desktopUpdateHint || 'PC 프로그램 업데이트'}
|
||||
className="tmb-app-download-btn tmb-desktop-update-btn"
|
||||
onClick={() => setDesktopUpdateOpen(true)}
|
||||
title="PC 프로그램 업데이트"
|
||||
aria-label="PC 프로그램 업데이트"
|
||||
>
|
||||
<IcDesktopUpdate />
|
||||
@@ -430,6 +415,14 @@ export const TopMenuBar = memo(function TopMenuBar({
|
||||
)}
|
||||
</div>
|
||||
</header>
|
||||
{desktopClient && (
|
||||
<DesktopUpdateModal
|
||||
open={desktopUpdateOpen}
|
||||
onClose={() => setDesktopUpdateOpen(false)}
|
||||
autoStart
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user