앱 버전표시
This commit is contained in:
@@ -206,6 +206,11 @@ html.theme-blue {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
html.desktop-client .tmb-logo-text {
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
/* 구분선 */
|
||||
.tmb-divider {
|
||||
width: 1px;
|
||||
|
||||
@@ -36,6 +36,7 @@ import type { LoginResponse } from './utils/backendApi';
|
||||
import { invalidateAppSettingsCache } from './hooks/useAppSettings';
|
||||
import { invalidateIndicatorSettingsCache } from './hooks/useIndicatorSettings';
|
||||
import { isDesktop } from './utils/platform';
|
||||
import { syncDesktopMainWindowTitle } from './utils/desktopBridge';
|
||||
import { writeDesktopSync } from './utils/desktopSync';
|
||||
|
||||
const LAST_MENU_KEY = 'gc_last_menu';
|
||||
@@ -513,6 +514,11 @@ function AppMainContent({
|
||||
|
||||
function App() {
|
||||
const [sessionKey, setSessionKey] = useState(0);
|
||||
useEffect(() => {
|
||||
if (!isDesktop()) return;
|
||||
void syncDesktopMainWindowTitle();
|
||||
}, []);
|
||||
|
||||
const [appEntered, setAppEnteredState] = useState(() => isAppEntered());
|
||||
const [authUser, setAuthUser] = useState<AuthSession | null>(() =>
|
||||
isAppEntered() ? getAuthSession() : null,
|
||||
|
||||
@@ -10,6 +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 { useDesktopAppTitle, formatDesktopAppLabel } from '../hooks/useDesktopAppTitle';
|
||||
import DesktopUpdateModal from './DesktopUpdateModal';
|
||||
import TopMenuBarNavGroups from './TopMenuBarNavGroups';
|
||||
|
||||
@@ -297,6 +298,7 @@ export const TopMenuBar = memo(function TopMenuBar({
|
||||
const [isFullscreen, setIsFullscreen] = useState(() => !!document.fullscreenElement);
|
||||
const [desktopUpdateOpen, setDesktopUpdateOpen] = useState(false);
|
||||
const desktopClient = isDesktop();
|
||||
const desktopAppVersion = useDesktopAppTitle();
|
||||
|
||||
useEffect(() => {
|
||||
const sync = () => setIsFullscreen(!!document.fullscreenElement);
|
||||
@@ -317,7 +319,9 @@ export const TopMenuBar = memo(function TopMenuBar({
|
||||
<rect width="20" height="20" rx="4" fill="#2196f3"/>
|
||||
<polyline points="3,14 7,9 10,12 14,6 17,6" stroke="white" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" fill="none"/>
|
||||
</svg>
|
||||
<span className="tmb-logo-text">GoldenChart</span>
|
||||
<span className="tmb-logo-text">
|
||||
{desktopClient ? formatDesktopAppLabel(desktopAppVersion) : 'GoldenChart'}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div className="tmb-divider" />
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { isDesktop } from '../utils/platform';
|
||||
import { getDesktopAppVersion, syncDesktopMainWindowTitle } from '../utils/desktopBridge';
|
||||
|
||||
declare const __DESKTOP_APP_VERSION__: string | undefined;
|
||||
|
||||
function readBakedDesktopVersion(): string | null {
|
||||
if (typeof __DESKTOP_APP_VERSION__ === 'undefined') return null;
|
||||
const v = __DESKTOP_APP_VERSION__.trim();
|
||||
return v || null;
|
||||
}
|
||||
|
||||
/** Desktop — 네이티브 창 타이틀·document.title을 GoldenChart (vX.Y.Z) 로 맞춤 */
|
||||
export function useDesktopAppTitle(): string | null {
|
||||
const [version, setVersion] = useState<string | null>(() =>
|
||||
isDesktop() ? readBakedDesktopVersion() : null,
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (!isDesktop()) return;
|
||||
let cancelled = false;
|
||||
void (async () => {
|
||||
const v = (await getDesktopAppVersion()) ?? readBakedDesktopVersion();
|
||||
if (cancelled || !v) return;
|
||||
setVersion(v);
|
||||
await syncDesktopMainWindowTitle();
|
||||
})();
|
||||
return () => { cancelled = true; };
|
||||
}, []);
|
||||
|
||||
return version;
|
||||
}
|
||||
|
||||
export function formatDesktopAppLabel(version: string | null | undefined): string {
|
||||
if (!version?.trim()) return 'GoldenChart';
|
||||
return `GoldenChart (v${version.trim()})`;
|
||||
}
|
||||
@@ -63,6 +63,8 @@
|
||||
overflow: hidden;
|
||||
padding: 10px 12px 12px;
|
||||
background: var(--se-center-bg, var(--se-bg));
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* 좌·중·우 패널 동일 높이 — flex 체인 */
|
||||
@@ -193,6 +195,8 @@
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
max-width: none;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
border-radius: 14px;
|
||||
|
||||
@@ -37,6 +37,7 @@ export interface DesktopBridge {
|
||||
onProgress?: (progress: DesktopUpdateProgress) => void,
|
||||
) => Promise<DesktopUpdateResult>;
|
||||
getAppVersion: () => Promise<string>;
|
||||
syncMainWindowTitle: () => Promise<string>;
|
||||
}
|
||||
|
||||
declare global {
|
||||
@@ -85,3 +86,13 @@ export async function getDesktopAppVersion(): Promise<string | null> {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
export async function syncDesktopMainWindowTitle(): Promise<string | null> {
|
||||
const bridge = getDesktopBridge();
|
||||
if (!bridge?.syncMainWindowTitle) return null;
|
||||
try {
|
||||
return await bridge.syncMainWindowTitle();
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user