diff --git a/components/CopyButton.tsx b/components/CopyButton.tsx
index 2f055de..13dc9bf 100644
--- a/components/CopyButton.tsx
+++ b/components/CopyButton.tsx
@@ -1,7 +1,7 @@
'use client';
import { useState } from 'react';
-import { Copy as CopyIcon } from 'lucide-react';
+import { Copy as CopyIcon, Check as CheckIcon } from 'lucide-react';
import ToolTip from '@/components/ToolTip';
@@ -30,8 +30,12 @@ export default function CopyButton({ title, copy }: CopyButtonProps) {
className="w-full py-1 px-2 bg-gray-700 hover:bg-gray-600 text-white rounded-lg flex flex-col items-start gap-1 shadow transition-all cursor-pointer"
>
- {`${copied ? 'Copied' : 'Copy'} ${title}`}
-
+ {`Copy ${title}`}
+ {copied ? (
+
+ ) : (
+
+ )}
diff --git a/components/Switch.tsx b/components/Switch.tsx
index d1ad149..340d7e1 100644
--- a/components/Switch.tsx
+++ b/components/Switch.tsx
@@ -17,9 +17,9 @@ export default function Switch({ label, value, toggleAction }: SwitchProps) {
}`}
/>
diff --git a/components/ToolTip.tsx b/components/ToolTip.tsx
index 88be010..f39b50e 100644
--- a/components/ToolTip.tsx
+++ b/components/ToolTip.tsx
@@ -37,13 +37,17 @@ export default function Tooltip({
const handleMouseMove = (e: React.MouseEvent) => {
const { clientX: x, clientY: y } = e;
+ const ttWidth = ttRef.current?.offsetWidth || 0;
const ttHeight = ttRef.current?.offsetHeight || 0;
+ const viewportWidth = window.innerWidth - edgeBuffer;
const viewportHeight = window.innerHeight - edgeBuffer;
+ const ttRight = ttWidth + offsetX + x;
const ttBottom = ttHeight + offsetY + y;
- const adjustment = ttBottom > viewportHeight ? ttBottom - viewportHeight : 0;
+ const adjustX = ttRight > viewportWidth ? ttRight - viewportWidth : 0;
+ const adjustY = ttBottom > viewportHeight ? ttBottom - viewportHeight : 0;
- setPos({ x, y: y - adjustment });
+ setPos({ x: x - adjustX, y: y - adjustY });
};
const handleTouchStart = () => {