Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PubNub chat iteration 1 #520

Merged
merged 7 commits into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion examples/with-pubnub/.env.example
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
STUDIO_API_KEY="634b7695-b24d-4d8d-b890-b148d2897d9f"
STUDIO_API_KEY=
NEXT_PUBLIC_PUBLISH_KEY=
NEXT_PUBLIC_SUBSCRIBE_KEY=
NEXT_PUBLIC_SECRET_KEY=
20 changes: 17 additions & 3 deletions examples/with-pubnub/next.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
const { NormalModuleReplacementPlugin } = require("webpack");

/** @type {import('next').NextConfig} */
const nextConfig = {
module.exports = {
reactStrictMode: true,
webpack: (config, { isServer }) => {
if (!isServer) {
config.resolve.fallback.fs = false;
config.resolve.fallback.dns = false;
config.resolve.fallback.net = false;
}
config.plugins.push(
new NormalModuleReplacementPlugin(
/^hexoid$/,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this necessary? I'd prefer to keep the next config as simple as possible so devs don't have to make these changes when they build with this example

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have reported it as a bug to our engineering team to fix inside the SDK. I will check the progress on that. Hopefully, (not likely) we will have it removed before the Webinar. It is not a breaking change it just throws an error in the console if it is not in there which I did not like the look of.

require.resolve("hexoid/dist/index.js"),
),
);
return config;
},
};

module.exports = nextConfig;
6 changes: 6 additions & 0 deletions examples/with-pubnub/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,20 @@
"lint": "next lint"
},
"dependencies": {
"@fortawesome/free-solid-svg-icons": "^6.5.1",
"@fortawesome/react-fontawesome": "^0.2.0",
"@livepeer/react": "workspace:*",
"@pubnub/chat": "^0.6.0",
"@radix-ui/react-popover": "^1.0.7",
"@types/react-modal": "^3.16.3",
"clsx": "^2.1.0",
"livepeer": "^3.0.2",
"lucide-react": "^0.352.0",
"next": "14.1.3",
"react": "^18",
"react-dom": "^18",
"react-loader-spinner": "^6.1.6",
"react-modal": "^3.16.1",
"sonner": "^1.4.3",
"tailwind-merge": "^2.2.1",
"tailwindcss-animate": "^1.0.7",
Expand Down
Binary file added examples/with-pubnub/public/banned.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 5 additions & 2 deletions examples/with-pubnub/src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Chat } from "@/components/chat/Chat";
import { ChatContextProvider } from "@/components/chat/context/ChatContext";
import { ArrowUpRight } from "lucide-react";
import { cookies, headers } from "next/headers";
import { BroadcastWithControls } from "../components/broadcast/Broadcast";
Expand All @@ -18,7 +19,7 @@ export default async function Home() {
: null;

return (
<main className="grid grid-cols-8 h-full relative min-h-screen bg-black">
<main className="grid grid-cols-8 h-full relative min-h-screen bg-black overflow-hidden">
{!streamKey || !playbackId || !playbackUrl ? (
<div className="flex flex-col flex-1 justify-center items-end gap-3 col-span-8">
<h1 className="justify-center text-right flex text-3xl font-medium mr-3">
Expand Down Expand Up @@ -63,7 +64,9 @@ export default async function Home() {
</div>

<div className="col-span-8 md:col-span-2 h-full">
<Chat playbackId={playbackId} />
<ChatContextProvider>
<Chat playbackId={playbackId} />
</ChatContextProvider>
</div>
</>
)}
Expand Down
5 changes: 4 additions & 1 deletion examples/with-pubnub/src/app/view/[playbackId]/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Chat } from "@/components/chat/Chat";
import { ChatContextProvider } from "@/components/chat/context/ChatContext";
import type { ReactNode } from "react";

export default function PlayerLayout({
Expand All @@ -22,7 +23,9 @@ export default function PlayerLayout({
{children}
</div>
<div className="col-span-8 md:col-span-2 h-full">
<Chat playbackId={params.playbackId} />
<ChatContextProvider>
<Chat playbackId={params.playbackId} />
</ChatContextProvider>
</div>
</main>
);
Expand Down