mirror of
https://github.com/soconnor0919/hristudio.git
synced 2025-12-11 22:54:45 -05:00
Implement permissions on participants page
This commit is contained in:
@@ -20,6 +20,7 @@ import {
|
|||||||
SelectTrigger,
|
SelectTrigger,
|
||||||
SelectValue
|
SelectValue
|
||||||
} from "~/components/ui/select";
|
} from "~/components/ui/select";
|
||||||
|
import { usePermissions } from "~/hooks/usePermissions";
|
||||||
|
|
||||||
interface Study {
|
interface Study {
|
||||||
id: number;
|
id: number;
|
||||||
@@ -38,6 +39,7 @@ export default function Participants() {
|
|||||||
const [selectedStudyId, setSelectedStudyId] = useState<number | null>(null);
|
const [selectedStudyId, setSelectedStudyId] = useState<number | null>(null);
|
||||||
const [participantName, setParticipantName] = useState("");
|
const [participantName, setParticipantName] = useState("");
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
|
const { hasPermission } = usePermissions();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
fetchStudies();
|
fetchStudies();
|
||||||
@@ -195,14 +197,16 @@ export default function Participants() {
|
|||||||
Participant ID: {participant.id}
|
Participant ID: {participant.id}
|
||||||
</CardDescription>
|
</CardDescription>
|
||||||
</div>
|
</div>
|
||||||
<Button
|
{hasPermission('DELETE_PARTICIPANT') && (
|
||||||
variant="ghost"
|
<Button
|
||||||
size="icon"
|
variant="ghost"
|
||||||
className="text-destructive"
|
size="icon"
|
||||||
onClick={() => deleteParticipant(participant.id)}
|
className="text-destructive"
|
||||||
>
|
onClick={() => deleteParticipant(participant.id)}
|
||||||
<Trash2Icon className="w-4 h-4" />
|
>
|
||||||
</Button>
|
<Trash2Icon className="w-4 h-4" />
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardFooter className="text-sm text-muted-foreground">
|
<CardFooter className="text-sm text-muted-foreground">
|
||||||
|
|||||||
Reference in New Issue
Block a user