Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions frontend/react-app/src/components/LockUnlockTask.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { useState } from 'react';
import { lockTask, unlockTask } from '../api/adminApi';
import { Lock, LockOpen } from 'lucide-react';
import "../css/MyTasks.css";

function LockUnlockTask({ initialIsLocked, taskId }) {
const [isLocked, setIsLocked] = useState(initialIsLocked);
Expand All @@ -23,8 +25,14 @@ function LockUnlockTask({ initialIsLocked, taskId }) {
};

return (
<button onClick={handleLockUnlock}>
{isLocked ? '🔒' : '🔓'}
<button onClick={handleLockUnlock} className={`lock-task-btn ${isLocked ? "locked" : "unlocked"}`}>
{isLocked ?
(
<Lock size={20}/>
) : (
<LockOpen size={20}/>
)
}
</button>
);
}
Expand Down
19 changes: 19 additions & 0 deletions frontend/react-app/src/css/MyTasks.css
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,25 @@ div.flexbox{
border-radius: 10px;
}

.lock-task-btn {
background-color: #3b3355;
color: white;
border: none;
padding: 4% 8%;
text-align: center;
font-size: 13px;
cursor: pointer;
border-radius: 10px;
}

.locked {
background-color: red;
}

.unlocked {
background-color: green;
}

.pageContainer {
width: 100%;
}
Expand Down
9 changes: 6 additions & 3 deletions frontend/react-app/src/pages/MyTasks.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ import { getAssignedTasks } from "../api/teamMemberApi";
import { useCookies } from 'react-cookie';
import { useState, useEffect } from 'react';
import LockUnlockTask from "../components/LockUnlockTask";


import { Lock, LockOpen } from 'lucide-react';

function getAssigneesNames(taskItem) {
return taskItem.assignedMembers.map((member) => member.userName).join(", ");
Expand Down Expand Up @@ -125,7 +124,11 @@ const headerAndAccessors = [
return isAdmin ? (
<LockUnlockTask initialIsLocked={isLocked} taskId={original.row.original.id} />
) : (
isLocked ? '🔒' : '🔓'
isLocked ? (
<Lock />
) : (
<LockOpen/>
)
);
},
}
Expand Down