Skip to content
This repository has been archived by the owner on Nov 18, 2024. It is now read-only.

Commit

Permalink
display modify ressource only if owner
Browse files Browse the repository at this point in the history
  • Loading branch information
khylpe committed Apr 25, 2024
1 parent 5510ecf commit 6121858
Showing 1 changed file with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import React, { useState } from 'react';
import { Avatar, Collapse, Popover, Tag, Typography, Button, message, Skeleton, Popconfirm, Badge, Card, Empty } from 'antd';
import { Collapse, Tag, Typography, Button, Badge, Card, Empty } from 'antd';
import Ressource from '@/types/ressource';
import { Icon } from '@iconify/react';
const { Title, Text, Paragraph } = Typography;
import axios, { AxiosError } from 'axios';
const { Text, Paragraph } = Typography;
import Link from 'next/link';
import { useUser } from '@/providers/userProvider';

export default function ListOfRessourcesAccordion({ ressources, refreshRessources }: { ressources: Ressource[], refreshRessources: Function }) {
const [loading, setLoading] = useState(false); // Used for loading state of buttons, but the global loading of the list is handle throught the parent component from the refreshRessources function
const { user } = useUser();

if (ressources.length === 0) {
return (
<Card style={{backgroundColor: "#f5f5f5"}}>
<Card style={{ backgroundColor: "#f5f5f5" }}>
<Empty></Empty>
</Card>
)
Expand Down Expand Up @@ -48,11 +50,13 @@ export default function ListOfRessourcesAccordion({ ressources, refreshRessource
</div>
</Badge.Ribbon>
)}
<div className="flex flex-row justify-end">
<Link href={`/editer-ressource/${ressource.id}`}>
<Button className='w-fit' type='primary'>Apporter des modifications</Button>
</Link>
</div>
{(ressource.user?.id === user?.id) && (
<div className="flex flex-row justify-end">
<Link href={`/editer-ressource/${ressource.id}`}>
<Button className='w-fit' type='primary'>Apporter des modifications</Button>
</Link>
</div>)
}
</div>
</>
),
Expand Down

0 comments on commit 6121858

Please sign in to comment.