mirror of
https://github.com/stonith404/pingvin-share.git
synced 2024-11-05 15:30:14 +01: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 { useEffect, useState } from "react";
|
||||||
import shareService from "../../services/share.service";
|
import shareService from "../../services/share.service";
|
||||||
|
import toast from "../../utils/toast.util";
|
||||||
|
|
||||||
const DownloadAllButton = ({ shareId }: { shareId: string }) => {
|
const DownloadAllButton = ({ shareId }: { shareId: string }) => {
|
||||||
const [isZipReady, setIsZipReady] = useState(false);
|
const [isZipReady, setIsZipReady] = useState(false);
|
||||||
@ -32,21 +33,18 @@ const DownloadAllButton = ({ shareId }: { shareId: string }) => {
|
|||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
if (!isZipReady)
|
|
||||||
return (
|
return (
|
||||||
<Tooltip
|
<Button
|
||||||
position="bottom"
|
variant="outline"
|
||||||
width={220}
|
loading={isLoading}
|
||||||
withArrow
|
onClick={() => {
|
||||||
label="The share is preparing. This can take a few minutes."
|
if (!isZipReady) {
|
||||||
|
toast.error("The share is preparing. Try again in a few minutes.");
|
||||||
|
} else {
|
||||||
|
downloadAll();
|
||||||
|
}
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<Button variant="outline" onClick={downloadAll} disabled>
|
|
||||||
Download all
|
|
||||||
</Button>
|
|
||||||
</Tooltip>
|
|
||||||
);
|
|
||||||
return (
|
|
||||||
<Button variant="outline" loading={isLoading} onClick={downloadAll}>
|
|
||||||
Download all
|
Download all
|
||||||
</Button>
|
</Button>
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user