refactor(sidebar): move VersionUpgradeModal into SidebarModals

This commit is contained in:
Haileyesus
2026-02-11 15:42:38 +03:00
parent a0bc4a8c72
commit 8e411187f3
2 changed files with 25 additions and 8 deletions

View File

@@ -1,6 +1,5 @@
import { useEffect } from 'react'; import { useEffect } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import VersionUpgradeModal from './modals/VersionUpgradeModal';
import { useDeviceSettings } from '../hooks/useDeviceSettings'; import { useDeviceSettings } from '../hooks/useDeviceSettings';
import { useVersionCheck } from '../hooks/useVersionCheck'; import { useVersionCheck } from '../hooks/useVersionCheck';
import { useUiPreferences } from '../hooks/useUiPreferences'; import { useUiPreferences } from '../hooks/useUiPreferences';
@@ -196,6 +195,11 @@ function Sidebar({
sessionDeleteConfirmation={sessionDeleteConfirmation} sessionDeleteConfirmation={sessionDeleteConfirmation}
onCancelDeleteSession={() => setSessionDeleteConfirmation(null)} onCancelDeleteSession={() => setSessionDeleteConfirmation(null)}
onConfirmDeleteSession={confirmDeleteSession} onConfirmDeleteSession={confirmDeleteSession}
showVersionModal={showVersionModal}
onCloseVersionModal={() => setShowVersionModal(false)}
releaseInfo={releaseInfo}
currentVersion={currentVersion}
latestVersion={latestVersion}
t={t} t={t}
/> />
@@ -234,13 +238,6 @@ function Sidebar({
</> </>
)} )}
<VersionUpgradeModal
isOpen={showVersionModal}
onClose={() => setShowVersionModal(false)}
releaseInfo={releaseInfo}
currentVersion={currentVersion}
latestVersion={latestVersion}
/>
</> </>
); );
} }

View File

@@ -4,7 +4,9 @@ import type { TFunction } from 'i18next';
import { Button } from '../ui/button'; import { Button } from '../ui/button';
import ProjectCreationWizard from '../ProjectCreationWizard'; import ProjectCreationWizard from '../ProjectCreationWizard';
import Settings from '../Settings'; import Settings from '../Settings';
import VersionUpgradeModal from '../modals/VersionUpgradeModal';
import type { Project } from '../../types/app'; import type { Project } from '../../types/app';
import type { ReleaseInfo } from '../../types/sharedTypes';
import type { DeleteProjectConfirmation, SessionDeleteConfirmation } from './types'; import type { DeleteProjectConfirmation, SessionDeleteConfirmation } from './types';
type SidebarModalsProps = { type SidebarModalsProps = {
@@ -21,6 +23,11 @@ type SidebarModalsProps = {
sessionDeleteConfirmation: SessionDeleteConfirmation | null; sessionDeleteConfirmation: SessionDeleteConfirmation | null;
onCancelDeleteSession: () => void; onCancelDeleteSession: () => void;
onConfirmDeleteSession: () => void; onConfirmDeleteSession: () => void;
showVersionModal: boolean;
onCloseVersionModal: () => void;
releaseInfo: ReleaseInfo | null;
currentVersion: string;
latestVersion: string | null;
t: TFunction; t: TFunction;
}; };
@@ -38,6 +45,11 @@ export default function SidebarModals({
sessionDeleteConfirmation, sessionDeleteConfirmation,
onCancelDeleteSession, onCancelDeleteSession,
onConfirmDeleteSession, onConfirmDeleteSession,
showVersionModal,
onCloseVersionModal,
releaseInfo,
currentVersion,
latestVersion,
t, t,
}: SidebarModalsProps) { }: SidebarModalsProps) {
return ( return (
@@ -155,6 +167,14 @@ export default function SidebarModals({
</div>, </div>,
document.body, document.body,
)} )}
<VersionUpgradeModal
isOpen={showVersionModal}
onClose={onCloseVersionModal}
releaseInfo={releaseInfo}
currentVersion={currentVersion}
latestVersion={latestVersion}
/>
</> </>
); );
} }