mirror of
https://github.com/stonith404/pingvin-share.git
synced 2024-09-30 16:40:11 +02:00
feat: replace tooltip with toast
This commit is contained in:
parent
aa5b125367
commit
a33b5b37d9
@ -1,6 +1,7 @@
|
||||
import { Button, Tooltip } from "@mantine/core";
|
||||
import { Button } from "@mantine/core";
|
||||
import { useEffect, useState } from "react";
|
||||
import shareService from "../../services/share.service";
|
||||
import toast from "../../utils/toast.util";
|
||||
|
||||
const DownloadAllButton = ({ shareId }: { shareId: string }) => {
|
||||
const [isZipReady, setIsZipReady] = useState(false);
|
||||
@ -32,21 +33,18 @@ const DownloadAllButton = ({ shareId }: { shareId: string }) => {
|
||||
};
|
||||
}, []);
|
||||
|
||||
if (!isZipReady)
|
||||
return (
|
||||
<Tooltip
|
||||
position="bottom"
|
||||
width={220}
|
||||
withArrow
|
||||
label="The share is preparing. This can take a few minutes."
|
||||
>
|
||||
<Button variant="outline" onClick={downloadAll} disabled>
|
||||
Download all
|
||||
</Button>
|
||||
</Tooltip>
|
||||
);
|
||||
return (
|
||||
<Button variant="outline" loading={isLoading} onClick={downloadAll}>
|
||||
<Button
|
||||
variant="outline"
|
||||
loading={isLoading}
|
||||
onClick={() => {
|
||||
if (!isZipReady) {
|
||||
toast.error("The share is preparing. Try again in a few minutes.");
|
||||
} else {
|
||||
downloadAll();
|
||||
}
|
||||
}}
|
||||
>
|
||||
Download all
|
||||
</Button>
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user