Skip to content
This repository was archived by the owner on Nov 7, 2023. It is now read-only.
Merged

Test #28

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
d329686
Deployement api endpoint
dhruv035 Oct 16, 2023
3890114
Deployement get endpoint
dhruv035 Oct 16, 2023
d88b41b
Added Dashboard Elements
Tokenauts Oct 16, 2023
7f7dbaa
Merge pull request #15 from Way2Pay/feature/ConnectLogin
dhruv035 Oct 16, 2023
3726ea6
Merge pull request #16 from Way2Pay/feature/Dashboard
dhruv035 Oct 16, 2023
f0c156c
Updated Dashboard
Tokenauts Oct 16, 2023
3c90ca5
Data Table Update
Tokenauts Oct 16, 2023
1ba7bf0
Merge pull request #17 from Way2Pay/feature/Dashboard
Tokenauts Oct 16, 2023
e5435fa
User Tx Endpoint
dhruv035 Oct 17, 2023
fa07d9d
Push API
dhruv035 Oct 17, 2023
707969d
TsConfig
dhruv035 Oct 17, 2023
54cf561
Chat Page
dhruv035 Oct 17, 2023
f1af3eb
Import Error
dhruv035 Oct 17, 2023
3fba705
Added Login Components
Tokenauts Oct 17, 2023
bf56589
Changes
dhruv035 Oct 17, 2023
cc36417
Merge pull request #18 from Way2Pay/feature/Login
dhruv035 Oct 17, 2023
f517ab5
Merge pull request #19 from Way2Pay/feature/UserProfile
dhruv035 Oct 17, 2023
cfc3c40
Added User Dashboard
Tokenauts Oct 17, 2023
e7e8e89
Context for Push Protocol
dhruv035 Oct 17, 2023
fda5c81
Edit function
dhruv035 Oct 17, 2023
6421242
Merge pull request #21 from Way2Pay/feature/UserDashboard
dhruv035 Oct 17, 2023
62d8ae8
Merge Commit
dhruv035 Oct 17, 2023
cfb05cb
Merge pull request #20 from Way2Pay/feature/UserProfile
dhruv035 Oct 17, 2023
ff61862
FIx
dhruv035 Oct 17, 2023
ba52549
Improved
dhruv035 Oct 17, 2023
bf6d1ad
Testing
dhruv035 Oct 17, 2023
ca25763
Add List
dhruv035 Oct 17, 2023
d14ae47
Connext sdk(in progress)
magus96 Oct 18, 2023
3115a34
Sismo
dhruv035 Oct 18, 2023
8d04d7a
Merge pull request #22 from Way2Pay/feature/Sismo
dhruv035 Oct 18, 2023
02bfdba
Push Error
dhruv035 Oct 18, 2023
6e4fcf0
feature/PushServices
dhruv035 Oct 18, 2023
a4bf88c
Added Chats
Tokenauts Oct 18, 2023
f4e61cd
Merge pull request #23 from Way2Pay/feature/PushServices
dhruv035 Oct 18, 2023
97996eb
Merge branch 'test' into feature/Seller
dhruv035 Oct 18, 2023
9c1d287
Fixed Chats
Tokenauts Oct 18, 2023
6984ac4
added chat functionality
Tokenauts Oct 18, 2023
729cb73
Added Chat Feature
Tokenauts Oct 18, 2023
ee604b3
Merge pull request #24 from Way2Pay/feature/Seller
dhruv035 Oct 18, 2023
64f57a6
Push hotfix
dhruv035 Oct 19, 2023
ad22b3a
CodeConnext
dhruv035 Oct 19, 2023
f6ec9a4
Merge pull request #26 from Way2Pay/feature/connext
dhruv035 Oct 19, 2023
dddc259
Update and fetch profile
dhruv035 Oct 19, 2023
8a0b310
useConnext Hook
dhruv035 Oct 19, 2023
cbfbe0c
Missed Changes
dhruv035 Oct 19, 2023
fce9dd7
Sismo Edit
dhruv035 Oct 19, 2023
ffd0b40
Merge pull request #27 from Way2Pay/feature/RedirectFunctional
dhruv035 Oct 19, 2023
8be9f4d
Update ABI
dhruv035 Oct 19, 2023
fc0b220
Update ABI
dhruv035 Oct 19, 2023
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
237 changes: 237 additions & 0 deletions components/Chats/Chats.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,237 @@
import { chats } from "@pushprotocol/restapi/src/lib/chat";
import React, { useState } from "react";

