Refactor: Remove unused Tabs component
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
import React, { useState, useEffect } from 'react';
|
import React, { useState, useEffect } from 'react';
|
||||||
import { useLocation, useNavigate } from 'react-router-dom';
|
import { useLocation, useNavigate } from 'react-router-dom';
|
||||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
|
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
|
||||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
|
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
import { Badge } from '@/components/ui/badge';
|
import { Badge } from '@/components/ui/badge';
|
||||||
import { Input } from '@/components/ui/input';
|
import { Input } from '@/components/ui/input';
|
||||||
@@ -66,20 +65,7 @@ const ChannelManager = () => {
|
|||||||
|
|
||||||
// Get active tab from URL or default to 'overview'
|
// Get active tab from URL or default to 'overview'
|
||||||
const queryParams = new URLSearchParams(location.search);
|
const queryParams = new URLSearchParams(location.search);
|
||||||
const urlTab = queryParams.get('tab') || 'overview';
|
const activeTab = queryParams.get('tab') || 'overview';
|
||||||
const [activeTab, setActiveTab] = useState(urlTab);
|
|
||||||
|
|
||||||
// Update active tab when URL changes
|
|
||||||
useEffect(() => {
|
|
||||||
const newTab = queryParams.get('tab') || 'overview';
|
|
||||||
setActiveTab(newTab);
|
|
||||||
}, [location.search]);
|
|
||||||
|
|
||||||
// Update URL when tab changes
|
|
||||||
const handleTabChange = (newTab: string) => {
|
|
||||||
setActiveTab(newTab);
|
|
||||||
navigate(`/dashboard/channel-manager?tab=${newTab}`);
|
|
||||||
};
|
|
||||||
|
|
||||||
const [searchTerm, setSearchTerm] = useState('');
|
const [searchTerm, setSearchTerm] = useState('');
|
||||||
const [filterType, setFilterType] = useState('all');
|
const [filterType, setFilterType] = useState('all');
|
||||||
@@ -712,28 +698,11 @@ const ChannelManager = () => {
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Tabs value={activeTab} onValueChange={handleTabChange} className="space-y-6">
|
{activeTab === 'overview' && <OverviewTab />}
|
||||||
|
{activeTab === 'channels' && <ChannelsTab />}
|
||||||
<TabsContent value="overview">
|
{activeTab === 'listings' && <ListingsTab />}
|
||||||
<OverviewTab />
|
{activeTab === 'reservations' && <ReservationsTab />}
|
||||||
</TabsContent>
|
{activeTab === 'analytics' && <AnalyticsTab stats={stats} onDateRangeChange={loadStats} />}
|
||||||
|
|
||||||
<TabsContent value="channels">
|
|
||||||
<ChannelsTab />
|
|
||||||
</TabsContent>
|
|
||||||
|
|
||||||
<TabsContent value="listings">
|
|
||||||
<ListingsTab />
|
|
||||||
</TabsContent>
|
|
||||||
|
|
||||||
<TabsContent value="reservations">
|
|
||||||
<ReservationsTab />
|
|
||||||
</TabsContent>
|
|
||||||
|
|
||||||
<TabsContent value="analytics">
|
|
||||||
<AnalyticsTab stats={stats} onDateRangeChange={loadStats} />
|
|
||||||
</TabsContent>
|
|
||||||
</Tabs>
|
|
||||||
|
|
||||||
{/* Modals */}
|
{/* Modals */}
|
||||||
<ChannelConnectionModal
|
<ChannelConnectionModal
|
||||||
|
|||||||
Reference in New Issue
Block a user