Remove useToast everywhere

This commit is contained in:
Gregory Schier
2025-01-06 12:21:21 -08:00
parent ab55c2e0ce
commit 806a8eb801
14 changed files with 58 additions and 84 deletions

View File

@@ -1,10 +1,8 @@
import { clear, writeText } from '@tauri-apps/plugin-clipboard-manager';
import { useCallback } from 'react';
import { useToast } from './useToast';
import { showToast } from '../lib/toast';
export function useCopy({ disableToast }: { disableToast?: boolean } = {}) {
const toast = useToast();
const copy = useCallback(
(text: string | null) => {
if (text == null) {
@@ -13,7 +11,7 @@ export function useCopy({ disableToast }: { disableToast?: boolean } = {}) {
writeText(text).catch(console.error);
}
if (text != '' && !disableToast) {
toast.show({
showToast({
id: 'copied',
color: 'secondary',
icon: 'copy',
@@ -21,7 +19,7 @@ export function useCopy({ disableToast }: { disableToast?: boolean } = {}) {
});
}
},
[disableToast, toast],
[disableToast],
);
return copy;