Skip to content

Commit bf2decd

Browse files
authored
Merge pull request #72 from PentabyteDevAlign/refactor
fix: workload calculation and mobile responsive design
2 parents a0f0a53 + 3291ea1 commit bf2decd

File tree

17 files changed

+593
-556
lines changed

17 files changed

+593
-556
lines changed

AI/src/api/roster.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,12 +240,15 @@ def get_recommendations(request: SkillRequest):
240240
print("Proyek gweh: ", project_count)
241241

242242
if project_count == 0:
243-
project_count_score = 0.0
244-
elif project_count >= 5:
245243
project_count_score = 1.0
244+
elif project_count >= 5:
245+
project_count_score = 0.0
246246
else:
247247
# menurun 0.2 tiap project
248-
project_count_score = project_count * 0.2
248+
project_count_score = 1.0 - (project_count * 0.2)
249+
250+
print("Proyek count score: ", project_count_score)
251+
249252
logs["workload_calculation_time"] += time.time() - start_time
250253

251254
# 3. Embedding vector

Frontend/src/App.jsx

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -40,23 +40,6 @@ function App() {
4040
<>
4141
<Router>
4242
<Routes>
43-
{/* Profile and Change Password */}
44-
<Route
45-
path="/profile"
46-
element={
47-
<ProtectedRoute>
48-
<ProfilePage />
49-
</ProtectedRoute>
50-
}
51-
/>
52-
<Route
53-
path="/change-password"
54-
element={
55-
<ProtectedRoute>
56-
<ChangePasswordPage />
57-
</ProtectedRoute>
58-
}
59-
/>
6043
{/* Halaman Login tanpa layout */}
6144
<Route
6245
path="/login"
@@ -83,6 +66,28 @@ function App() {
8366
}
8467
/>
8568

69+
{/* Profile and Change Password */}
70+
<Route
71+
path="/profile"
72+
element={
73+
<ProtectedRoute>
74+
<AppLayout>
75+
<ProfilePage />
76+
</AppLayout>
77+
</ProtectedRoute>
78+
}
79+
/>
80+
<Route
81+
path="/change-password"
82+
element={
83+
<ProtectedRoute>
84+
<AppLayout>
85+
<ChangePasswordPage />
86+
</AppLayout>
87+
</ProtectedRoute>
88+
}
89+
/>
90+
8691
{/* Halaman dengan layout utama */}
8792
<Route
8893
path="/dashboard"

Frontend/src/components/EmployeeTable.jsx

Lines changed: 35 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,8 @@ export default function EmployeeTable({
3434
}) {
3535
const handleSort = (field) => {
3636
if (sortField === field) {
37-
// toggle sort order if same field clicked
3837
setSortOrder((prev) => (prev === "asc" ? "desc" : "asc"));
3938
} else {
40-
// set new field to sort by
4139
setSortField(field);
4240
setSortOrder("asc");
4341
}
@@ -54,32 +52,46 @@ export default function EmployeeTable({
5452
};
5553

5654
return (
57-
<div className="bg-white rounded-lg shadow p-6">
55+
<div className="bg-white rounded-lg shadow p-4 sm:p-6">
5856
{/* Header */}
59-
<div className="flex items-center justify-between mb-4">
60-
<h3 className="text-lg font-semibold">{title}</h3>
61-
<div className="flex gap-3">
57+
<div className="flex flex-col sm:flex-row sm:items-center sm:justify-between mb-4 gap-3">
58+
<h3 className="text-base sm:text-lg font-semibold text-center sm:text-left">
59+
{title}
60+
</h3>
61+
62+
{/* Controls */}
63+
<div className="flex flex-col sm:flex-row gap-3 w-full sm:w-auto">
6264
{/* Sort Select */}
6365
<Select value={sortOrder} onValueChange={setSortOrder}>
64-
<SelectTrigger className="w-[160px] text-sm">
66+
<SelectTrigger className="w-full sm:w-[160px] text-sm cursor-pointer">
6567
<SelectValue placeholder="Sort by Projects" />
6668
</SelectTrigger>
6769
<SelectContent>
68-
<SelectItem value="desc">Most Projects</SelectItem>
69-
<SelectItem value="asc">Least Projects</SelectItem>
70+
<SelectItem value="desc" className="cursor-pointer">
71+
Most Projects
72+
</SelectItem>
73+
<SelectItem value="asc" className="cursor-pointer">
74+
Least Projects
75+
</SelectItem>
7076
</SelectContent>
7177
</Select>
7278

7379
{/* Position Filter */}
7480
<Select value={positionFilter} onValueChange={setPositionFilter}>
75-
<SelectTrigger className="w-[160px] text-sm">
81+
<SelectTrigger className="w-full sm:w-[160px] text-sm cursor-pointer">
7682
<SelectValue placeholder="Filter by Position" />
7783
</SelectTrigger>
7884
<SelectContent>
79-
<SelectItem value="all">All Positions</SelectItem>
85+
<SelectItem value="all" className="cursor-pointer">
86+
All Positions
87+
</SelectItem>
8088
{Array.isArray(positionsList) &&
8189
positionsList.map((p) => (
82-
<SelectItem key={p._id || p.id} value={p._id || p.id}>
90+
<SelectItem
91+
key={p._id || p.id}
92+
value={p._id || p.id}
93+
className="cursor-pointer"
94+
>
8395
{p.name}
8496
</SelectItem>
8597
))}
@@ -94,8 +106,8 @@ export default function EmployeeTable({
94106
No employee data available
95107
</p>
96108
) : (
97-
<div className="rounded-md border">
98-
<Table>
109+
<div className="rounded-md border overflow-x-auto">
110+
<Table className="min-w-[600px]">
99111
<TableHeader>
100112
<TableRow>
101113
<TableHead
@@ -125,14 +137,16 @@ export default function EmployeeTable({
125137
{employees.map((emp, i) => (
126138
<TableRow key={i} className="hover:bg-muted/50">
127139
<TableCell className="flex items-center gap-3 py-3">
128-
<div className="w-10 h-10 rounded-full bg-gradient-to-br from-purple-500 to-pink-500 flex items-center justify-center text-white text-sm font-semibold">
140+
<div className="w-8 h-8 sm:w-10 sm:h-10 rounded-full bg-gradient-to-br from-purple-500 to-pink-500 flex items-center justify-center text-white text-xs sm:text-sm font-semibold">
129141
{emp.name
130142
.split(" ")
131143
.map((n) => n[0])
132144
.join("")
133145
.toUpperCase()}
134146
</div>
135-
<span className="text-sm font-medium">{emp.name}</span>
147+
<span className="text-sm font-medium truncate max-w-[120px] sm:max-w-none">
148+
{emp.name}
149+
</span>
136150
</TableCell>
137151
<TableCell className="text-sm">{emp.position}</TableCell>
138152
<TableCell className="text-sm">{emp.manager}</TableCell>
@@ -154,17 +168,17 @@ export default function EmployeeTable({
154168

155169
{/* Pagination */}
156170
{total > 0 && (
157-
<div className="flex items-center justify-between mt-4 pt-4 border-t">
158-
<p className="text-sm text-muted-foreground">
171+
<div className="flex flex-col sm:flex-row items-center justify-between mt-4 pt-4 border-t gap-3">
172+
<p className="text-xs sm:text-sm text-muted-foreground">
159173
Page {pageIndex + 1} of {Math.ceil(total / pageSize)}
160174
</p>
161-
<div className="flex gap-2">
175+
<div className="flex gap-2 w-full sm:w-auto justify-center sm:justify-end">
162176
<Button
163177
variant="outline"
164178
size="sm"
165179
onClick={() => setPageIndex((p) => Math.max(p - 1, 0))}
166180
disabled={pageIndex === 0}
167-
className="cursor-pointer"
181+
className="cursor-pointer w-1/2 sm:w-auto"
168182
>
169183
Previous
170184
</Button>
@@ -177,7 +191,7 @@ export default function EmployeeTable({
177191
)
178192
}
179193
disabled={pageIndex + 1 >= Math.ceil(total / pageSize)}
180-
className="cursor-pointer"
194+
className="cursor-pointer w-1/2 sm:w-auto"
181195
>
182196
Next
183197
</Button>

Frontend/src/components/SkillSelector.jsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { Badge } from "@/components/ui/badge";
1010
import { PlusCircle, Check, X } from "lucide-react";
1111
import { useSkillStore } from "@/store/useSkillStore";
1212
import api from "@/api/axios";
13+
import { toast } from "@/lib/toast";
1314

1415
export function SkillSelector({
1516
selectedSkills,
@@ -70,6 +71,9 @@ export function SkillSelector({
7071
setOpen(false);
7172
} catch (error) {
7273
console.error("Error adding skill:", error);
74+
toast(error.response.data.message || "Failed to add new skills", {
75+
type: "error",
76+
});
7377
}
7478
};
7579

Frontend/src/pages/HR/Dashboard.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ export default function HRDashboard() {
198198
: "bg-yellow-100 text-yellow-800";
199199

200200
return (
201-
<div className="min-h-screen bg-gray-50 p-4 lg:p-6">
201+
<div className="min-h-screen pb-24 pt-5 lg:px-5 lg:py-10">
202202
<Loading status={loadingState} fullscreen text={loadingText} />
203203

204204
{/* Header */}

Frontend/src/pages/HR/Employee/AddEmployee.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ export default function AddEmployee() {
203203
}, []);
204204

205205
return (
206-
<div className="min-h-screen lg:p-5">
206+
<div className="min-h-screen pb-24 pt-5 lg:px-5 lg:py-10">
207207
<Loading status={loadingState} fullscreen text={loadingText} />
208208

209209
{/* Header */}

Frontend/src/pages/HR/Employee/EmployeeDetail.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ export default function EmployeeDetail() {
206206
};
207207

208208
return (
209-
<div className="min-h-screen lg:p-5">
209+
<div className="min-h-screen pb-24 pt-5 lg:px-5 lg:py-10">
210210
<Loading status={loadingState} fullscreen text={loadingText} />
211211

212212
{/* Header */}

Frontend/src/pages/HR/Employee/ManageEmployee.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ export default function ManageEmployee() {
541541
</AlertDialog>
542542
)}
543543

544-
<div className="container mx-auto p-6 space-y-6">
544+
<div className="min-h-screen pb-24 pt-5 lg:px-5 lg:py-10 space-y-6">
545545
{/* Header */}
546546
<div className="flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4">
547547
<div>

Frontend/src/pages/PM/Dashboard.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ export default function PMDashboard() {
138138
};
139139

140140
return (
141-
<div className="min-h-screen p-5">
141+
<div className="min-h-screen pb-24 pt-5 lg:px-5 lg:py-10">
142142
<Loading status={loadingState} fullscreen text={loadingText} />
143143

144144
{/* Header */}

Frontend/src/pages/Shared/Inbox.jsx

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -238,30 +238,30 @@ export default function Inbox() {
238238
const totalPages = Math.max(1, Math.ceil(total / perPage));
239239

240240
return (
241-
<div className="h-screen flex flex-col">
241+
<div className="h-screen pb-24 pt-5 lg:px-5 lg:py-10 flex flex-col">
242242
<Loading status={loadingState} fullscreen text={loadingText} />
243243

244244
{/* Header */}
245-
<div className="px-4 lg:px-5 py-6 border-b">
246-
<div className="max-w-7xl mx-auto">
247-
<div className="flex items-center gap-3">
248-
<div className="w-12 h-12 bg-linear-to-br from-slate-800 to-slate-900 rounded-xl flex items-center justify-center">
249-
<InboxIcon className="w-6 h-6 text-white" />
250-
</div>
251-
<div>
252-
<h1 className="text-3xl font-bold text-slate-900">Inbox</h1>
253-
<p className="text-sm text-slate-600">
254-
Manage your notifications and messages
255-
</p>
256-
</div>
245+
<div className="mb-8">
246+
<div className="flex items-center gap-3 mb-2">
247+
<div className="p-3 bg-linear-to-br from-blue-500 to-cyan-500 rounded-xl shadow-lg">
248+
<InboxIcon className="w-6 h-6 text-white" />
249+
</div>
250+
<div>
251+
<h1 className="text-3xl md:text-4xl font-bold text-gray-900">
252+
Inbox
253+
</h1>
254+
<p className="text-gray-600 text-sm mt-1">
255+
Manage your notifications and messages
256+
</p>
257257
</div>
258258
</div>
259259
</div>
260260

261261
{/* Main Content */}
262262
<div className="flex-1 overflow-hidden">
263-
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-6 h-full">
264-
<div className="flex flex-col lg:flex-row gap-6 h-full">
263+
<div className="max-w-7xl mx-auto h-full">
264+
<div className="flex flex-col lg:flex-row gap-6 py-1 h-full">
265265
{/* Left Section: Message List - Hidden on mobile when message is selected */}
266266
<div
267267
className={`lg:w-2/5 xl:w-1/3 flex flex-col bg-white rounded-2xl shadow-sm border border-slate-200/50 overflow-hidden h-[600px] lg:h-full ${

0 commit comments

Comments
 (0)