a more-obvious spectator link
This commit is contained in:
@@ -3,11 +3,14 @@
|
|||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import { useParams } from 'next/navigation';
|
import { useParams } from 'next/navigation';
|
||||||
import { socket } from '@/socket';
|
import { socket } from '@/socket';
|
||||||
|
import { Eye } from 'lucide-react';
|
||||||
|
|
||||||
import Settings from '@/components/Settings';
|
|
||||||
import Card from '@/components/Card';
|
import Card from '@/components/Card';
|
||||||
|
import CopyButton from '@/components/CopyButton';
|
||||||
import Notes from '@/components/Notes';
|
import Notes from '@/components/Notes';
|
||||||
import NotFound from '@/components/NotFound';
|
import NotFound from '@/components/NotFound';
|
||||||
|
import Settings from '@/components/Settings';
|
||||||
|
|
||||||
import { cardMap, layout } from '@/constants/tarokka';
|
import { cardMap, layout } from '@/constants/tarokka';
|
||||||
|
|
||||||
import type { GameUpdate, ClientUpdate } from '@/types';
|
import type { GameUpdate, ClientUpdate } from '@/types';
|
||||||
@@ -88,6 +91,15 @@ export default function GamePage() {
|
|||||||
<NotFound />
|
<NotFound />
|
||||||
) : cards ? (
|
) : cards ? (
|
||||||
<main className="min-h-screen flex flex-col items-center justify-center gap-4 bg-[url('/img/table3.png')] bg-cover bg-center">
|
<main className="min-h-screen flex flex-col items-center justify-center gap-4 bg-[url('/img/table3.png')] bg-cover bg-center">
|
||||||
|
{isDM && (
|
||||||
|
<CopyButton
|
||||||
|
copy={`${location.origin}/${gameData.spectatorID}`}
|
||||||
|
tooltip={`Spectator link: ${location.origin}/${gameData.spectatorID}`}
|
||||||
|
Icon={Eye}
|
||||||
|
className={`fixed top-4 left-4 p-2 z-25 transition-all duration-250 text-yellow-400 hover:text-yellow-300 cursor-pointer`}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
|
||||||
{isDM && <Settings gameData={gameData} changeAction={handleSettings} />}
|
{isDM && <Settings gameData={gameData} changeAction={handleSettings} />}
|
||||||
<div className="grid grid-cols-3 grid-rows-3 gap-8 w-fit mx-auto">
|
<div className="grid grid-cols-3 grid-rows-3 gap-8 w-fit mx-auto">
|
||||||
{Array.from({ length: 9 })
|
{Array.from({ length: 9 })
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import { useState } from 'react';
|
import { ForwardRefExoticComponent, RefAttributes, useState } from 'react';
|
||||||
import { Copy as CopyIcon, Check as CheckIcon } from 'lucide-react';
|
import { LucideProps, Copy as CopyIcon, Check as CheckIcon } from 'lucide-react';
|
||||||
|
|
||||||
import ToolTip from '@/components/ToolTip';
|
import ToolTip from '@/components/ToolTip';
|
||||||
|
|
||||||
type CopyButtonProps = {
|
type CopyButtonProps = {
|
||||||
title?: string;
|
title?: string;
|
||||||
copy: string;
|
copy: string;
|
||||||
|
Icon?: ForwardRefExoticComponent<Omit<LucideProps, 'ref'> & RefAttributes<SVGSVGElement>>;
|
||||||
tooltip?: string | string[];
|
tooltip?: string | string[];
|
||||||
className?: string;
|
className?: string;
|
||||||
};
|
};
|
||||||
@@ -15,6 +16,7 @@ type CopyButtonProps = {
|
|||||||
export default function CopyButton({
|
export default function CopyButton({
|
||||||
title,
|
title,
|
||||||
copy,
|
copy,
|
||||||
|
Icon = CopyIcon,
|
||||||
tooltip = ['Copy', 'Copied'],
|
tooltip = ['Copy', 'Copied'],
|
||||||
className,
|
className,
|
||||||
}: CopyButtonProps) {
|
}: CopyButtonProps) {
|
||||||
@@ -44,7 +46,7 @@ export default function CopyButton({
|
|||||||
{copied ? (
|
{copied ? (
|
||||||
<CheckIcon className="ml-auto" size={16} />
|
<CheckIcon className="ml-auto" size={16} />
|
||||||
) : (
|
) : (
|
||||||
<CopyIcon className="ml-auto" size={16} />
|
<Icon className="ml-auto" size={16} />
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</ToolTip>
|
</ToolTip>
|
||||||
|
|||||||
Reference in New Issue
Block a user