- Introduced a reusable `ConfirmDialog` component to replace native `window.confirm()`, providing a styled modal that aligns with the app's theme. - Integrated the `ConfirmDialog` into the `App` component for global access. - Updated the `WorkspaceSection` to utilize the new confirmation dialog for profile deletion, enhancing user experience with a more consistent UI. - Added state management for selected profiles in the `ConnectionSection`, improving user interaction when selecting saved profiles. This commit enhances the application's UI by providing a more cohesive and user-friendly confirmation experience.
51 lines
1.5 KiB
TypeScript
51 lines
1.5 KiB
TypeScript
import React, { useEffect } from 'react';
|
|
|
|
import { ConfirmDialog } from './components/common/ConfirmDialog';
|
|
import { ContextSwitchOverlay } from './components/common/ContextSwitchOverlay';
|
|
import { ErrorBoundary } from './components/common/ErrorBoundary';
|
|
import { TabbedLayout } from './components/layout/TabbedLayout';
|
|
import { useTheme } from './hooks/useTheme';
|
|
import { api } from './api';
|
|
import { initializeNotificationListeners, useStore } from './store';
|
|
|
|
export const App = (): React.JSX.Element => {
|
|
// Initialize theme on app load
|
|
useTheme();
|
|
|
|
// Dismiss splash screen once React is ready
|
|
useEffect(() => {
|
|
const splash = document.getElementById('splash');
|
|
if (splash) {
|
|
splash.style.opacity = '0';
|
|
setTimeout(() => splash.remove(), 300);
|
|
}
|
|
}, []);
|
|
|
|
// Initialize context system (before notification listeners)
|
|
useEffect(() => {
|
|
void useStore.getState().initializeContextSystem();
|
|
}, []);
|
|
|
|
// Refresh available contexts when SSH connection state changes
|
|
useEffect(() => {
|
|
if (!api.ssh?.onStatus) return;
|
|
const cleanup = api.ssh.onStatus(() => {
|
|
void useStore.getState().fetchAvailableContexts();
|
|
});
|
|
return cleanup;
|
|
}, []);
|
|
|
|
// Initialize IPC event listeners (notifications, file changes)
|
|
useEffect(() => {
|
|
const cleanup = initializeNotificationListeners();
|
|
return cleanup;
|
|
}, []);
|
|
|
|
return (
|
|
<ErrorBoundary>
|
|
<ContextSwitchOverlay />
|
|
<TabbedLayout />
|
|
<ConfirmDialog />
|
|
</ErrorBoundary>
|
|
);
|
|
};
|