mirror of
https://github.com/siteboon/claudecodeui.git
synced 2026-02-14 12:47:33 +00:00
refactor(sidebar): integrate settings modal into SidebarModals and update props
This commit is contained in:
@@ -32,6 +32,9 @@ function Sidebar({
|
|||||||
loadingProgress,
|
loadingProgress,
|
||||||
onRefresh,
|
onRefresh,
|
||||||
onShowSettings,
|
onShowSettings,
|
||||||
|
showSettings,
|
||||||
|
settingsInitialTab,
|
||||||
|
onCloseSettings,
|
||||||
isMobile,
|
isMobile,
|
||||||
}: SidebarProps) {
|
}: SidebarProps) {
|
||||||
const { t } = useTranslation(['sidebar', 'common']);
|
const { t } = useTranslation(['sidebar', 'common']);
|
||||||
@@ -179,6 +182,23 @@ function Sidebar({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
<SidebarModals
|
||||||
|
projects={projects}
|
||||||
|
showSettings={showSettings}
|
||||||
|
settingsInitialTab={settingsInitialTab}
|
||||||
|
onCloseSettings={onCloseSettings}
|
||||||
|
showNewProject={showNewProject}
|
||||||
|
onCloseNewProject={() => setShowNewProject(false)}
|
||||||
|
onProjectCreated={handleProjectCreated}
|
||||||
|
deleteConfirmation={deleteConfirmation}
|
||||||
|
onCancelDeleteProject={() => setDeleteConfirmation(null)}
|
||||||
|
onConfirmDeleteProject={confirmDeleteProject}
|
||||||
|
sessionDeleteConfirmation={sessionDeleteConfirmation}
|
||||||
|
onCancelDeleteSession={() => setSessionDeleteConfirmation(null)}
|
||||||
|
onConfirmDeleteSession={confirmDeleteSession}
|
||||||
|
t={t}
|
||||||
|
/>
|
||||||
|
|
||||||
{isSidebarCollapsed ? (
|
{isSidebarCollapsed ? (
|
||||||
<SidebarCollapsed
|
<SidebarCollapsed
|
||||||
onExpand={handleExpandSidebar}
|
onExpand={handleExpandSidebar}
|
||||||
@@ -189,19 +209,6 @@ function Sidebar({
|
|||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<SidebarModals
|
|
||||||
showNewProject={showNewProject}
|
|
||||||
onCloseNewProject={() => setShowNewProject(false)}
|
|
||||||
onProjectCreated={handleProjectCreated}
|
|
||||||
deleteConfirmation={deleteConfirmation}
|
|
||||||
onCancelDeleteProject={() => setDeleteConfirmation(null)}
|
|
||||||
onConfirmDeleteProject={confirmDeleteProject}
|
|
||||||
sessionDeleteConfirmation={sessionDeleteConfirmation}
|
|
||||||
onCancelDeleteSession={() => setSessionDeleteConfirmation(null)}
|
|
||||||
onConfirmDeleteSession={confirmDeleteSession}
|
|
||||||
t={t}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<SidebarContent
|
<SidebarContent
|
||||||
isPWA={isPWA}
|
isPWA={isPWA}
|
||||||
isMobile={isMobile}
|
isMobile={isMobile}
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import { useTranslation } from 'react-i18next';
|
|||||||
import Sidebar from '../Sidebar';
|
import Sidebar from '../Sidebar';
|
||||||
import MainContent from '../MainContent';
|
import MainContent from '../MainContent';
|
||||||
import MobileNav from '../MobileNav';
|
import MobileNav from '../MobileNav';
|
||||||
import Settings from '../Settings';
|
|
||||||
|
|
||||||
import { useWebSocket } from '../../contexts/WebSocketContext';
|
import { useWebSocket } from '../../contexts/WebSocketContext';
|
||||||
import { useDeviceSettings } from '../../hooks/useDeviceSettings';
|
import { useDeviceSettings } from '../../hooks/useDeviceSettings';
|
||||||
@@ -30,15 +29,12 @@ export default function AppContent() {
|
|||||||
} = useSessionProtection();
|
} = useSessionProtection();
|
||||||
|
|
||||||
const {
|
const {
|
||||||
projects,
|
|
||||||
selectedProject,
|
selectedProject,
|
||||||
selectedSession,
|
selectedSession,
|
||||||
activeTab,
|
activeTab,
|
||||||
sidebarOpen,
|
sidebarOpen,
|
||||||
isLoadingProjects,
|
isLoadingProjects,
|
||||||
isInputFocused,
|
isInputFocused,
|
||||||
showSettings,
|
|
||||||
settingsInitialTab,
|
|
||||||
externalMessageUpdate,
|
externalMessageUpdate,
|
||||||
setActiveTab,
|
setActiveTab,
|
||||||
setSidebarOpen,
|
setSidebarOpen,
|
||||||
@@ -143,12 +139,6 @@ export default function AppContent() {
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<Settings
|
|
||||||
isOpen={showSettings}
|
|
||||||
onClose={() => setShowSettings(false)}
|
|
||||||
projects={projects as any}
|
|
||||||
initialTab={settingsInitialTab}
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,9 +3,15 @@ import { AlertTriangle, Trash2 } from 'lucide-react';
|
|||||||
import type { TFunction } from 'i18next';
|
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 type { Project } from '../../types/app';
|
||||||
import type { DeleteProjectConfirmation, SessionDeleteConfirmation } from './types';
|
import type { DeleteProjectConfirmation, SessionDeleteConfirmation } from './types';
|
||||||
|
|
||||||
type SidebarModalsProps = {
|
type SidebarModalsProps = {
|
||||||
|
projects: Project[];
|
||||||
|
showSettings: boolean;
|
||||||
|
settingsInitialTab: string;
|
||||||
|
onCloseSettings: () => void;
|
||||||
showNewProject: boolean;
|
showNewProject: boolean;
|
||||||
onCloseNewProject: () => void;
|
onCloseNewProject: () => void;
|
||||||
onProjectCreated: () => void;
|
onProjectCreated: () => void;
|
||||||
@@ -19,6 +25,10 @@ type SidebarModalsProps = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default function SidebarModals({
|
export default function SidebarModals({
|
||||||
|
projects,
|
||||||
|
showSettings,
|
||||||
|
settingsInitialTab,
|
||||||
|
onCloseSettings,
|
||||||
showNewProject,
|
showNewProject,
|
||||||
onCloseNewProject,
|
onCloseNewProject,
|
||||||
onProjectCreated,
|
onProjectCreated,
|
||||||
@@ -41,6 +51,13 @@ export default function SidebarModals({
|
|||||||
document.body,
|
document.body,
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
<Settings
|
||||||
|
isOpen={showSettings}
|
||||||
|
onClose={onCloseSettings}
|
||||||
|
projects={projects as any}
|
||||||
|
initialTab={settingsInitialTab}
|
||||||
|
/>
|
||||||
|
|
||||||
{deleteConfirmation &&
|
{deleteConfirmation &&
|
||||||
ReactDOM.createPortal(
|
ReactDOM.createPortal(
|
||||||
<div className="fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-50 p-4">
|
<div className="fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-50 p-4">
|
||||||
|
|||||||
@@ -35,6 +35,9 @@ export type SidebarProps = {
|
|||||||
loadingProgress: LoadingProgress | null;
|
loadingProgress: LoadingProgress | null;
|
||||||
onRefresh: () => Promise<void> | void;
|
onRefresh: () => Promise<void> | void;
|
||||||
onShowSettings: () => void;
|
onShowSettings: () => void;
|
||||||
|
showSettings: boolean;
|
||||||
|
settingsInitialTab: string;
|
||||||
|
onCloseSettings: () => void;
|
||||||
isMobile: boolean;
|
isMobile: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -480,6 +480,9 @@ export function useProjectsState({
|
|||||||
loadingProgress,
|
loadingProgress,
|
||||||
onRefresh: handleSidebarRefresh,
|
onRefresh: handleSidebarRefresh,
|
||||||
onShowSettings: () => setShowSettings(true),
|
onShowSettings: () => setShowSettings(true),
|
||||||
|
showSettings,
|
||||||
|
settingsInitialTab,
|
||||||
|
onCloseSettings: () => setShowSettings(false),
|
||||||
isMobile,
|
isMobile,
|
||||||
}),
|
}),
|
||||||
[
|
[
|
||||||
@@ -493,8 +496,10 @@ export function useProjectsState({
|
|||||||
isMobile,
|
isMobile,
|
||||||
loadingProgress,
|
loadingProgress,
|
||||||
projects,
|
projects,
|
||||||
|
settingsInitialTab,
|
||||||
selectedProject,
|
selectedProject,
|
||||||
selectedSession,
|
selectedSession,
|
||||||
|
showSettings,
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user