Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
babyuniverse committed Jul 8, 2024
2 parents c7cb158 + c74a19e commit 9b9ef49
Show file tree
Hide file tree
Showing 12 changed files with 83 additions and 15 deletions.
32 changes: 32 additions & 0 deletions app/api/liveblocks-auth/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { auth } from '@/auth';
import { Liveblocks } from '@liveblocks/node';

const liveblocks = new Liveblocks({
secret: process.env.LIVEBLOCKS_SECRET_KEY!,
});

export async function POST(request: Request) {
const session = await auth();
if (!session || !session.user) {
return new Response("Unauthorized", { status: 403 });
}

const { room } = await request.json();

const userInfo = {
name: session.user.name || "Teammate",
picture: session.user.image || undefined,
};

const liveblocksSession = liveblocks.prepareSession(
session.user.id ?? '',
{ userInfo }
);

if (room) {
liveblocksSession.allow(room, liveblocksSession.FULL_ACCESS);
}

const { status, body } = await liveblocksSession.authorize();
return new Response(body, { status });
}
9 changes: 6 additions & 3 deletions app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@
50% { border-color: transparent; }
}

.dynamic-widget-inline-controls {
cursor: url(/cursor-hover.png), auto;
}
.dynamic-shadow-dom {
--dynamic-connect-button-background: #4fff14;
--dynamic-connect-button-color: #000;
--dynamic-connect-button-background-hover: #2EA207;
--dynamic-connect-button-color-hover: #000;
}
19 changes: 15 additions & 4 deletions app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,21 @@ const fragment = Fragment_Mono({
})

export const metadata: Metadata = {
title: "Playground by Playgocthi",
description:
"Welcome to Playground by Playgotchi where communites play together",
}
title: "Playground by Playgotchi",
description: "Welcome to Playground—where onchain communities play together.",
openGraph: {
title: "Playground by Playgotchi",
description: "Welcome to Playground—where onchain communities play together.",
images: [
{
url: "https://playground.playgotchi.com/playground-social.png",
width: 1200,
height: 630,
alt: "Playground by Playgotchi",
},
],
},
};

export default function RootLayout({ children }: React.PropsWithChildren) {
return (
Expand Down
2 changes: 1 addition & 1 deletion app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default async function Index() {
/>
<h3 className="text-teal-900 text-center typewriter font-bold">Playgotchi</h3>
<Link href={"https://zora.co/collect/base:0xd569f16053f5b8b26459d5fcf90a385fda84c4da"} target="_blank" rel="noopener noreferrer">
<Button variant={'secondary'}>View on Zora</Button>
<Button variant={'secondary'}>Mint on Zora</Button>
</Link>
</div>
<div className="flex flex-col gap-4 border-4 border-b-8 border-yellow-500 shadow-lg p-4 bg-white rounded-md transform transition-transform duration-300 hover:scale-105 hover:shadow-2xl hover:rotate-2 min-w-56">
Expand Down
3 changes: 1 addition & 2 deletions components/Room.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@ export const Room = ({
roomId,
fallback,
}: RoomProps) => {
const publicApiKey = process.env.NEXT_PUBLIC_LIVEBLOCKS_PUBLIC_KEY || "";
return (
<LiveblocksProvider
publicApiKey={publicApiKey}
authEndpoint="/api/liveblocks-auth"
>
<RoomProvider id={roomId}
initialPresence={{
Expand Down
2 changes: 1 addition & 1 deletion components/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default function Header() {
<Image
src="/logo.png"
alt={"Playground logo"}
width={240}
width={220}
height={40}
className="animate-pulse transition-all hover:cursor-py-cursor-hover active:cursor-py-cursor-press"
/>
Expand Down
4 changes: 2 additions & 2 deletions components/settings/Export.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import { Button } from "@/components/ui/button";
const Export = () => (
<div className='flex flex-col gap-3 px-5 py-3'>
<h3 className='text-[10px] uppercase'>Collect</h3>
<Button
<Button disabled
variant='primary'
className='w-full'
onClick={() => {}}
>
Mint Button
Mint
</Button>
</div>
);
Expand Down
22 changes: 22 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
},
"author": "Playgotchi <https://warpcast.com/playgotchi>",
"contributors": [
"Ting Wang",
"Universe",
"Ting <https://warpcast.com/ting>",
"Universe https://warpcast.com/babyuniverse>",
"getoffdeez <https://warpcast.com/getoffdeez.eth>"
],
"dependencies": {
Expand All @@ -23,6 +23,7 @@
"@dynamic-labs/sdk-react-core": "^2.2.4",
"@dynamic-labs/wagmi-connector": "^2.2.6",
"@liveblocks/client": "^2.0.5",
"@liveblocks/node": "^2.1.0",
"@liveblocks/react": "^2.0.5",
"@liveblocks/react-ui": "^2.0.5",
"@pinata/sdk": "^2.1.0",
Expand Down
Binary file added public/logo-sm-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/logo-sm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/playground-social.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 9b9ef49

Please sign in to comment.