π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
elsewhere
Manav Rathic2959d06b03c
diff --git a/web/packages/accounts/components/CodeBlock.tsx b/web/packages/accounts/components/CodeBlock.tsxindex 7a2f540b05..63fd696064 100644--- a/web/packages/accounts/components/CodeBlock.tsx+++ b/web/packages/accounts/components/CodeBlock.tsx@@ -3,8 +3,9 @@ import DoneIcon from "@mui/icons-material/Done";import { Box, IconButton, Tooltip, Typography } from "@mui/material";import { CenteredRow } from "ente-base/components/containers";import { ActivityIndicator } from "ente-base/components/mui/ActivityIndicator";+import { useClipboardCopy } from "ente-base/components/utils/hooks";import { t } from "i18next";-import React, { useState } from "react";+import React from "react";interface CodeBlockProps {/**@@ -62,13 +63,7 @@ interface CopyButtonProps {}export const CopyButton: React.FC<CopyButtonProps> = ({ code }) => {- const [copied, setCopied] = useState(false);-- const handleClick = () =>- void navigator.clipboard.writeText(code).then(() => {- setCopied(true);- setTimeout(() => setCopied(false), 1000);- });+ const [copied, handleClick] = useClipboardCopy(code);const Icon = copied ? DoneIcon : ContentCopyIcon;diff --git a/web/packages/gallery/components/FileInfoComponents.tsx b/web/packages/gallery/components/FileInfoComponents.tsxindex 367611c037..f6d1d05efb 100644--- a/web/packages/gallery/components/FileInfoComponents.tsx+++ b/web/packages/gallery/components/FileInfoComponents.tsx@@ -1,8 +1,8 @@import ContentCopyIcon from "@mui/icons-material/ContentCopy";import DoneIcon from "@mui/icons-material/Done";import { IconButton, Tooltip, type SvgIconProps } from "@mui/material";+import { useClipboardCopy } from "ente-base/components/utils/hooks";import { t } from "i18next";-import { useState } from "react";interface CopyButtonProps {/**@@ -16,13 +16,7 @@ interface CopyButtonProps {}export const CopyButton: React.FC<CopyButtonProps> = ({ text, size }) => {- const [copied, setCopied] = useState(false);-- const handleClick = () =>- void navigator.clipboard.writeText(text).then(() => {- setCopied(true);- setTimeout(() => setCopied(false), 1000);- });+ const [copied, handleClick] = useClipboardCopy(text);const Icon = copied ? DoneIcon : ContentCopyIcon;