1 // This file can be used for constants and utility functions related to repair data
2
3 export const DEVICE_TYPES = {
4 LAPTOP: "laptop",
5 DESKTOP: "desktop",
6 } as const;
7
8 export const CATEGORIES = {
9 HARDWARE: "hardware",
10 SOFTWARE: "software",
11 CLEANING: "cleaning",
12 UPGRADES: "upgrades",
13 } as const;
14
15 export const DIFFICULTY_LEVELS = {
16 EASY: "easy",
17 MEDIUM: "medium",
18 HARD: "hard",
19 } as const;
20
21 export const TROUBLESHOOTING_TYPES = {
22 POWER: "power",
23 PERFORMANCE: "performance",
24 DISPLAY: "display",
25 } as const;
26
27 export const getDifficultyColor = (difficulty: string) => {
28 switch (difficulty) {
29 case DIFFICULTY_LEVELS.EASY:
30 return "bg-success-50 text-success-600";
31 case DIFFICULTY_LEVELS.MEDIUM:
32 return "bg-warning-50 text-warning-700";
33 case DIFFICULTY_LEVELS.HARD:
34 return "bg-danger-50 text-danger-700";
35 default:
36 return "bg-gray-50 text-gray-600";
37 }
38 };
39
40 export const formatViewCount = (count: number) => {
41 if (count >= 1000) {
42 return `${(count / 1000).toFixed(1)}k`;
43 }
44 return count.toString();
45 };
46
47 export const getCategoryIcon = (category: string) => {
48 switch (category) {
49 case CATEGORIES.HARDWARE:
50 return "memory";
51 case CATEGORIES.SOFTWARE:
52 return "code";
53 case CATEGORIES.CLEANING:
54 return "cleaning_services";
55 case CATEGORIES.UPGRADES:
56 return "upgrade";
57 default:
58 return "build";
59 }
60 };
61
62 export const getCategoryColor = (category: string) => {
63 switch (category) {
64 case CATEGORIES.HARDWARE:
65 return "text-primary-700";
66 case CATEGORIES.SOFTWARE:
67 return "text-success-600";
68 case CATEGORIES.CLEANING:
69 return "text-warning-700";
70 case CATEGORIES.UPGRADES:
71 return "text-purple-600";
72 default:
73 return "text-gray-600";
74 }
75 };