Sidebar cleanup.

This commit is contained in:
2025-11-21 16:16:03 +00:00
parent 6bbf48fe20
commit b324540ce0
4 changed files with 193 additions and 63 deletions

View File

@@ -1,4 +1,5 @@
import { useState } from 'react';
import { useLocation } from 'react-router';
import { Card } from './ui/card';
import { Button } from './ui/button';
import { Badge } from './ui/badge';
@@ -37,6 +38,7 @@ interface MergedApp extends App {
type TabView = 'available' | 'installed';
export function AppsComponent() {
const location = useLocation();
const { currentInstance } = useInstanceContext();
const { data: availableAppsData, isLoading: loadingAvailable, error: availableError } = useAvailableApps();
const {
@@ -51,7 +53,8 @@ export function AppsComponent() {
isDeleting
} = useDeployedApps(currentInstance);
const [activeTab, setActiveTab] = useState<TabView>('available');
// Determine active tab from URL path
const activeTab: TabView = location.pathname.endsWith('/installed') ? 'installed' : 'available';
const [searchTerm, setSearchTerm] = useState('');
const [selectedCategory, setSelectedCategory] = useState<string>('all');
const [configDialogOpen, setConfigDialogOpen] = useState(false);
@@ -323,22 +326,6 @@ export function AppsComponent() {
</div>
</div>
{/* Tab Navigation */}
<div className="flex gap-2 mb-6 border-b pb-4">
<Button
variant={activeTab === 'available' ? 'default' : 'outline'}
onClick={() => setActiveTab('available')}
>
Available Apps ({availableApps.length})
</Button>
<Button
variant={activeTab === 'installed' ? 'default' : 'outline'}
onClick={() => setActiveTab('installed')}
>
Installed Apps ({installedApps.length})
</Button>
</div>
<div className="flex flex-col sm:flex-row gap-4 mb-6">
<div className="relative flex-1">
<Search className="absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground" />