mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-01 06:53:11 +02:00
Remove useToast everywhere
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user