Skip to content

Commit efbb187

Browse files
committed
Update party invite UI
1 parent 95492fc commit efbb187

File tree

4 files changed

+65
-7
lines changed

4 files changed

+65
-7
lines changed

web/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,10 @@
2727
"date-fns": "^4.1.0",
2828
"openapi-hooks": "0.0.3-alpha.3",
2929
"postcss": "^8.5.1",
30+
"qrcode.react": "^4.2.0",
3031
"react": "^19.0.0",
3132
"react-dom": "^19.0.0",
33+
"react-icons": "^5.5.0",
3234
"tailwindcss": "^3.4.17",
3335
"typescript": "^5.7.3",
3436
"use-debounce": "^10.0.4",

web/pnpm-lock.yaml

Lines changed: 24 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,40 @@
1-
export const PartyInviteCard = () => {
2-
return <div className="card">
3-
<div className="card-body">
4-
<h5 className="card-title">Party Invite</h5>
5-
<p className="card-text">Share this link with your friends to invite them to the party.</p>
1+
import { FC, useState } from "react"
2+
import { LuEye, LuEyeOff } from "react-icons/lu";
3+
import { QRCodeSVG } from 'qrcode.react';
4+
export const PartyInviteCard: FC<{ partyId: string }> = ({ partyId }) => {
5+
const [hidden, setHidden] = useState(true);
6+
7+
return (<div className="card flex flex-col gap-2 max-w-sm">
8+
<h2>Party Invite</h2>
9+
<p className="text-secondary">Share this link with your friends to invite them to the party.</p>
10+
<div className="flex justify-center gap-2 flex-col items-center">
11+
<QRCode value={`${window.location.origin}/party/${partyId}`} hidden={hidden} />
12+
<div className="text-secondary">
13+
Party Code: <span className="inline-flex font-bold bg-tertiary px-2 py-1">{hidden ? '*'.repeat(partyId.length) : partyId}</span>
14+
</div>
615
</div>
7-
</div>
16+
<div className="flex gap-2 w-full flex-wrap justify-between">
17+
<input type={hidden ? 'password' : 'text'} className="input flex-1" value={`${window.location.origin}/party/${partyId}`} disabled />
18+
<button className="button" onClick={() => {
19+
navigator.clipboard.writeText(`${window.location.origin}/party/${partyId}`);
20+
}}>Copy</button>
21+
</div>
22+
<button className="button flex gap-2 items-center" onClick={() => setHidden(!hidden)}>
23+
{hidden ? <><LuEye /> Show</> : <><LuEyeOff /> Hide</>}
24+
</button>
25+
</div>);
826
}
27+
28+
const QRCode: FC<{ value: string, hidden: boolean }> = ({ value, hidden }) => {
29+
return <div className="bg-tertiary p-2 rounded-md">
30+
<div className="w-full h-full bg-secondary rounded-md">
31+
{
32+
hidden ? <div className="w-32 h-32 bg-tertiary rounded-md flex items-center justify-center gap-2">
33+
<LuEyeOff className="text-secondary" />
34+
<p className="text-secondary">Hidden</p>
35+
</div> :
36+
<QRCodeSVG value={value} size={128} bgColor="#2d2b29" fgColor="#F5F5F5" />
37+
}
38+
</div>
39+
</div>
40+
};

web/src/routes/$partyId/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ function RouteComponent() {
99
const { partyId } = Route.useParams();
1010

1111
return (<div className="p-2 grid grid-cols-1 gap-2">
12-
<PartyInviteCard />
12+
<PartyInviteCard partyId={partyId} />
1313
</div>);
1414
}

0 commit comments

Comments
 (0)