api ulandi
This commit is contained in:
@@ -1,46 +1,29 @@
|
||||
import { Button } from '@/shared/ui/button';
|
||||
import { Card, CardContent } from '@/shared/ui/card';
|
||||
import { Tabs, TabsList, TabsTrigger } from '@/shared/ui/tabs';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { Calendar, CheckCircle, Clock, RefreshCw } from 'lucide-react';
|
||||
import { useTranslations } from 'next-intl';
|
||||
import Image from 'next/image';
|
||||
import { useState } from 'react';
|
||||
import { order_api } from '../lib/api';
|
||||
import { orders } from '../lib/data';
|
||||
|
||||
const HistoryTabs = () => {
|
||||
const [historyTab, setHistoryTab] = useState('all');
|
||||
const t = useTranslations();
|
||||
|
||||
const { data } = useQuery({
|
||||
queryKey: ['order_list'],
|
||||
queryFn: () => order_api.list({ page: 1, page_size: 1 }),
|
||||
});
|
||||
|
||||
console.log(data);
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="flex items-center justify-between mb-4 md:mb-6">
|
||||
<h2 className="text-xl md:text-2xl font-bold text-foreground">Tarix</h2>
|
||||
<h2 className="text-xl md:text-2xl font-bold text-foreground">
|
||||
{t('Tarix')}
|
||||
</h2>
|
||||
</div>
|
||||
<Tabs
|
||||
value={historyTab}
|
||||
onValueChange={setHistoryTab}
|
||||
className="mb-4 md:mb-6"
|
||||
>
|
||||
<TabsList className="bg-slate-100 w-full grid grid-cols-3 h-auto p-1">
|
||||
<TabsTrigger
|
||||
value="all"
|
||||
className="data-[state=active]:bg-white text-xs md:text-sm py-2"
|
||||
>
|
||||
Barchasi
|
||||
</TabsTrigger>
|
||||
<TabsTrigger
|
||||
value="week"
|
||||
className="data-[state=active]:bg-white text-xs md:text-sm py-2"
|
||||
>
|
||||
Bu hafta
|
||||
</TabsTrigger>
|
||||
<TabsTrigger
|
||||
value="month"
|
||||
className="data-[state=active]:bg-white text-xs md:text-sm py-2"
|
||||
>
|
||||
Bu oy
|
||||
</TabsTrigger>
|
||||
</TabsList>
|
||||
</Tabs>
|
||||
|
||||
<div className="space-y-3 md:space-y-4">
|
||||
{orders
|
||||
.filter((o) => o.status === 'delivered')
|
||||
@@ -100,7 +83,7 @@ const HistoryTabs = () => {
|
||||
className="bg-transparent gap-1 md:gap-2 text-xs md:text-sm h-8 md:h-9 px-2 md:px-3"
|
||||
>
|
||||
<RefreshCw className="w-3 h-3 md:w-4 md:h-4" />
|
||||
Qayta
|
||||
{t('Qayta')}
|
||||
</Button>
|
||||
</div>
|
||||
</CardContent>
|
||||
|
||||
Reference in New Issue
Block a user