위젯 추가 팝업 수정
This commit is contained in:
@@ -9,6 +9,9 @@ import {
|
||||
type DesktopUpdatePhase,
|
||||
type DesktopUpdateProgress,
|
||||
} from '../utils/desktopBridge';
|
||||
|
||||
/** 다른 오버레이(플로팅 위젯 13000 등)보다 위에 표시 */
|
||||
const DESKTOP_UPDATE_MODAL_Z = 15000;
|
||||
import { isMacDesktop, isWindowsDesktop } from '../utils/platform';
|
||||
import { PlatformBrandIcon, type PlatformBrandIconId } from './icons/PlatformBrandIcons';
|
||||
|
||||
@@ -52,12 +55,14 @@ const DesktopUpdateModal: React.FC<Props> = ({ open, onClose, autoStart = true }
|
||||
? 'desktop-update-progress--active'
|
||||
: '';
|
||||
|
||||
const handleRun = useCallback(async () => {
|
||||
const handleRun = useCallback(async (opts?: { bypassLoopGuard?: boolean }) => {
|
||||
if (busy) return;
|
||||
setBusy(true);
|
||||
setProgress({ phase: 'checking', message: '서버에서 새 버전을 확인하는 중…', currentVersion: appVersion });
|
||||
try {
|
||||
await runDesktopUpdate(p => setProgress(p));
|
||||
await runDesktopUpdate(p => setProgress(p), {
|
||||
bypassLoopGuard: opts?.bypassLoopGuard ?? true,
|
||||
});
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
@@ -66,6 +71,8 @@ const DesktopUpdateModal: React.FC<Props> = ({ open, onClose, autoStart = true }
|
||||
useEffect(() => {
|
||||
if (!open) {
|
||||
startedRef.current = false;
|
||||
setProgress(null);
|
||||
setBusy(false);
|
||||
return;
|
||||
}
|
||||
void getDesktopAppVersion().then(v => {
|
||||
@@ -73,7 +80,7 @@ const DesktopUpdateModal: React.FC<Props> = ({ open, onClose, autoStart = true }
|
||||
});
|
||||
if (autoStart && !startedRef.current) {
|
||||
startedRef.current = true;
|
||||
void handleRun();
|
||||
void handleRun({ bypassLoopGuard: true });
|
||||
}
|
||||
}, [open, autoStart, handleRun]);
|
||||
|
||||
@@ -97,6 +104,7 @@ const DesktopUpdateModal: React.FC<Props> = ({ open, onClose, autoStart = true }
|
||||
onClose={isActive ? () => {} : onClose}
|
||||
closeOnBackdrop={!isActive}
|
||||
width={440}
|
||||
zIndex={DESKTOP_UPDATE_MODAL_Z}
|
||||
dialogClassName="sp-modal desktop-update-modal"
|
||||
>
|
||||
<div className="desktop-update-modal-body">
|
||||
@@ -200,7 +208,7 @@ const DesktopUpdateModal: React.FC<Props> = ({ open, onClose, autoStart = true }
|
||||
|
||||
<div className="desktop-update-actions">
|
||||
{phase === 'error' && (
|
||||
<button type="button" className="stg-btn-secondary" disabled={busy} onClick={() => { void handleRun(); }}>
|
||||
<button type="button" className="stg-btn-secondary" disabled={busy} onClick={() => { void handleRun({ bypassLoopGuard: true }); }}>
|
||||
다시 시도
|
||||
</button>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user