interface UserProfile {
name: string;
avatar: string;
role: string;
status: string;
}

interface ActiveConversation {
name: string;
avatar: string;
unreadCount?: number;
chatId: string;
did: string; // <-- Add this
}
interface Message {
sender: "self" | "other";
content: string;
timestamp: number;
// Add any other fields you might need
}

interface ChatsProps {
userProfile: UserProfile;
activeConversations: ActiveConversation[];
archivedConversations: ActiveConversation[];
messages: Message[];
onChatSelect: (chatId: string) => void; // Add this line
onSendMessage: (recipientDID: string, content: string) => void; // Add this line
selectedChatId: string | null;
}

const Chats: React.FC<ChatsProps> = ({
userProfile,
activeConversations,
archivedConversations,
messages,
onChatSelect,
onSendMessage,
selectedChatId,
}) => {
const [inputMessage, setInputMessage] = useState("");

const selectedChatDID = activeConversations.find(
(chat) => chat.chatId === selectedChatId
)?.did;
const handleSendClick = () => {
if (selectedChatDID) {
console.log("HERE",selectedChatDID,inputMessage)
onSendMessage(selectedChatDID, inputMessage);
setInputMessage("");
}
};

return (
<div className="flex h-screen antialiased text-gray-800">
<div className="flex flex-row h-full w-full overflow-x-hidden">
<div className="flex flex-col py-8 pl-6 pr-2 w-64 bg-white flex-shrink-0">
<div className="flex flex-row items-center justify-center h-12 w-full">
<div className="flex items-center justify-center rounded-2xl text-indigo-700 bg-indigo-100 h-10 w-10">
<svg
className="w-6 h-6"
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="2"
d="M8 10h.01M12 10h.01M16 10h.01M9 16H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-5l-5 5v-5z"
></path>
</svg>
</div>
<div className="ml-2 font-bold text-2xl">Chat</div>
</div>
<div className="flex flex-col items-center bg-indigo-100 border border-gray-200 mt-4 w-full py-6 px-4 rounded-lg">
<div className="h-20 w-20 rounded-full border overflow-hidden">
<img
src={userProfile.avatar}
alt="User Avatar"
className="h-full w-full"
/>
</div>
<div className="text-sm font-semibold mt-2">{userProfile.name}</div>
<div className="text-xs text-gray-500">{userProfile.role}</div>
<div className="flex flex-row items-center mt-3">
<div className="flex flex-col justify-center h-4 w-8 bg-indigo-500 rounded-full">
<div className="h-3 w-3 bg-white rounded-full self-end mr-1"></div>
</div>
<div className="leading-none ml-1 text-xs">Active</div>
</div>
</div>
<div className="flex flex-col mt-8">
<div className="flex flex-row items-center justify-between text-xs">
<span className="font-bold">Active Conversations</span>
<span className="flex items-center justify-center bg-gray-300 h-4 w-4 rounded-full">
{activeConversations.length}
</span>
</div>
<div className="flex flex-col space-y-1 mt-4 -mx-2 h-48 overflow-y-auto">
{activeConversations.map((conversation) => (
<button
key={conversation.name}
className="flex flex-row items-center hover:bg-gray-100 rounded-xl p-2"
onClick={() => onChatSelect(conversation.chatId)}
>
<div className="ml-2 text-sm font-semibold">
{conversation.name}
</div>
{conversation.unreadCount && (
<div className="flex items-center justify-center ml-auto text-xs text-white bg-red-500 h-4 w-4 rounded leading-none">
{conversation.unreadCount}
</div>
)}
</button>
))}
</div>
</div>
</div>
<div className="flex flex-col flex-auto h-full p-6">
<div className="flex flex-col flex-auto flex-shrink-0 rounded-2xl bg-gray-100 h-full p-4">
<div className="flex flex-col h-full overflow-x-auto mb-4">
<div className="flex flex-col h-full">
<div className="grid grid-cols-12 gap-y-2">
{messages.map((message, index) => {
if (message.sender === "self") {
return (
<div
key={index}
className="col-start-6 col-end-13 p-3 rounded-lg"
>
<div className="flex items-center justify-start flex-row-reverse">
<div className="relative mr-3 text-sm bg-indigo-100 py-2 px-4 shadow rounded-xl">
<div>{message.content}</div>
</div>
</div>
</div>
);
} else {
return (
<div
key={index}
className="col-start-1 col-end-8 p-3 rounded-lg"
>
<div className="flex flex-row items-center">
<div className="relative ml-3 text-sm bg-white py-2 px-4 shadow rounded-xl">
<div>{message.content}</div>
</div>
</div>
</div>
);
}
})}
</div>
</div>
</div>
<div className="flex flex-row items-center h-16 rounded-xl bg-white w-full px-4">
<div>
<button className="flex items-center justify-center text-gray-400 hover:text-gray-600">
<svg
className="w-5 h-5"
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="2"
d="M15.172 7l-6.586 6.586a2 2 0 102.828 2.828l6.414-6.586a4 4 0 00-5.656-5.656l-6.415 6.585a6 6 0 108.486 8.486L20.5 13"
></path>
</svg>
</button>
</div>
<div className="flex-grow ml-4">
<div className="relative w-full">
<input
type="text"
className="flex w-full border rounded-xl focus:outline-none focus:border-indigo-300 pl-4 h-10"
onChange={(e) => setInputMessage(e.target.value)}
/>
<button className="absolute flex items-center justify-center h-full w-12 right-0 top-0 text-gray-400 hover:text-gray-600">
<svg
className="w-6 h-6"
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="2"
d="M14.828 14.828a4 4 0 01-5.656 0M9 10h.01M15 10h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
></path>
</svg>
</button>
</div>
</div>
<div className="ml-4">
<button
onClick={handleSendClick}
className="flex items-center justify-center bg-indigo-500 hover:bg-indigo-600 rounded-xl text-white px-4 py-1 flex-shrink-0"
>
<span>Send</span>
<span className="ml-2">
<svg
className="w-4 h-4 transform rotate-45 -mt-px"
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="2"
d="M12 19l9 2-9-18-9 18 9-2zm0 0v-8"
></path>
</svg>
</span>
</button>
</div>
</div>
</div>
</div>
</div>
</div>
);
};

