3 min
This commit is contained in:
parent
8604daf6a4
commit
5ff3d7ae16
@ -35,7 +35,7 @@ export const CopyButton = ({ created_at, onCopy, text }: CopyButtonProps) => {
|
|||||||
const now = new Date().getTime();
|
const now = new Date().getTime();
|
||||||
const created = getCreatedTime(created_at);
|
const created = getCreatedTime(created_at);
|
||||||
const diffInMinutes = (now - created) / (1000 * 60);
|
const diffInMinutes = (now - created) / (1000 * 60);
|
||||||
return diffInMinutes < 2;
|
return diffInMinutes < 3;
|
||||||
});
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -49,14 +49,14 @@ export const CopyButton = ({ created_at, onCopy, text }: CopyButtonProps) => {
|
|||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (diffInMinutes < 2) {
|
if (diffInMinutes < 3) {
|
||||||
const timeLeft = Math.ceil((2 - diffInMinutes) * 60 * 1000);
|
const timeLeft = Math.ceil((3 - diffInMinutes) * 60 * 1000);
|
||||||
setTimeLeft(formatTimeLeft(timeLeft));
|
setTimeLeft(formatTimeLeft(timeLeft));
|
||||||
|
|
||||||
const timer = setInterval(() => {
|
const timer = setInterval(() => {
|
||||||
const currentTime = new Date().getTime();
|
const currentTime = new Date().getTime();
|
||||||
const elapsed = currentTime - created;
|
const elapsed = currentTime - created;
|
||||||
const remaining = 2 * 60 * 1000 - elapsed;
|
const remaining = 3 * 60 * 1000 - elapsed;
|
||||||
|
|
||||||
if (remaining <= 0) {
|
if (remaining <= 0) {
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
|
Loading…
Reference in New Issue
Block a user