mirror of
https://github.com/idanoo/autobrr
synced 2025-07-27 02:39:13 +00:00
enhancement(web): mutation improvements and toast updates (#913)
* make notification switch take onToggleMutation Instead of opening it like the edit button, it now enables/disables it directly. * improved toast for update checks * improved toast for download clients it now mentions what client is enabled/disabled * improved irc network toast * added toast when copying apikey * added toast to log download implemented an info variant for the toasts * improved feed toast * improved toast for update checks * Merge branch 'develop' into enhancement/mutation-improvements-toast-updates
This commit is contained in:
parent
96e38e649a
commit
8acf33589d
8 changed files with 68 additions and 20 deletions
|
@ -21,6 +21,9 @@ import { SettingsContext } from "@utils/Context";
|
|||
import { EmptySimple } from "@components/emptystates";
|
||||
import { baseUrl } from "@utils";
|
||||
import { RingResizeSpinner } from "@components/Icons";
|
||||
import { toast } from "react-hot-toast";
|
||||
import Toast from "@components/notifications/Toast";
|
||||
|
||||
|
||||
type LogEvent = {
|
||||
time: string;
|
||||
|
@ -216,6 +219,12 @@ const LogFilesItem = ({ file }: LogFilesItemProps) => {
|
|||
|
||||
const handleDownload = async () => {
|
||||
setIsDownloading(true);
|
||||
|
||||
// Add a custom toast before the download starts
|
||||
const toastId = toast.custom((t) => (
|
||||
<Toast type="info" body="Log file is being sanitized. Please wait..." t={t} />
|
||||
));
|
||||
|
||||
const response = await fetch(`${baseUrl()}api/logs/files/${file.filename}`);
|
||||
const blob = await response.blob();
|
||||
const url = URL.createObjectURL(blob);
|
||||
|
@ -224,6 +233,10 @@ const LogFilesItem = ({ file }: LogFilesItemProps) => {
|
|||
link.download = file.filename;
|
||||
link.click();
|
||||
URL.revokeObjectURL(url);
|
||||
|
||||
// Dismiss the custom toast after the download is complete
|
||||
toast.dismiss(toastId);
|
||||
|
||||
setIsDownloading(false);
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue