From 2c6c89e4c101d7c45f3b07dd7115331d2af8835a Mon Sep 17 00:00:00 2001 From: vishalkadam47 Date: Fri, 31 Jan 2025 20:31:16 +0530 Subject: [PATCH] refactor: added copy-to-clipboard library and replaced navigator.clipboard.writeText with copy function --- .../[projectId]/services/application/[applicationId].tsx | 5 +++-- .../project/[projectId]/services/compose/[composeId].tsx | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/dokploy/pages/dashboard/project/[projectId]/services/application/[applicationId].tsx b/apps/dokploy/pages/dashboard/project/[projectId]/services/application/[applicationId].tsx index 9b2435ec..21e05dbd 100644 --- a/apps/dokploy/pages/dashboard/project/[projectId]/services/application/[applicationId].tsx +++ b/apps/dokploy/pages/dashboard/project/[projectId]/services/application/[applicationId].tsx @@ -51,7 +51,8 @@ import Link from "next/link"; import { useRouter } from "next/router"; import React, { useState, useEffect, type ReactElement } from "react"; import { toast } from "sonner"; -import superjson from "superjson"; +import superjson from "superjson"; +import copy from 'copy-to-clipboard'; type TabState = | "projects" @@ -142,7 +143,7 @@ const Service = ( className="cursor-pointer" onClick={() => { if (data?.server?.ipAddress) { - navigator.clipboard.writeText(data.server.ipAddress); + copy(data.server.ipAddress); toast.success("IP Address Copied!"); } }} diff --git a/apps/dokploy/pages/dashboard/project/[projectId]/services/compose/[composeId].tsx b/apps/dokploy/pages/dashboard/project/[projectId]/services/compose/[composeId].tsx index 0e35fce4..373e8a25 100644 --- a/apps/dokploy/pages/dashboard/project/[projectId]/services/compose/[composeId].tsx +++ b/apps/dokploy/pages/dashboard/project/[projectId]/services/compose/[composeId].tsx @@ -45,6 +45,7 @@ import { useRouter } from "next/router"; import React, { useState, useEffect, type ReactElement } from "react"; import superjson from "superjson"; import { toast } from "sonner"; +import copy from 'copy-to-clipboard'; type TabState = | "projects" @@ -135,7 +136,7 @@ const Service = ( className="cursor-pointer" onClick={() => { if (data?.server?.ipAddress) { - navigator.clipboard.writeText(data.server.ipAddress); + copy(data.server.ipAddress); toast.success("IP Address Copied!"); } }}