Skip to content

Commit

Permalink
Merge pull request #1238 from wish-oss/feat/copy-ip
Browse files Browse the repository at this point in the history
feat: added clipboard functionality to copy IP address from badge in services pages
  • Loading branch information
Siumauricio authored Feb 1, 2025
2 parents 407e2e1 + 5c889e8 commit e48f143
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ import { useRouter } from "next/router";
import React, { useState, useEffect, type ReactElement } from "react";
import { toast } from "sonner";
import superjson from "superjson";
import copy from 'copy-to-clipboard';

type TabState =
| "projects"
Expand Down Expand Up @@ -139,6 +140,13 @@ const Service = (
<div className="flex flex-col h-fit w-fit gap-2">
<div className="flex flex-row h-fit w-fit gap-2">
<Badge
className="cursor-pointer"
onClick={() => {
if (data?.server?.ipAddress) {
copy(data.server.ipAddress);
toast.success("IP Address Copied!");
}
}}
variant={
!data?.serverId
? "default"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ import Link from "next/link";
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"
Expand Down Expand Up @@ -131,6 +133,13 @@ const Service = (
<div className="flex flex-col h-fit w-fit gap-2">
<div className="flex flex-row h-fit w-fit gap-2">
<Badge
className="cursor-pointer"
onClick={() => {
if (data?.server?.ipAddress) {
copy(data.server.ipAddress);
toast.success("IP Address Copied!");
}
}}
variant={
!data?.serverId
? "default"
Expand All @@ -142,7 +151,7 @@ const Service = (
{data?.server?.name || "Dokploy Server"}
</Badge>
{data?.server?.serverStatus === "inactive" && (
<TooltipProvider delayDuration={0}>
<TooltipProvider>
<Tooltip>
<TooltipTrigger asChild>
<Label className="break-all w-fit flex flex-row gap-1 items-center">
Expand Down

0 comments on commit e48f143

Please sign in to comment.