Files
ServerKit/frontend/src/layouts/DashboardLayout.jsx
T
Juan Denis 71b341ef77 Add plugin system (backend + frontend)
Introduce a plugin installation and management system.

Backend: add InstalledPlugin model, plugin_service with download/install/enable/disable/uninstall, dynamic blueprint registration and frontend manifest generation, and plugins API endpoints (list/get/install/enable/disable/uninstall). Register plugins blueprint and attempt to hot-load installed plugin blueprints at app startup.

Frontend: add PluginLoader component (Vite import.meta.glob) to render plugin widgets, extend Marketplace UI to install/manage plugins, add API client methods for plugins, and update styles for the marketplace plugin UI. This enables installing plugins from GitHub/repos/zips and managing them from the app.
2026-03-28 15:58:34 -04:00

41 lines
1.3 KiB
React

import React, { useState, useEffect, useCallback } from 'react';
import { Outlet } from 'react-router-dom';
import Sidebar from '../components/Sidebar';
import CommandPalette from '../components/CommandPalette';
import LogsDrawer from '../components/LogsDrawer';
import { LogsDrawerProvider } from '../contexts/LogsDrawerContext';
import PluginLoader from '../plugins/PluginLoader';
import api from '../services/api';
const DashboardLayout = () => {
const [paletteOpen, setPaletteOpen] = useState(false);
const handleKeyDown = useCallback((e) => {
if ((e.metaKey || e.ctrlKey) && e.key === 'k') {
e.preventDefault();
setPaletteOpen(prev => !prev);
}
}, []);
useEffect(() => {
document.addEventListener('keydown', handleKeyDown);
return () => document.removeEventListener('keydown', handleKeyDown);
}, [handleKeyDown]);
return (
<LogsDrawerProvider>
<div className="dashboard-layout">
<Sidebar />
<main className="main-content">
<Outlet />
</main>
<CommandPalette open={paletteOpen} onClose={() => setPaletteOpen(false)} />
<LogsDrawer />
<PluginLoader api={api} />
</div>
</LogsDrawerProvider>
);
};
export default DashboardLayout;