diff --git a/ngrok-v3-stable-linux-amd64.tgz.1 b/ngrok-v3-stable-linux-amd64.tgz.1 new file mode 100644 index 0000000..4dee14f Binary files /dev/null and b/ngrok-v3-stable-linux-amd64.tgz.1 differ diff --git a/packages/nextjs/app/login/page.tsx b/packages/nextjs/app/login/page.tsx index 8e9970e..f60532f 100644 --- a/packages/nextjs/app/login/page.tsx +++ b/packages/nextjs/app/login/page.tsx @@ -12,7 +12,7 @@ const LoginPage = () => { const handleSignUp = () => { setIsLoading(true); // const localUrl = "http://localhost:3000"; - const localUrl = "https://08de-14-195-142-82.ngrok-free.app" + const localUrl = "https://62a2-14-195-142-82.ngrok-free.app" window.location.href = `https://small-mouse-2759.arnabbhowmik019.workers.dev/google/auth?redirect_url=${encodeURIComponent(localUrl)}/`; }; diff --git a/packages/nextjs/components/ChatSearchBar.tsx b/packages/nextjs/components/ChatSearchBar.tsx index 384959c..db84926 100644 --- a/packages/nextjs/components/ChatSearchBar.tsx +++ b/packages/nextjs/components/ChatSearchBar.tsx @@ -1,3 +1,308 @@ +// import { FC, useEffect, useState } from "react"; +// import { AnimatePresence, motion } from "framer-motion"; +// import { +// SparklesIcon, +// PaperAirplaneIcon, +// TrophyIcon, +// XMarkIcon, +// VideoCameraIcon, +// GiftIcon +// } from "@heroicons/react/24/outline"; +// import { useAccount } from "wagmi"; + +// interface Message { +// text: string; +// isUser: boolean; +// blockchainInsights?: any; +// isNFTMinted?: boolean; +// isTyping?: boolean; +// } + +// const TypingIndicator = () => { +//
+//
+//
+//
+//
+// } + +// const ChatSearchBar: FC = () => { +// const [isChat, setIsChat] = useState(false); +// const [inputText, setInputText] = useState(""); +// const [messages, setMessages] = useState([]); +// const [isLoading, setIsLoading] = useState(false); +// const [showCTA, setShowCTA] = useState(false); +// const [showNFTButton, setShowNFTButton] = useState(false); + +// const { address } = useAccount(); +// const stepCount = 2000; + +// useEffect(() => { +// const timer = setTimeout(() => setShowCTA(true), 2000); +// return () => clearTimeout(timer); +// }, []); + +// const dailyChallenges = `Today's Challenges 🏋️‍♂️:\n +// 1. 10 Push-ups\n +// 2. 20 Sit-ups\n +// 3. 30 Jumping Jacks\n +// 4. 1 minute Plank\n +// 5. 20 Squats\n +// Complete these exercises to earn exciting NFTS!! +// Just Upload your video to participate`; + +// const handleDailyChallenges = () => { +// setIsChat(true); +// setShowCTA(false); +// setMessages([ +// { +// text: dailyChallenges, +// isUser: false, +// }, +// ]); +// }; + +// const handleViewNFT = () => { +// // Replace with your NFT marketplace URL +// window.open('http://localhost:3000/market', '_blank'); +// }; + +// const handleSubmit = async (e: React.FormEvent) => { +// setInputText(""); +// e.preventDefault(); +// if (!inputText.trim() || isLoading) return; + +// setIsLoading(true); +// setMessages(prev => [ +// ...prev, +// { text: inputText, isUser: true }, +// { text: "", isUser: false, isTyping: true } +// ]); + +// try { +// const imageUrls = [ +// 'https://walrus-ms.onrender.com/retrieve/PAnhlbndMMhGpbGYbJn24mbllXwYKXNzICe5oWACaYQ', +// 'https://walrus-ms.onrender.com/retrieve/KQ7VGN23gif1in3I0wVETV6tiqtwBmLF1vla8GNauH8', +// 'https://walrus-ms.onrender.com/retrieve/5I1DYglEocvcA0nX0uPClHEBFFxz4a7YspbtoeihcvI', +// 'https://walrus-ms.onrender.com/retrieve/PQBo7gopc9yluoClAAVZo1OHEw9TZYEkG911WhlqWQ4', +// 'https://walrus-ms.onrender.com/retrieve/CPLblXHG0sLkPIlK5vxWodC-jm_W8LsseymVgMle2sg' +// ]; +// const randomImageUrl = imageUrls[Math.floor(Math.random() * imageUrls.length)]; +// const enhancedInput = `${inputText}(my address=${address} & my steps=${stepCount}, USE ONLY IF NEDDED)`; +// const response = await fetch("https://0b91-14-195-142-82.ngrok-free.app/chat", { +// method: "POST", +// headers: { +// "Content-Type": "application/json", +// }, +// body: JSON.stringify({ message: enhancedInput }), +// }); + +// if (!response.ok) throw new Error("Network response was not ok"); + +// const data = await response.json(); +// const isNFTMinted = data.response.includes("NFT minted successfully"); + +// setMessages(prev => [ +// ...prev, +// { +// text: data.response, +// isUser: false, +// blockchainInsights: data.blockchain_insights, +// isNFTMinted +// }, +// ]); + +// if (isNFTMinted) { +// setShowNFTButton(true); +// } + +// } catch (error) { +// setMessages(prev => [...prev, { text: "Sorry, there was an error processing your request.", isUser: false }]); +// } finally { +// setIsLoading(false); +// setInputText(""); +// } +// }; + +// const handleVideoUploadClick = () => { +// document.getElementById("video-upload-input")?.click(); +// }; + +// const handleFileChange = async (event: React.ChangeEvent) => { +// const file = event.target.files?.[0]; +// if (file) { +// const formData = new FormData(); +// formData.append('file', file); +// formData.append('WalletAddress', address || ''); +// formData.append('description', "Pushups rush!!"); + +// const imageUrls = [ +// 'https://walrus-ms.onrender.com/retrieve/PAnhlbndMMhGpbGYbJn24mbllXwYKXNzICe5oWACaYQ', +// 'https://walrus-ms.onrender.com/retrieve/KQ7VGN23gif1in3I0wVETV6tiqtwBmLF1vla8GNauH8', +// 'https://walrus-ms.onrender.com/retrieve/5I1DYglEocvcA0nX0uPClHEBFFxz4a7YspbtoeihcvI' +// ]; +// const randomImageUrl = imageUrls[Math.floor(Math.random() * imageUrls.length)]; +// formData.append('image_url', randomImageUrl); + +// setIsLoading(true); +// try { +// const response = await fetch('http://ai.thearnab.tech:5000/upload', { +// method: 'POST', +// body: formData, +// }); + +// if (!response.ok) { +// throw new Error('File upload failed'); +// } +// console.log('File uploaded successfully'); +// } catch (error) { +// console.error('Error uploading file:', error); +// } finally { +// setIsLoading(false); +// } +// } +// }; + +// return ( +// <> +// +// {showCTA && !isChat && ( +// +// +//
+//
+// +//

Daily Challenge is here! 💪

+//
+//
+//
+//
+//
+//
+// )} +//
+ +//
+// {isChat && ( +//
+//

Chat Assistant

+// +//
+// )} + +//
+// {messages.map((message, index) => ( +//
+//
+// {message.text} +// {message.isNFTMinted && ( +// +// )} +// {message.blockchainInsights && ( +//
+//

Blockchain Insights:

+//
{JSON.stringify(message.blockchainInsights, null, 2)}
+//
+// )} +//
+//
+// ))} +//
+ +//
+//
+// + +//
+// setInputText(e.target.value)} +// onFocus={() => setIsChat(true)} +// className="w-full px-4 py-2 rounded-xl bg-[#000001] text-[#fbf8fe] +// placeholder-[#a3a2a7] focus:outline-none focus:ring-2 focus:ring-[#11ce6f]" +// disabled={isLoading} +// /> +// {!isChat && ( +// +// )} +//
+ +// {isChat && ( +//
+// +// +//
+// )} +// +//
+//
+//
+// +// ); +// }; + +// export default ChatSearchBar; + import { FC, useEffect, useState } from "react"; import { AnimatePresence, motion } from "framer-motion"; import { @@ -15,8 +320,17 @@ interface Message { isUser: boolean; blockchainInsights?: any; isNFTMinted?: boolean; + isTyping?: boolean; } +const TypingIndicator = () => ( +
+
+
+
+
+); + const ChatSearchBar: FC = () => { const [isChat, setIsChat] = useState(false); const [inputText, setInputText] = useState(""); @@ -54,8 +368,7 @@ Just Upload your video to participate`; }; const handleViewNFT = () => { - // Replace with your NFT marketplace URL - window.open('https://your-nft-marketplace.com', '_blank'); + window.open('http://localhost:3000/market', '_blank'); }; const handleSubmit = async (e: React.FormEvent) => { @@ -64,11 +377,23 @@ Just Upload your video to participate`; if (!inputText.trim() || isLoading) return; setIsLoading(true); - setMessages(prev => [...prev, { text: inputText, isUser: true }]); + setMessages(prev => [ + ...prev, + { text: inputText, isUser: true }, + { text: "", isUser: false, isTyping: true } + ]); try { - const enhancedInput = `${inputText}(my address=${address} my steps=${stepCount} USE ONLY IF RELEVENT)`; - const response = await fetch("http://ai.thearnab.tech:8000/chat", { + const imageUrls = [ + 'https://walrus-ms.onrender.com/retrieve/PAnhlbndMMhGpbGYbJn24mbllXwYKXNzICe5oWACaYQ', + 'https://walrus-ms.onrender.com/retrieve/KQ7VGN23gif1in3I0wVETV6tiqtwBmLF1vla8GNauH8', + 'https://walrus-ms.onrender.com/retrieve/5I1DYglEocvcA0nX0uPClHEBFFxz4a7YspbtoeihcvI', + 'https://walrus-ms.onrender.com/retrieve/PQBo7gopc9yluoClAAVZo1OHEw9TZYEkG911WhlqWQ4', + 'https://walrus-ms.onrender.com/retrieve/CPLblXHG0sLkPIlK5vxWodC-jm_W8LsseymVgMle2sg' + ]; + const randomImageUrl = imageUrls[Math.floor(Math.random() * imageUrls.length)]; + const enhancedInput = `${inputText}(my address=${address} & my steps=${stepCount}, USE ONLY IF NEDDED)`; + const response = await fetch("https://0b91-14-195-142-82.ngrok-free.app/chat", { method: "POST", headers: { "Content-Type": "application/json", @@ -81,29 +406,34 @@ Just Upload your video to participate`; const data = await response.json(); const isNFTMinted = data.response.includes("NFT minted successfully"); - setMessages(prev => [ - ...prev, - { + setMessages(prev => prev + .filter(msg => !msg.isTyping) + .concat({ text: data.response, isUser: false, blockchainInsights: data.blockchain_insights, isNFTMinted - }, - ]); + }) + ); if (isNFTMinted) { setShowNFTButton(true); } } catch (error) { - setMessages(prev => [...prev, { text: "Sorry, there was an error processing your request.", isUser: false }]); + setMessages(prev => prev + .filter(msg => !msg.isTyping) + .concat({ + text: "Sorry, there was an error processing your request.", + isUser: false + }) + ); } finally { setIsLoading(false); setInputText(""); } }; - - const handleVideoUploadClick = () => { + const handleVideoUploadClick = () => { document.getElementById("video-upload-input")?.click(); }; @@ -202,24 +532,28 @@ Just Upload your video to participate`;
{messages.map((message, index) => (
-
- {message.text} - {message.isNFTMinted && ( - - )} - {message.blockchainInsights && ( -
-

Blockchain Insights:

-
{JSON.stringify(message.blockchainInsights, null, 2)}
-
- )} -
+ {message.isTyping ? ( + + ) : ( +
+ {message.text} + {message.isNFTMinted && ( + + )} + {message.blockchainInsights && ( +
+

Blockchain Insights:

+
{JSON.stringify(message.blockchainInsights, null, 2)}
+
+ )} +
+ )}
))}
diff --git a/packages/nextjs/components/NewHeader.tsx b/packages/nextjs/components/NewHeader.tsx index 1398436..24ea568 100644 --- a/packages/nextjs/components/NewHeader.tsx +++ b/packages/nextjs/components/NewHeader.tsx @@ -2,6 +2,7 @@ import React from "react"; import Image from "next/image"; import "./Header.css"; import { ConnectButton } from "@rainbow-me/rainbowkit"; +import { useRouter } from "next/navigation"; interface Chain { hasIcon: boolean; @@ -24,6 +25,13 @@ interface CustomConnectButtonProps { } export const NewHeader = () => { + + const router = useRouter(); + + const handleLogoClick = () => { + router.push("/market"); + }; + return (
{/* Left side - Logo */} @@ -34,6 +42,7 @@ export const NewHeader = () => { width={70} height={70} className="rounded-full" + onClick={()=>handleLogoClick} />
diff --git a/packages/nextjs/public/logo.svg b/packages/nextjs/public/logo.svg deleted file mode 100644 index 93e4b40..0000000 --- a/packages/nextjs/public/logo.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - -