Skip to content

ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.

Add Downloads and Status Pages tabs (lazy-loaded)

Juan Denis3f39e15e22fa
diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx
index 091d31e6..01bfb566 100644
--- a/frontend/src/App.jsx
+++ b/frontend/src/App.jsx
@@ -34,7 +34,7 @@ const Templates = lazy(() => import('./pages/Templates'));
const WorkflowBuilder = lazy(() => import('./pages/WorkflowBuilder'));
const Servers = lazy(() => import('./pages/Servers'));
const ServerDetail = lazy(() => import('./pages/ServerDetail'));
-const Downloads = lazy(() => import('./pages/Downloads'));
+// Downloads — absorbed into Marketplace page as tab
const WordPress = lazy(() => import('./pages/WordPress'));
const WordPressDetail = lazy(() => import('./pages/WordPressDetail'));
const WordPressProjects = lazy(() => import('./pages/WordPressProjects'));
diff --git a/frontend/src/pages/Marketplace.jsx b/frontend/src/pages/Marketplace.jsx
index 9ab69659..f5fa4f2e 100644
--- a/frontend/src/pages/Marketplace.jsx
+++ b/frontend/src/pages/Marketplace.jsx
@@ -1,8 +1,13 @@
-import React, { useState, useEffect, useCallback } from 'react';
+import React, { useState, useEffect, useCallback, lazy, Suspense } from 'react';
import api from '../services/api';
import { useToast } from '../contexts/ToastContext';
import { useAuth } from '../contexts/AuthContext';
-import Spinner from '../components/Spinner';
+import Spinner, { LoadingState } from '../components/Spinner';
+import useTabParam from '../hooks/useTabParam';
+
+const Downloads = lazy(() => import('./Downloads'));
+
+const VALID_TABS = ['browse', 'installed', 'downloads'];
const Marketplace = () => {
const toast = useToast();
@@ -12,7 +17,7 @@ const Marketplace = () => {
const [loading, setLoading] = useState(true);
const [search, setSearch] = useState('');
const [category, setCategory] = useState('');
- const [tab, setTab] = useState('browse');
+ const [tab, setTab] = useTabParam('/marketplace', VALID_TABS);
const [showSubmit, setShowSubmit] = useState(false);
const [form, setForm] = useState({ name: '', display_name: '', description: '', category: 'utility', version: '1.0.0', author: '' });
@@ -84,6 +89,7 @@ const Marketplace = () => {
<div className="tabs">
<button className={`tab ${tab === 'browse' ? 'active' : ''}`} onClick={() => setTab('browse')}>Browse</button>
<button className={`tab ${tab === 'installed' ? 'active' : ''}`} onClick={() => setTab('installed')}>Installed ({myExtensions.length})</button>
+ <button className={`tab ${tab === 'downloads' ? 'active' : ''}`} onClick={() => setTab('downloads')}>Downloads</button>
</div>
{tab === 'browse' && (
@@ -142,6 +148,12 @@ const Marketplace = () => {
</div>
)}
+ {tab === 'downloads' && (
+ <Suspense fallback={<LoadingState />}>
+ <Downloads />
+ </Suspense>
+ )}
+
{showSubmit && (
<div className="modal-overlay" onClick={() => setShowSubmit(false)}>
<div className="modal" onClick={e => e.stopPropagation()}>
diff --git a/frontend/src/pages/Monitoring.jsx b/frontend/src/pages/Monitoring.jsx
index 48cb30a3..cf342682 100644
--- a/frontend/src/pages/Monitoring.jsx
+++ b/frontend/src/pages/Monitoring.jsx
@@ -1,9 +1,12 @@
-import React, { useState, useEffect } from 'react';
+import React, { useState, useEffect, lazy, Suspense } from 'react';
import useTabParam from '../hooks/useTabParam';
import api from '../services/api';
import { useToast } from '../contexts/ToastContext';
+import { LoadingState } from '../components/Spinner';
-const VALID_TABS = ['overview', 'alerts', 'config', 'thresholds'];
+const StatusPages = lazy(() => import('./StatusPages'));
+
+const VALID_TABS = ['overview', 'alerts', 'config', 'thresholds', 'status-pages'];
const Monitoring = () => {
const toast = useToast();
@@ -204,6 +207,12 @@ const Monitoring = () => {
>
Thresholds
</button>
+ <button
+ className={`tab ${activeTab === 'status-pages' ? 'active' : ''}`}
+ onClick={() => setActiveTab('status-pages')}
+ >
+ Status Pages
+ </button>
</div>
{activeTab === 'overview' && (
@@ -511,6 +520,12 @@ const Monitoring = () => {
</div>
</div>
)}
+
+ {activeTab === 'status-pages' && (
+ <Suspense fallback={<LoadingState />}>
+ <StatusPages />
+ </Suspense>
+ )}
</div>
);
};