diff --git a/.env b/.env new file mode 100644 index 0000000..4eddc0e --- /dev/null +++ b/.env @@ -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 \ No newline at end of file diff --git a/components/Chat/Channels.tsx b/components/Chat/Channels.tsx new file mode 100644 index 0000000..9f5fa09 --- /dev/null +++ b/components/Chat/Channels.tsx @@ -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 \ No newline at end of file diff --git a/components/Chat/Chat.tsx b/components/Chat/Chat.tsx index af2833e..dc30ac2 100644 --- a/components/Chat/Chat.tsx +++ b/components/Chat/Chat.tsx @@ -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"; @@ -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", @@ -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 (
{" "} @@ -39,6 +62,7 @@ const Chat = ({ user }: Props) => {
{ if (channel && channel.url) { setCurrentChannelUrl(channel.url); @@ -47,6 +71,7 @@ const Chat = ({ user }: Props) => { }} />
+
{ }} />
+ + {/* + + */} + + {/* + + */} + + {/* + + */} + {showSettings && (
{ />
)} + +
+
); }; -export default Chat; +export default Chat; \ No newline at end of file diff --git a/components/Chat/CreateOrLeaveChannel.tsx b/components/Chat/CreateOrLeaveChannel.tsx new file mode 100644 index 0000000..0ea88ab --- /dev/null +++ b/components/Chat/CreateOrLeaveChannel.tsx @@ -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 ( + <> + + +
+ {`Created channel is: ${channelUrl}`} + + ); +}; + +export default demo; diff --git a/components/Chat/GroupChannel.tsx b/components/Chat/GroupChannel.tsx new file mode 100644 index 0000000..5a50084 --- /dev/null +++ b/components/Chat/GroupChannel.tsx @@ -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 \ No newline at end of file diff --git a/components/Chat/OpenChannel.tsx b/components/Chat/OpenChannel.tsx new file mode 100644 index 0000000..8cd0c90 --- /dev/null +++ b/components/Chat/OpenChannel.tsx @@ -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 \ No newline at end of file diff --git a/components/Chat/getUser.tsx b/components/Chat/getUser.tsx new file mode 100644 index 0000000..5c2a0fc --- /dev/null +++ b/components/Chat/getUser.tsx @@ -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 \ No newline at end of file diff --git a/pages/chat.tsx b/pages/chat.tsx index acb22e6..3d78650 100644 --- a/pages/chat.tsx +++ b/pages/chat.tsx @@ -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: () =>

...

, @@ -23,6 +25,7 @@ const buddies = ({ users }: Props) => { const match = users.filter( (userss) => userss.email == user.emailAddresses[0].emailAddress ); + return ( { }, }; }; -export default buddies; +export default buddies; \ No newline at end of file