Add TOTP field support and restructured ItemFieldValues components
This commit is contained in:
14
packages/web/src/components/ItemFieldValue/hooks.ts
Normal file
14
packages/web/src/components/ItemFieldValue/hooks.ts
Normal file
@ -0,0 +1,14 @@
|
||||
import { useCallback } from "react"
|
||||
import { useTranslate } from "../../i18n"
|
||||
import { toast, ToastType } from "../Toast"
|
||||
|
||||
export function useCopy(text: string) {
|
||||
const t = useTranslate()
|
||||
return useCallback(() => {
|
||||
navigator.clipboard.writeText(text)
|
||||
toast({
|
||||
type: ToastType.Secondary,
|
||||
message: t.tips.copied_to_clipboard,
|
||||
})
|
||||
}, [text, t])
|
||||
}
|
Reference in New Issue
Block a user