Skip to content
This repository was archived by the owner on Jan 14, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
NEXT_PUBLIC_SANITY_DATASET=production
NEXT_PUBLIC_SANITY_PROJECT_ID=mlxdtup8
NEXT_PUBLIC_BASE_URL=http://localhost:3000/
SANITY_API_TOKEN=skT2G7wl4BFGvOLkELSIrcnFEBG3MyrXC71IJgv5iBOj5yxJx75MjgBzbbTvIwUtckXFIluhN2iEHiV37jNA0EcJmbTkMT1LJKwCNWH3ddJnof3mPQWDoVNggRM4ZCNgTDpbGqvjf4FE7xb5TkkTVUX5Rf1Fp4Z3IWZmlmwkSR2Fa8UdcikH
NEXTAUTH_SECRET=k3yf4g3h2u1t4sr5eh6s7i
NEXTAUTH_URL=http://localhost:3000/
GOOGLE_CLIENT_ID=618426972732-a7fqd0fdg2aoa8iagu0vb7f6m0sl2hhs.apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=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
TRACING_ENABLED=false
NEXT_PUBLIC_SOCKET_URL="http://localhost:4000/"
NEXT_PUBLIC_SOCKETIO_URL_2=http://localhost:5000/
NEXT_PUBLIC_SHAZAM_CORE_RAPID_API_KEY='2d7b7a8dfcmsh5d7d9d777fe58aap127c50jsn3b17984aa2a3'
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_c2FjcmVkLWdhcmZpc2gtNy5jbGVyay5hY2NvdW50cy5kZXYk
CLERK_SECRET_KEY=sk_test_LPEsuGh4YWMmMpL3t18rOw08KDjht3lBIsCgRq0Hl6
NEXT_PUBLIC_CLERK_SIGN_IN_URL=/sign-in
NEXT_PUBLIC_CLERK_SIGN_UP_URL=/sign-up
NEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URL=/
NEXT_PUBLIC_CLERK_AFTER_SIGN_UP_URL=/
NEXT_PUBLIC_RAPID_API_KEY=0e8903e27emsh2333e866a960be6p1d76cbjsn8250ba0b208d
NEXT_PUBLIC_TINY=limjfdlb66u3w96h1skw5m93kdvmf55zt4ohb3ol4jeb3q6m
NEXT_PUBLIC_CLIENT_SECRET=505a9fece5074f17b4b9a5edee644089
NEXT_PUBLIC_CLIENT_ID=db6947afde104dbc94f707562b9c20fc
JWT_SECRET=BQBjHQZbyyIZW-WjQ0TxejxcA9dO4v-CRE3zsHabyeowEWKGhepBwAbAPX1B1cnzZkV15J7KEZXA2pUfAmtc8Hms9TTXuAyQxsCB__qKtHDUteEoTsoipMzsiDXTi2kx9Vz0S1cInDyNsevceq29ivhfV-U3oFCWFtRyknTaEQsH1mCigpn-uXZ5AVD5gSqqPt3mK0Z2e5G40r0HpCJtCLgi1Ld2OufzmzagXiKcv9MY7unDjo5hjthV2UF9rmlAy0E6bUH3FcdtCoSsA7JFqAGZyg
NEXT_PUBLIC_CATTO_KEY=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
NEXT_PUBLIC_CHAT_KEY=8ef40a21-bcb4-47f3-928e-2b83389392b1
NEXT_PUBLIC_CHAT_KEY=pk-ihWDwESgKjNoJBbORkgfGDrBGEqnBSCIVwftLcSjoEgIYuFK
18 changes: 18 additions & 0 deletions components/Chat/Channels.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from 'react'

//@ts-ignore
import { useChannelListContext } from '@sendbird/uikit-react/ChannelList/context';


//@ts-ignore
const demo = () => {
const {allChannels,currentChannel,channelListQuery,channelSource} = useChannelListContext();

return (
<>

</>
)
}

export default demo
45 changes: 43 additions & 2 deletions components/Chat/Chat.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import React, { useState } from "react";
// import SendbirdApp from "@sendbird/uikit-react/App";
import { User } from "../../typings";
import dynamic from "next/dynamic";

const Channels = dynamic(() => import('../Chat/Channels'), { ssr: false })
const GroupChannel = dynamic(() => import('../Chat/GroupChannel'), { ssr: false })
const OpenChannel = dynamic(() => import('../Chat/OpenChannel'), { ssr: false })


const APP_ID = "7FB154A3-C967-45D0-90B7-6A63E5F0E3EB";
const USER_ID = "astrosaard";
Expand All @@ -12,6 +18,9 @@ import SBChannelList from "@sendbird/uikit-react/ChannelList";
import SBChannelSettings from "@sendbird/uikit-react/ChannelSettings";
// @ts-ignore
import SBProvider from "@sendbird/uikit-react/SendbirdProvider";



