%PDF- %PDF-
| Direktori : /home2/rezakur1/muakita.rezakurnia.com/Mua-Kita-Web/src/components/views/ |
| Current File : //home2/rezakur1/muakita.rezakurnia.com/Mua-Kita-Web/src/components/views/FeatureView.tsx |
import React, { useState } from 'react';
import {
Sparkles, Tag, Server, FileText, SlidersHorizontal, BarChart3, History,
UserCheck, UserCog, Heart, Users, Store, Calendar, Package, Image as ImageIcon,
RefreshCw, Crown, Building, HelpCircle, Plus, Search, CheckCircle2,
Filter, ArrowRight, ExternalLink, Settings, ShieldAlert
} from 'lucide-react';
import { MenuItem, Role } from '../../types';
interface FeatureViewProps {
activeTab: string;
role: Role;
menus: MenuItem[];
triggerToast: (msg: string) => void;
}
export const FeatureView: React.FC<FeatureViewProps> = ({
activeTab,
role,
menus,
triggerToast
}) => {
const [searchQuery, setSearchQuery] = useState('');
const menuItem = menus.find(m => m.id === activeTab) || {
id: activeTab,
label: activeTab,
icon: Sparkles
};
const IconComponent = menuItem.icon || Sparkles;
// Custom data generator depending on tab ID for rich realistic experience
const getFeatureDetails = () => {
switch (activeTab) {
case 'promosi':
return {
title: 'Promosi & Kode Voucher Platform',
sub: 'Kelola diskon, promo cashback, dan campaign pemasaran MuaKita',
stats: [
{ label: 'Voucher Aktif', value: '8 Kode', color: 'text-[#EC167F]' },
{ label: 'Total Klaim', value: '1.240 X', color: 'text-purple-600' },
{ label: 'Diskon Terpakai', value: 'Rp 14.5Jt', color: 'text-emerald-600' }
],
items: [
{ title: 'Promo Launching MuaKita - Diskon 20%', code: 'MUAKITA20', usage: '480/500', status: 'Aktif' },
{ title: 'Cashback Upgrade Pro Studio', code: 'PROUPGRADE', usage: '120/200', status: 'Aktif' },
{ title: 'Diskon Khusus WO Baru', code: 'NEWWO2025', usage: '45/100', status: 'Aktif' }
]
};
case 'event':
return {
title: 'Event Wedding & Proyek Klien',
sub: 'Daftar proyek pernikahan, moodboard makeup, dan rundown hari-H',
stats: [
{ label: 'Event Bulan Ini', value: '6 Event', color: 'text-pink-600' },
{ label: 'Resepsi Mendatang', value: '24 Mei 2025', color: 'text-purple-600' },
{ label: 'Vendor Terhubung', value: '12 Vendor', color: 'text-blue-600' }
],
items: [
{ title: 'Pernikahan Maya & Dimas (Griya Manten)', code: 'WED-2025-05', usage: 'Akad & Resepsi', status: 'H-3 Hari' },
{ title: 'Akad Nikah Clara & Farhan', code: 'WED-2025-06', usage: 'MUA Syar\'i Look', status: 'H-5 Hari' },
]
};
case 'jadwal':
return {
title: 'Jadwal & Kalender Booking Studio',
sub: 'Visualisasi slot waktu makeup, tim standby, dan janji temu trial',
stats: [
{ label: 'Slot Terisi Sabtu', value: '100% Full', color: 'text-[#EC167F]' },
{ label: 'Slot Tersedia Minggu', value: '2 Slot', color: 'text-emerald-600' },
{ label: 'Trial Booking', value: '3 Klien', color: 'text-blue-600' }
],
items: [
{ title: '06:00 - 08:30 WIB: Makeup Akad Maya Salsabila', code: 'STUDIO-A', usage: 'Lead MUA Maya', status: 'Terjadwal' },
{ title: '09:00 - 11:00 WIB: Hairdo & Touchup Bridesmaid', code: 'STUDIO-B', usage: 'Stylist Rina', status: 'Terjadwal' },
{ title: '13:00 - 15:00 WIB: Trial Makeup Lamaran Anisa', code: 'STUDIO-A', usage: 'Lead MUA Maya', status: 'Terjadwal' }
]
};
case 'inventaris':
return {
title: 'Inventaris Peralatan & Stock Makeup',
sub: 'Kelola stok foundation, bulu mata, persewaan gaun/kebaya & kebersihan kit',
stats: [
{ label: 'Total Item Kit', value: '148 Item', color: 'text-slate-900' },
{ label: 'Item Perlu Restock', value: '3 Item', color: 'text-amber-600' },
{ label: 'Koleksi Kebaya', value: '24 Gaun', color: 'text-purple-600' }
],
items: [
{ title: 'Foundation Estee Lauder Double Wear (Shade Bone)', code: 'KOSM-001', usage: 'Stok: 2 Botol', status: 'Cukup' },
{ title: 'Bulu Mata Artisan Pro #202 (Pack 10)', code: 'KOSM-044', usage: 'Stok: 1 Pack', status: 'Perlu Restock' },
{ title: 'Kebaya Pengantin Modern Rose Gold (Size M)', code: 'GAUN-012', usage: 'Disewa tgl 24 Mei', status: 'Disewa' }
]
};
case 'tim':
return {
title: 'Manajemen Tim MUA & Asisten Hairdo',
sub: 'Daftar staf, pembagian komisi per event, dan performa tim studio',
stats: [
{ label: 'Total Staf Studio', value: '5 Orang', color: 'text-[#EC167F]' },
{ label: 'Komisi Bulan Ini', value: 'Rp 4.2Jt', color: 'text-emerald-600' },
{ label: 'Rating Tim', value: '4.95 / 5.0', color: 'text-amber-500' }
],
items: [
{ title: 'Siti Rahma (Hair Stylist Senior)', code: 'STAF-01', usage: 'Komisi 15% / Event', status: 'Standby' },
{ title: 'Dian Permata (Assistant MUA & Hijab Do)', code: 'STAF-02', usage: 'Komisi 10% / Event', status: 'Standby' }
]
};
default:
return {
title: `Modul Fitur: ${menuItem.label}`,
sub: `Kelola semua operasional dan data terpusat untuk kategori ${menuItem.label}`,
stats: [
{ label: 'Status Fitur', value: 'Aktif & Normal', color: 'text-emerald-600' },
{ label: 'Sync Server', value: 'Realtime 100%', color: 'text-blue-600' },
{ label: 'Keamanan Data', value: 'Encrypted', color: 'text-purple-600' }
],
items: [
{ title: `Konfigurasi Utama ${menuItem.label}`, code: `CFG-${activeTab.toUpperCase()}-01`, usage: 'Standar MuaKita', status: 'Aktif' },
{ title: `Laporan & Analisis Data ${menuItem.label}`, code: `REP-${activeTab.toUpperCase()}-02`, usage: 'Update Otomatis', status: 'Aktif' }
]
};
}
};
const details = getFeatureDetails();
return (
<div className="space-y-4 animate-in fade-in duration-200">
{/* Header Banner */}
<div className="bg-white p-4 rounded-2xl border border-slate-200/80 shadow-2xs flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3">
<div className="flex items-center gap-2.5">
<div className="p-2.5 bg-pink-50 text-[#EC167F] rounded-xl font-bold">
<IconComponent className="w-5 h-5" />
</div>
<div>
<div className="flex items-center gap-2">
<h1 className="text-base font-extrabold text-slate-900">{details.title}</h1>
<span className="text-[9px] font-extrabold uppercase px-2 py-0.5 bg-slate-100 text-slate-600 rounded-md">
Route: /{activeTab}
</span>
</div>
<p className="text-xs text-slate-500 mt-0.5">{details.sub}</p>
</div>
</div>
<button
onClick={() => triggerToast(`Memproses tindakan pada modul ${menuItem.label}`)}
className="bg-[#EC167F] hover:bg-[#D41270] text-white text-xs font-bold px-3.5 py-2 rounded-xl shadow-xs transition-all flex items-center justify-center gap-1.5 cursor-pointer shrink-0"
>
<Plus className="w-4 h-4" />
<span>Tambah Item {menuItem.label}</span>
</button>
</div>
{/* Metrics Row */}
<div className="grid grid-cols-1 sm:grid-cols-3 gap-3">
{details.stats.map((st, idx) => (
<div key={idx} className="bg-white p-3.5 rounded-2xl border border-slate-200/80 shadow-2xs">
<p className="text-[11px] font-semibold text-slate-500">{st.label}</p>
<h3 className={`text-xl font-black mt-1 ${st.color}`}>{st.value}</h3>
<span className="text-[10px] font-bold text-slate-400 inline-block mt-1">Terverifikasi sistem</span>
</div>
))}
</div>
{/* Controls Bar */}
<div className="bg-white p-3.5 rounded-2xl border border-slate-200/80 shadow-2xs flex items-center justify-between gap-3">
<div className="relative w-full sm:w-80">
<input
type="text"
placeholder={`Cari dalam ${menuItem.label}...`}
value={searchQuery}
onChange={(e) => setSearchQuery(e.target.value)}
className="w-full pl-8 pr-3 py-1.5 bg-slate-100 border border-slate-200 rounded-xl text-xs focus:bg-white focus:outline-none focus:ring-2 focus:ring-pink-500/20"
/>
<Search className="w-3.5 h-3.5 text-slate-400 absolute left-2.5 top-2.5" />
</div>
<button
onClick={() => triggerToast("Filter data diterapkan")}
className="px-3 py-1.5 bg-slate-100 hover:bg-slate-200 text-slate-700 font-bold text-xs rounded-xl flex items-center gap-1.5 cursor-pointer"
>
<Filter className="w-3.5 h-3.5" />
<span>Filter</span>
</button>
</div>
{/* Interactive List */}
<div className="bg-white rounded-2xl border border-slate-200/80 shadow-2xs overflow-hidden">
<div className="p-3 border-b border-slate-100 flex items-center justify-between">
<h3 className="text-xs font-extrabold text-slate-900">Daftar Component Modul</h3>
<span className="text-[11px] font-bold text-emerald-600 bg-emerald-50 px-2 py-0.5 rounded-full">
Fitur Siap Digunakan
</span>
</div>
<div className="divide-y divide-slate-100">
{details.items
.filter(i => i.title.toLowerCase().includes(searchQuery.toLowerCase()))
.map((item, idx) => (
<div key={idx} className="p-3.5 flex items-center justify-between hover:bg-slate-50/70 transition-colors">
<div className="flex items-center gap-3">
<div className="w-8 h-8 rounded-xl bg-pink-50 text-[#EC167F] font-black text-xs flex items-center justify-center shrink-0">
<CheckCircle2 className="w-4 h-4" />
</div>
<div>
<h4 className="font-extrabold text-xs text-slate-900">{item.title}</h4>
<div className="flex items-center gap-2 mt-0.5 text-[10px] text-slate-400 font-mono">
<span>{item.code}</span> • <span className="text-slate-600 font-sans">{item.usage}</span>
</div>
</div>
</div>
<div className="flex items-center gap-2">
<span className="px-2.5 py-1 bg-slate-100 text-slate-700 text-[10px] font-extrabold rounded-lg">
{item.status}
</span>
<button
onClick={() => triggerToast(`Aksi dijalankan untuk ${item.title}`)}
className="px-3 py-1 bg-[#EC167F] hover:bg-[#D41270] text-white text-[11px] font-bold rounded-lg transition-colors cursor-pointer"
>
Buka
</button>
</div>
</div>
))}
</div>
</div>
</div>
);
};