export default Chats;
46 changes: 46 additions & 0 deletions components/DashBoard/Coins.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import React from "react";

interface CoinsProps {
mode?: "earned" | "spent";
}

const Coins: React.FC<CoinsProps> = ({ mode = "earned" }) => {
const handleMouseEnter = (
event: React.MouseEvent<HTMLVideoElement, MouseEvent>
) => {
const video = event.currentTarget;
video.play();
};

return (
<div>
<section>
<div className="relative items-center w-full px-5 mx-auto md:px-12 lg:px-20 max-w-7xl">
<div className="grid w-full grid-cols-2 mx-auto lg:grid-cols-3">
{["ETH", "USDT", "USDC"].map((coin) => (
<div key={coin} className="max-w-md p-6 mx-auto relative">
<video
onMouseEnter={handleMouseEnter}
muted
src={`${coin}.webm`}
className="w-full h-full object-cover rounded-xl"
/>
<div className="absolute bottom-10 left-1/2 transform -translate-x-1/2 z-10 bg-gray-800 bg-opacity-60 p-4 px-10 rounded-xl ">
<div className="text-lg font-medium leading-6 text-white">
{`Total ${mode.charAt(0).toUpperCase() + mode.slice(1)}`}
<br />
<div className="flex items-center justify-center h-full">
<span className="font-light">{`200 ${coin}`}</span>
</div>
</div>
</div>
</div>
))}
</div>
</div>
</section>
</div>
);
};

export default Coins;
Loading