fix: only completed items can be unpinned. Maybe cross iscon is not the best

This commit is contained in:
Juan Di Toro 2024-03-25 09:02:09 +01:00
parent 4290904143
commit 1cb7afda8f
1 changed files with 15 additions and 1 deletions

View File

@ -78,12 +78,26 @@ export const PinningNetworkBanner = () => {
};
const PinCidItem = ({ item }: { item: PinningStatus }) => {
const { unpin } = usePinning();
return (
<div className="px-4 mb-4">
<div className="flex flex-col items-center rounded-lg py-2 px-4 hover:bg-primary/50 group">
<div className="relative flex flex-col items-center rounded-lg py-2 px-4 hover:bg-primary/50 group">
<div className="flex justify-between items-center w-full">
<span className="font-semibold">{item.id}</span>
<span className="group-hover:hidden">{item.progress}%</span>
{item.status === "completed" ? (
<Button
variant="ghost"
className="absolute top-2 right-2 hidden group-hover:flex rounded-full h-3"
onClick={() =>
unpin({
cid: item.id,
})
}>
<Cross2Icon />
</Button>
) : null}
</div>
<Progress value={item.progress} className="h-2" />
</div>