const myColorSet = {
"--sendbird-dark-primary-500": "#FFFFFF",
"--sendbird-dark-primary-400": "#FFFFFF",
Expand All @@ -23,10 +32,24 @@ const myColorSet = {
interface Props {
user: User[];
}

//@ts-ignore
import { ChannelListProvider } from '@sendbird/uikit-react/ChannelList/context';

//@ts-ignore
import { ChannelProvider } from '@sendbird/uikit-react/Channel/context';

//@ts-ignore
import { OpenChannelProvider } from '@sendbird/uikit-react/OpenChannel/context';


const Chat = ({ user }: Props) => {
const [showSettings, setShowSettings] = useState(true);
const [showSettings, setShowSettings] = useState(false);
const [currentChannelUrl, setCurrentChannelUrl] = useState("");
const [category, setCategory] = useState("");
// const channelState = useChannelContext();
// const { currentGroupChannel } = channelState;

return (
<div className="h-[86vh] overflow-hidden -ml-6 top-0 w-full scrollbar-none scrollbar">
{" "}
Expand All @@ -39,6 +62,7 @@ const Chat = ({ user }: Props) => {
<div className="flex justify-between h-full w-full">
<div className="w-fit">
<SBChannelList
allowProfileEdit
onChannelSelect={(channel: any) => {
if (channel && channel.url) {
setCurrentChannelUrl(channel.url);
Expand All @@ -47,6 +71,7 @@ const Chat = ({ user }: Props) => {
}}
/>
</div>

<div className="w-full">
<SBConversation
channelUrl={currentChannelUrl}
Expand All @@ -55,6 +80,19 @@ const Chat = ({ user }: Props) => {
}}
/>
</div>

{/* <ChannelListProvider channelUrl={currentChannelUrl}>
<Channels/>
</ChannelListProvider> */}

{/* <ChannelProvider channelUrl={currentChannelUrl}>
<GroupChannel/>
</ChannelProvider> */}

{/* <OpenChannelProvider channelUrl={currentChannelUrl}>
<OpenChannel/>
</OpenChannelProvider> */}

{showSettings && (
<div className="">
<SBChannelSettings
Expand All @@ -65,10 +103,13 @@ const Chat = ({ user }: Props) => {
/>
</div>
)}


</div>

</SBProvider>
</div>
);
};

export default Chat;
export default Chat;
55 changes: 55 additions & 0 deletions components/Chat/CreateOrLeaveChannel.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import React, { useState } from "react";

//@ts-ignore
import sendbirdSelectors from "@sendbird/uikit-react/sendbirdSelectors";

//@ts-ignore
import withSendbird from "@sendbird/uikit-react/withSendbird";

//@ts-ignore
import useSendbirdStateContext from "@sendbird/uikit-react/useSendbirdStateContext";

//@ts-ignore
const demo = () => {
const [channelUrl, setChannelUrl] = useState("");

const globalStore = useSendbirdStateContext();
const createChannel = sendbirdSelectors.getCreateGroupChannel(globalStore);
const leaveChannel = sendbirdSelectors.getLeaveGroupChannel(globalStore);

return (
<>
<button
onClick={() => {
// For TypeScript, use const params: GroupChannelCreateParams = {};
const params = {};
createChannel(params)
//@ts-ignore
.then((channel) => {
setChannelUrl(channel.url);
})
//@ts-ignore
.catch((error) => console.warn(error));
}}
>
Create channel
</button>
<button
onClick={() => {
leaveChannel(channelUrl)
.then(() => {
setChannelUrl("");
})
//@ts-ignore
.catch((error) => console.warn(error));
}}
>
Leave channel
</button>
<br />
{`Created channel is: ${channelUrl}`}
</>
);
};

export default demo;
18 changes: 18 additions & 0 deletions components/Chat/GroupChannel.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from 'react'

//@ts-ignore
import { useChannelContext } from '@sendbird/uikit-react/Channel/context';


//@ts-ignore
const demo = () => {
const {allMessages} = useChannelContext();

return (
<>

</>
)
}

export default demo
18 changes: 18 additions & 0 deletions components/Chat/OpenChannel.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from 'react'

//@ts-ignore
import { useOpenChannelContext } from '@sendbird/uikit-react/OpenChannel/context';


//@ts-ignore
const demo = () => {
const {allMessages} = useOpenChannelContext();

return (
<>

</>
)
}

export default demo
25 changes: 25 additions & 0 deletions components/Chat/getUser.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import React from 'react'

//@ts-ignore
import SendbirdProvider from "@sendbird/uikit-react/SendbirdProvider";

//@ts-ignore
import sendbirdSelectors from "@sendbird/uikit-react/useSendbirdStateContext";

//@ts-ignore
import useSendbirdStateContext from "@sendbird/uikit-react/useSendbirdStateContext";


//@ts-ignore
const demo = () => {
const globalStore = useSendbirdStateContext();
const currentUserId = globalStore?.stores?.userStore?.user?.userId;

return (
<>

</>
)
}

export default demo
5 changes: 4 additions & 1 deletion pages/chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import { GetServerSideProps } from "next";
import { fetchUsers } from "../utils/fetchUsers";
import { User } from "../typings";
import { useUser } from "@clerk/nextjs";


const Chat = dynamic(() => import("../components/Chat/Chat"), {
ssr: false,
loading: () => <p>...</p>,
Expand All @@ -23,6 +25,7 @@ const buddies = ({ users }: Props) => {
const match = users.filter(
(userss) => userss.email == user.emailAddresses[0].emailAddress
);

return (
<Layout
hasBg={false}
Expand All @@ -48,4 +51,4 @@ export const getServerSideProps: GetServerSideProps = async (context) => {
},
};
};
export default buddies;
export default buddies;