mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
refactor: added copy-to-clipboard library and replaced navigator.clipboard.writeText with copy function
This commit is contained in:
@@ -51,7 +51,8 @@ import Link from "next/link";
|
|||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import React, { useState, useEffect, type ReactElement } from "react";
|
import React, { useState, useEffect, type ReactElement } from "react";
|
||||||
import { toast } from "sonner";
|
import { toast } from "sonner";
|
||||||
import superjson from "superjson";
|
import superjson from "superjson";
|
||||||
|
import copy from 'copy-to-clipboard';
|
||||||
|
|
||||||
type TabState =
|
type TabState =
|
||||||
| "projects"
|
| "projects"
|
||||||
@@ -142,7 +143,7 @@ const Service = (
|
|||||||
className="cursor-pointer"
|
className="cursor-pointer"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (data?.server?.ipAddress) {
|
if (data?.server?.ipAddress) {
|
||||||
navigator.clipboard.writeText(data.server.ipAddress);
|
copy(data.server.ipAddress);
|
||||||
toast.success("IP Address Copied!");
|
toast.success("IP Address Copied!");
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ import { useRouter } from "next/router";
|
|||||||
import React, { useState, useEffect, type ReactElement } from "react";
|
import React, { useState, useEffect, type ReactElement } from "react";
|
||||||
import superjson from "superjson";
|
import superjson from "superjson";
|
||||||
import { toast } from "sonner";
|
import { toast } from "sonner";
|
||||||
|
import copy from 'copy-to-clipboard';
|
||||||
|
|
||||||
type TabState =
|
type TabState =
|
||||||
| "projects"
|
| "projects"
|
||||||
@@ -135,7 +136,7 @@ const Service = (
|
|||||||
className="cursor-pointer"
|
className="cursor-pointer"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (data?.server?.ipAddress) {
|
if (data?.server?.ipAddress) {
|
||||||
navigator.clipboard.writeText(data.server.ipAddress);
|
copy(data.server.ipAddress);
|
||||||
toast.success("IP Address Copied!");
|
toast.success("IP Address Copied!");
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
|
|||||||
Reference in New Issue
Block a user