From 06bbfe06fb20fc30d443ff3cb37c5270f8c2c2e3 Mon Sep 17 00:00:00 2001 From: Shaily Mishra Date: Tue, 21 Jul 2026 18:59:27 +0530 Subject: [PATCH] Constant data is added and resuable tabs added --- components/dashboard/equipment.tsx | 37 ++++++-------------- components/dashboard/helpDesk.tsx | 5 +-- components/dashboard/propertyManager.tsx | 4 ++- components/dashboard/request.tsx | 42 +++++----------------- constants/constant.ts | 30 ++++++++++++++++ constants/types.ts | 26 ++++++++++++++ utils/button.tsx | 9 ++--- utils/roundedFilters.tsx | 44 ++++++++++++++++++++++++ utils/table.tsx | 31 ++--------------- utils/tabs.tsx | 11 ++---- 10 files changed, 133 insertions(+), 106 deletions(-) create mode 100644 utils/roundedFilters.tsx diff --git a/components/dashboard/equipment.tsx b/components/dashboard/equipment.tsx index a4196b7..6db7d23 100644 --- a/components/dashboard/equipment.tsx +++ b/components/dashboard/equipment.tsx @@ -13,19 +13,13 @@ import { import Button from "@/utils/button"; import StatCard from "@/utils/dashStatCard"; import LocationTable from '../../utils/table'; +import NavigationTabs from '@/utils/tabs'; +import { equipmentTabs } from '@/constants/constant'; export default function EquipmentPortal() { const [activeTab, setActiveTab] = useState('Site-Wise Equipment'); - const tabs: string[] = [ - 'Equipment Groups', - 'Site-Wise Equipment', - 'PPM Checklist', - 'AMC Checklist', - 'PPM Schedule', - 'AMC Schedule', - 'Maintenance Calendar' - ]; + return (
@@ -49,23 +43,14 @@ export default function EquipmentPortal() {
- {/* --- NAVIGATION TABS --- */} -
- {tabs.map((tab) => ( - - ))} -
- + + {/* Navigation Tabs */} + {/* --- STAT CARDS --- */}
{/* Total Equipment */} diff --git a/components/dashboard/helpDesk.tsx b/components/dashboard/helpDesk.tsx index 8d08ee1..823c403 100644 --- a/components/dashboard/helpDesk.tsx +++ b/components/dashboard/helpDesk.tsx @@ -14,12 +14,13 @@ import Button from "@/utils/button"; import StatCard from "@/utils/dashStatCard"; import LocationTable from '../../utils/table'; import NavigationTabs from '@/utils/tabs'; +import { helpdeskTtabs } from '@/constants/constant'; export default function HelpDeskPortal() { const [activeTab, setActiveTab] = useState('Location'); - const tabs: string[] = ['Location', 'Technical', 'Missed', 'Departments', 'HSQE']; + return (
@@ -45,7 +46,7 @@ export default function HelpDeskPortal() {
{/* Reusable Navigation Tabs */} ('TFM Requests'); @@ -11,14 +12,7 @@ export default function ServiceRequestsPortal() { - const statusFilters = [ - { label: 'All', count: 18 }, - { label: 'Registered', count: 4 }, - { label: 'Assigned', count: 3 }, - { label: 'Working', count: 4 }, - { label: 'Completed', count: 3 }, - { label: 'Overdue', count: 4 }, - ]; + return (
@@ -65,31 +59,11 @@ export default function ServiceRequestsPortal() {
{/* --- STATUS PILL FILTERS --- */} -
- {statusFilters.map((filter) => { - const isActive = activeFilter === filter.label; - return ( - - ); - })} -
+
); diff --git a/constants/constant.ts b/constants/constant.ts index b7361d7..ea88dc8 100644 --- a/constants/constant.ts +++ b/constants/constant.ts @@ -1,3 +1,5 @@ + + import { TableRowData } from '@/constants/types'; import { LayoutGrid, Smile, @@ -202,4 +204,32 @@ export const Reqeusttabs: string[] = [ 'TFM Requests', 'Engineering', 'Schedule Complaints' + ]; + + export const statusFilters = [ + { label: 'All', count: 18 }, + { label: 'Registered', count: 4 }, + { label: 'Assigned', count: 3 }, + { label: 'Working', count: 4 }, + { label: 'Completed', count: 3 }, + { label: 'Overdue', count: 4 }, + ]; + + + + // Data model interface + + + // Sample data extracted from your screenshot + export const mockData: TableRowData[] = [ + { id: '1', block: 'Block 1', floor: 'G', zone: 'Z2', department: 'Electrical', location: 'Main lobby', window: '06:00–17:30', tat: '60m', sched: 8, approval: true, status: 'INACTIVE' }, + { id: '2', block: 'Block 2', floor: '3', zone: 'Z2', department: 'Electrical', location: 'Main lobby', window: '08:00–23:59', tat: '30m', sched: 4, approval: false, status: 'ACTIVE' }, + { id: '3', block: 'Block 2', floor: '3', zone: 'Z1', department: 'Inspection work', location: 'Cafeteria', window: '06:00–17:30', tat: '20m', sched: 8, approval: true, status: 'ACTIVE' }, + { id: '4', block: 'Block 1', floor: 'G', zone: 'Z1', department: 'HVAC', location: 'Server room', window: '08:00–18:00', tat: '30m', sched: 4, approval: false, status: 'INACTIVE' }, + { id: '5', block: 'Block 2', floor: '3', zone: 'N', department: 'Inspection work', location: 'Server room', window: '08:00–18:00', tat: '60m', sched: 8, approval: true, status: 'ACTIVE' }, + { id: '6', block: 'Block 2', floor: 'G', zone: 'Z1', department: 'Electrical', location: 'Reception', window: '06:00–18:00', tat: '60m', sched: 6, approval: false, status: 'ACTIVE' }, + { id: '7', block: 'Block 1', floor: 'G', zone: 'Z2', department: 'Electrical', location: 'Food court', window: '06:00–17:30', tat: '60m', sched: 8, approval: true, status: 'ACTIVE' }, + { id: '8', block: 'Block 2', floor: '3', zone: 'Z2', department: 'Electrical', location: 'Cafeteria', window: '08:00–23:59', tat: '30m', sched: 4, approval: false, status: 'ACTIVE' }, + { id: '9', block: 'Block 2', floor: '3', zone: 'Z1', department: 'Inspection work', location: 'Gym', window: '06:00–17:30', tat: '20m', sched: 8, approval: true, status: 'INACTIVE' }, + { id: '10', block: 'Block 1', floor: 'G', zone: 'Z1', department: 'HVAC', location: 'Lobby', window: '08:00–18:00', tat: '30m', sched: 4, approval: false, status: 'ACTIVE' }, ]; \ No newline at end of file diff --git a/constants/types.ts b/constants/types.ts index bc019c1..1c6d66f 100644 --- a/constants/types.ts +++ b/constants/types.ts @@ -17,6 +17,12 @@ export interface AuthLayoutProps { onForgotPassword?:()=>void; item?: any; } +export interface ButtonProps { + children: React.ReactNode; + onClick?: () => void; + className?: string; +} + export interface FormProps { label: string; value?: string; @@ -71,6 +77,26 @@ export interface StatusProgressProps { barColor?: string; } + +export interface NavigationTabsProps { + tabs: string[]; + activeTab: string; + onTabChange: (tab: string) => void; + className?: string; +} + + +export interface FilterItem { + label: string; + count?: number | string; +} + +export interface FilterTabsProps { + options: FilterItem[]; + activeFilter: string; + onChange: (label: string) => void; + className?: string; +} // For footer banner export interface InfoBannerProps { boldText?: string; diff --git a/utils/button.tsx b/utils/button.tsx index 62c03db..dd22ded 100644 --- a/utils/button.tsx +++ b/utils/button.tsx @@ -1,14 +1,11 @@ -interface Props { - children: React.ReactNode; - onClick?: () => void; - className?: string; -} +import { ButtonProps } from "@/constants/types"; + export default function Button({ children, onClick, className, -}: Props) { +}: ButtonProps) { return ( + ); + })} +
+ ); +} \ No newline at end of file diff --git a/utils/table.tsx b/utils/table.tsx index c5c7a0b..748462f 100644 --- a/utils/table.tsx +++ b/utils/table.tsx @@ -1,4 +1,4 @@ -import React, { useState } from 'react'; +import { useState } from 'react'; import { Pencil, Menu, @@ -8,35 +8,8 @@ import { Check, Sparkles, } from 'lucide-react'; +import { mockData } from '@/constants/constant'; -// Data model interface -interface TableRowData { - id: string; - block: string; - floor: string; - zone: string; - department: string; - location: string; - window: string; - tat: string; - sched: number; - approval: boolean; - status: 'ACTIVE' | 'INACTIVE'; -} - -// Sample data extracted from your screenshot -const mockData: TableRowData[] = [ - { id: '1', block: 'Block 1', floor: 'G', zone: 'Z2', department: 'Electrical', location: 'Main lobby', window: '06:00–17:30', tat: '60m', sched: 8, approval: true, status: 'INACTIVE' }, - { id: '2', block: 'Block 2', floor: '3', zone: 'Z2', department: 'Electrical', location: 'Main lobby', window: '08:00–23:59', tat: '30m', sched: 4, approval: false, status: 'ACTIVE' }, - { id: '3', block: 'Block 2', floor: '3', zone: 'Z1', department: 'Inspection work', location: 'Cafeteria', window: '06:00–17:30', tat: '20m', sched: 8, approval: true, status: 'ACTIVE' }, - { id: '4', block: 'Block 1', floor: 'G', zone: 'Z1', department: 'HVAC', location: 'Server room', window: '08:00–18:00', tat: '30m', sched: 4, approval: false, status: 'INACTIVE' }, - { id: '5', block: 'Block 2', floor: '3', zone: 'N', department: 'Inspection work', location: 'Server room', window: '08:00–18:00', tat: '60m', sched: 8, approval: true, status: 'ACTIVE' }, - { id: '6', block: 'Block 2', floor: 'G', zone: 'Z1', department: 'Electrical', location: 'Reception', window: '06:00–18:00', tat: '60m', sched: 6, approval: false, status: 'ACTIVE' }, - { id: '7', block: 'Block 1', floor: 'G', zone: 'Z2', department: 'Electrical', location: 'Food court', window: '06:00–17:30', tat: '60m', sched: 8, approval: true, status: 'ACTIVE' }, - { id: '8', block: 'Block 2', floor: '3', zone: 'Z2', department: 'Electrical', location: 'Cafeteria', window: '08:00–23:59', tat: '30m', sched: 4, approval: false, status: 'ACTIVE' }, - { id: '9', block: 'Block 2', floor: '3', zone: 'Z1', department: 'Inspection work', location: 'Gym', window: '06:00–17:30', tat: '20m', sched: 8, approval: true, status: 'INACTIVE' }, - { id: '10', block: 'Block 1', floor: 'G', zone: 'Z1', department: 'HVAC', location: 'Lobby', window: '08:00–18:00', tat: '30m', sched: 4, approval: false, status: 'ACTIVE' }, -]; export default function LocationTable(){ const [selectedIds, setSelectedIds] = useState(['1']); // Row 1 selected by default (teal indicator bar) diff --git a/utils/tabs.tsx b/utils/tabs.tsx index 19d6cc9..112bdd1 100644 --- a/utils/tabs.tsx +++ b/utils/tabs.tsx @@ -1,12 +1,7 @@ -// @/utils/NavigationTabs.tsx -import React from 'react'; +import { NavigationTabsProps } from "@/constants/types"; + + -interface NavigationTabsProps { - tabs: string[]; - activeTab: string; - onTabChange: (tab: string) => void; - className?: string; -} export default function NavigationTabs({ tabs,