pmtool / src /lib /data.ts
devarshia5's picture
Upload 487 files
d97b8f9 verified
Raw
History Blame Contribute Delete
12.1 kB
import { DashboardStats, Issue, Project, Task, Team, User } from "@/types";
export const mockUsers: User[] = [
{
id: "u1",
name: "John Smith",
email: "john.smith@example.com",
role: "CEO",
avatar: "https://ui-avatars.com/api/?name=John+Smith&background=random",
},
{
id: "u2",
name: "Emily Johnson",
email: "emily.johnson@example.com",
role: "COO",
avatar: "https://ui-avatars.com/api/?name=Emily+Johnson&background=random",
},
{
id: "u3",
name: "Michael Brown",
email: "michael.brown@example.com",
role: "Project Manager",
avatar: "https://ui-avatars.com/api/?name=Michael+Brown&background=random",
},
{
id: "u4",
name: "Sarah Davis",
email: "sarah.davis@example.com",
role: "Account Manager",
avatar: "https://ui-avatars.com/api/?name=Sarah+Davis&background=random",
},
{
id: "u5",
name: "David Wilson",
email: "david.wilson@example.com",
role: "Tech Lead",
avatar: "https://ui-avatars.com/api/?name=David+Wilson&background=random",
},
{
id: "u6",
name: "Jessica Miller",
email: "jessica.miller@example.com",
role: "Senior Developer",
avatar: "https://ui-avatars.com/api/?name=Jessica+Miller&background=random",
},
{
id: "u7",
name: "Thomas Moore",
email: "thomas.moore@example.com",
role: "Developer",
avatar: "https://ui-avatars.com/api/?name=Thomas+Moore&background=random",
},
{
id: "u8",
name: "Patricia Taylor",
email: "patricia.taylor@example.com",
role: "Testing Manager",
avatar: "https://ui-avatars.com/api/?name=Patricia+Taylor&background=random",
},
{
id: "u9",
name: "Daniel Anderson",
email: "daniel.anderson@example.com",
role: "Senior Tester",
avatar: "https://ui-avatars.com/api/?name=Daniel+Anderson&background=random",
},
{
id: "u10",
name: "Jennifer Thomas",
email: "jennifer.thomas@example.com",
role: "Tester",
avatar: "https://ui-avatars.com/api/?name=Jennifer+Thomas&background=random",
},
];
export const mockProjects: Project[] = [
{
id: "p1",
name: "Office Management",
description: "Office management software development",
status: "Active",
progress: 65,
startDate: "2023-04-01",
endDate: "2023-07-15",
teamId: "t1",
leadId: "u3",
},
{
id: "p2",
name: "Hospital Administration",
description: "Hospital administration system",
status: "Active",
progress: 40,
startDate: "2023-04-01",
endDate: "2023-07-15",
teamId: "t2",
leadId: "u3",
},
{
id: "p3",
name: "Project Management",
description: "Project management tool development",
status: "Active",
progress: 25,
startDate: "2023-07-01",
endDate: "2023-10-15",
teamId: "t3",
leadId: "u5",
},
{
id: "p4",
name: "Video Calling App",
description: "Video conferencing solution",
status: "Active",
progress: 15,
startDate: "2023-08-01",
endDate: "2023-11-30",
teamId: "t4",
leadId: "u5",
},
{
id: "p5",
name: "Digital Marketplace",
description: "Online marketplace platform",
status: "Active",
progress: 5,
startDate: "2023-09-01",
endDate: "2024-01-15",
teamId: "t5",
leadId: "u3",
},
];
export const mockTeams: Team[] = [
{
id: "t1",
name: "Core Development",
members: ["u3", "u5", "u6", "u7", "u8"],
leadId: "u5",
projectIds: ["p1"],
},
{
id: "t2",
name: "Healthcare Solutions",
members: ["u3", "u4", "u6", "u9", "u10"],
leadId: "u4",
projectIds: ["p2"],
},
{
id: "t3",
name: "Product Team",
members: ["u3", "u5", "u7", "u8", "u9"],
leadId: "u5",
projectIds: ["p3"],
},
{
id: "t4",
name: "Communication Tech",
members: ["u4", "u5", "u6", "u7", "u10"],
leadId: "u5",
projectIds: ["p4"],
},
{
id: "t5",
name: "E-commerce Solutions",
members: ["u3", "u4", "u6", "u8", "u9"],
leadId: "u3",
projectIds: ["p5"],
},
];
export const mockIssues: Issue[] = [
{
id: "i1",
title: "Login button not working",
description: "Users cannot login using the login button on the homepage",
projectId: "p1",
assigneeId: "u7",
reporterId: "u8",
priority: "High",
status: "In Progress",
type: "Bug",
createdAt: "2023-05-10T10:30:00Z",
updatedAt: "2023-05-10T14:20:00Z",
},
{
id: "i2",
title: "API timeout",
description: "The API is timing out when fetching large datasets",
projectId: "p1",
assigneeId: "u6",
reporterId: "u9",
priority: "Critical",
status: "In Progress",
type: "Bug",
createdAt: "2023-05-11T09:15:00Z",
updatedAt: "2023-05-11T13:45:00Z",
},
{
id: "i3",
title: "UI misalign",
description: "UI elements are misaligned on mobile devices",
projectId: "p2",
assigneeId: "u6",
reporterId: "u9",
priority: "Medium",
status: "New",
type: "Bug",
createdAt: "2023-05-12T11:20:00Z",
updatedAt: "2023-05-12T11:20:00Z",
},
{
id: "i4",
title: "Dark mode support",
description: "Implement dark mode for better user experience",
projectId: "p3",
assigneeId: "u7",
reporterId: "u5",
priority: "Low",
status: "New",
type: "Feature",
createdAt: "2023-05-13T14:10:00Z",
updatedAt: "2023-05-13T14:10:00Z",
},
{
id: "i5",
title: "Multi-language UI",
description: "Add support for multiple languages in the UI",
projectId: "p4",
assigneeId: "u6",
reporterId: "u3",
priority: "Medium",
status: "New",
type: "Feature",
createdAt: "2023-05-14T10:05:00Z",
updatedAt: "2023-05-14T10:05:00Z",
},
{
id: "i6",
title: "Notification panel",
description: "Create a notification panel for real-time updates",
projectId: "p5",
assigneeId: "u7",
reporterId: "u3",
priority: "Medium",
status: "New",
type: "Feature",
createdAt: "2023-05-15T09:30:00Z",
updatedAt: "2023-05-15T09:30:00Z",
},
{
id: "i7",
title: "Advanced search",
description: "Implement advanced search functionality",
projectId: "p5",
assigneeId: "u6",
reporterId: "u4",
priority: "Low",
status: "New",
type: "Feature",
createdAt: "2023-05-16T13:45:00Z",
updatedAt: "2023-05-16T13:45:00Z",
},
];
export const mockTasks: Task[] = [
{
id: "t1",
title: "Fix login button",
description: "Investigate and fix login button not working issue",
issueId: "i1",
assigneeId: "u7",
status: "In Progress",
priority: "High",
dueDate: "2023-05-17",
createdAt: "2023-05-10T14:20:00Z",
updatedAt: "2023-05-10T14:20:00Z",
},
{
id: "t2",
title: "Optimize API endpoints",
description: "Improve API performance and fix timeout issues",
issueId: "i2",
assigneeId: "u6",
status: "In Progress",
priority: "Critical",
dueDate: "2023-05-18",
createdAt: "2023-05-11T13:45:00Z",
updatedAt: "2023-05-11T13:45:00Z",
},
{
id: "t3",
title: "Responsive design fixes",
description: "Fix UI misalignment issues on mobile devices",
issueId: "i3",
assigneeId: "u6",
status: "New",
priority: "Medium",
dueDate: "2023-05-19",
createdAt: "2023-05-12T11:20:00Z",
updatedAt: "2023-05-12T11:20:00Z",
},
{
id: "t4",
title: "Dark mode implementation",
description: "Create dark mode theme and toggle",
issueId: "i4",
assigneeId: "u7",
status: "New",
priority: "Low",
dueDate: "2023-05-20",
createdAt: "2023-05-13T14:10:00Z",
updatedAt: "2023-05-13T14:10:00Z",
},
{
id: "t5",
title: "UI localization",
description: "Set up language switcher and translate UI elements",
issueId: "i5",
assigneeId: "u6",
status: "New",
priority: "Medium",
dueDate: "2023-05-21",
createdAt: "2023-05-14T10:05:00Z",
updatedAt: "2023-05-14T10:05:00Z",
},
{
id: "t6",
title: "Notification UI design",
description: "Design notification panel UI components",
issueId: "i6",
assigneeId: "u7",
status: "New",
priority: "Medium",
dueDate: "2023-05-22",
createdAt: "2023-05-15T09:30:00Z",
updatedAt: "2023-05-15T09:30:00Z",
},
{
id: "t7",
title: "Search algorithm",
description: "Develop advanced search algorithm and indexing",
issueId: "i7",
assigneeId: "u6",
status: "New",
priority: "Low",
dueDate: "2023-05-23",
createdAt: "2023-05-16T13:45:00Z",
updatedAt: "2023-05-16T13:45:00Z",
},
];
export const mockDashboardStats: DashboardStats = {
projects: 112,
employees: 218,
tasks: 37,
clients: 44,
revenue: 142500,
expenses: 58500,
profit: 84000,
completedTasks: 156,
pendingTasks: 32,
inProgressTasks: 75,
onHoldTasks: 21,
reviewTasks: 5,
};
export const mockRevenueData = [
{ name: "2018", value: 150000, color: "#F97316" },
{ name: "2019", value: 160000, color: "#F97316" },
{ name: "2020", value: 130000, color: "#F97316" },
{ name: "2021", value: 170000, color: "#F97316" },
{ name: "2022", value: 150000, color: "#F97316" },
{ name: "2023", value: 190000, color: "#F97316" },
];
export const mockSalesData = [
{ name: "00:00", value: 50, color: "#E53E3E" },
{ name: "03:00", value: 80, color: "#E53E3E" },
{ name: "06:00", value: 45, color: "#E53E3E" },
{ name: "09:00", value: 60, color: "#E53E3E" },
{ name: "12:00", value: 75, color: "#E53E3E" },
{ name: "15:00", value: 55, color: "#E53E3E" },
{ name: "18:00", value: 70, color: "#E53E3E" },
{ name: "21:00", value: 90, color: "#E53E3E" },
{ name: "00:00", value: 40, color: "#F97316" },
{ name: "03:00", value: 60, color: "#F97316" },
{ name: "06:00", value: 75, color: "#F97316" },
{ name: "09:00", value: 45, color: "#F97316" },
{ name: "12:00", value: 55, color: "#F97316" },
{ name: "15:00", value: 70, color: "#F97316" },
{ name: "18:00", value: 45, color: "#F97316" },
{ name: "21:00", value: 85, color: "#F97316" },
];
export function getUserById(id: string): User | undefined {
return mockUsers.find(user => user.id === id);
}
export function getProjectById(id: string): Project | undefined {
return mockProjects.find(project => project.id === id);
}
export function getTeamById(id: string): Team | undefined {
return mockTeams.find(team => team.id === id);
}
export function getIssueById(id: string): Issue | undefined {
return mockIssues.find(issue => issue.id === id);
}
export function getTaskById(id: string): Task | undefined {
return mockTasks.find(task => task.id === id);
}
export function getUsersByTeamId(teamId: string): User[] {
const team = mockTeams.find(t => t.id === teamId);
if (!team) return [];
return team.members.map(userId => getUserById(userId)).filter(Boolean) as User[];
}
export function getProjectsByTeamId(teamId: string): Project[] {
return mockProjects.filter(project => project.teamId === teamId);
}
export function getIssuesByProjectId(projectId: string): Issue[] {
return mockIssues.filter(issue => issue.projectId === projectId);
}
export function getTasksByIssueId(issueId: string): Task[] {
return mockTasks.filter(task => task.issueId === issueId);
}
export function getTasksByAssigneeId(assigneeId: string): Task[] {
return mockTasks.filter(task => task.assigneeId === assigneeId);
}
export function getProjectsByLeadId(leadId: string): Project[] {
return mockProjects.filter(project => project.leadId === leadId);
}
export function getTeamsByUserId(userId: string): Team[] {
return mockTeams.filter(team => team.members.includes(userId));
}