diff --git a/resources/scripts/components/elements/CopyOnClick.tsx b/resources/scripts/components/elements/CopyOnClick.tsx index c737bc03d..84793f308 100644 --- a/resources/scripts/components/elements/CopyOnClick.tsx +++ b/resources/scripts/components/elements/CopyOnClick.tsx @@ -4,7 +4,7 @@ import Portal from '@/components/elements/Portal'; import copy from 'copy-to-clipboard'; import classNames from 'classnames'; -const CopyOnClick: React.FC<{ text: any; disabled?: boolean }> = ({ text, disabled, children }) => { +const CopyOnClick: React.FC<{ text: string | number | null | undefined }> = ({ text, children }) => { const [copied, setCopied] = useState(false); useEffect(() => { @@ -23,12 +23,12 @@ const CopyOnClick: React.FC<{ text: any; disabled?: boolean }> = ({ text, disabl throw new Error('Component passed to must be a valid React element.'); } - const child = disabled + const child = !text ? React.Children.only(children) : React.cloneElement(React.Children.only(children), { className: classNames(children.props.className || '', 'cursor-pointer'), onClick: (e: React.MouseEvent) => { - copy(text); + copy(String(text)); setCopied(true); if (typeof children.props.onClick === 'function') { children.props.onClick(e); diff --git a/resources/scripts/components/server/console/PowerButtons.tsx b/resources/scripts/components/server/console/PowerButtons.tsx index 26a386e93..f5f81898f 100644 --- a/resources/scripts/components/server/console/PowerButtons.tsx +++ b/resources/scripts/components/server/console/PowerButtons.tsx @@ -50,7 +50,7 @@ export default ({ className }: PowerButtonProps) => { - + Restart diff --git a/resources/scripts/components/server/console/ServerConsoleContainer.tsx b/resources/scripts/components/server/console/ServerConsoleContainer.tsx index 330bbcfde..b2265d385 100644 --- a/resources/scripts/components/server/console/ServerConsoleContainer.tsx +++ b/resources/scripts/components/server/console/ServerConsoleContainer.tsx @@ -23,24 +23,24 @@ const ServerConsoleContainer = () => { return ( -
-
+
+

{name}

{description}

-
+
-
+ {isInstalling ? (
diff --git a/resources/scripts/components/server/console/StatBlock.tsx b/resources/scripts/components/server/console/StatBlock.tsx index 5a14e9d32..a3495bea4 100644 --- a/resources/scripts/components/server/console/StatBlock.tsx +++ b/resources/scripts/components/server/console/StatBlock.tsx @@ -22,20 +22,20 @@ export default ({ title, copyOnClick, icon, color, description, className, child return ( - -
-
-
- -
-
-

{title}

+
+
+
+ +
+
+

{title}

+
{children}
-
+
- +
); }; diff --git a/resources/scripts/lib/objects.ts b/resources/scripts/lib/objects.ts index 7165a4af2..319bcd665 100644 --- a/resources/scripts/lib/objects.ts +++ b/resources/scripts/lib/objects.ts @@ -2,8 +2,7 @@ * Determines if the value provided to the function is an object type that * is not null. */ -// eslint-disable-next-line @typescript-eslint/ban-types -function isObject(val: unknown): val is {} { +function isObject(val: unknown): val is Record { return typeof val === 'object' && val !== null && !Array.isArray(val); }