Skip to content

Commit

Permalink
copy lobby id on click
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulKreft committed Feb 20, 2024
1 parent 9e42a37 commit 925ab86
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
15 changes: 15 additions & 0 deletions frontend/src/assets/copy-to-clipboard-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 10 additions & 1 deletion frontend/src/components/MultiplayerLobby.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Spinner } from "./Spinner.tsx";
import React, { ChangeEvent } from "react";
import { Player } from "../types/Player.ts";
import { Lobby } from "../types/Lobby.ts";
import copyToClipBoardIconUrl from "./../assets/copy-to-clipboard-icon.svg";

type MultiplayerLobbyProps = {
lobby: Lobby;
Expand All @@ -27,7 +28,15 @@ export const MultiplayerLobby: React.FC<MultiplayerLobbyProps> = ({
<div className="flex w-full items-center justify-evenly rounded-2xl border-2 border-black py-10 xs:w-max xs:px-20">
<div className="flex flex-col items-center">
<div className="text-xl font-extrabold">{`${lobby.host.name.substring(0, 15)}'s lobby`}</div>
<div className="text-lg font-light">{`ID: ${lobby.id}`}</div>
<div
className="flex cursor-pointer items-center"
onClick={() => {
navigator.clipboard.writeText(lobby.id);
}}
>
<div className="text-lg font-light">{lobby.id}</div>
<img className="h-7" src={copyToClipBoardIconUrl} alt="copy to clipboard" />
</div>

{lobby.host.id !== player.id && (
<div className="mt-5 flex gap-5">
Expand Down

0 comments on commit 925ab86

Please sign in to comment.