Skip to content

Commit

Permalink
feat: add Docs and Directory pages, implement ErrorPage, and integrat…
Browse files Browse the repository at this point in the history
…e feedback functionality in Navbar
  • Loading branch information
deepraj21 committed Dec 9, 2024
1 parent 5e24003 commit dd38e30
Show file tree
Hide file tree
Showing 14 changed files with 351 additions and 74 deletions.
7 changes: 6 additions & 1 deletion client/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ import TermsAndConditions from './pages/TermsAndConditions';
import Feed from './pages/Feed';
import UserPosts from './pages/UserPosts';
import ShowPostByID from './components/Posts/ShowPostByID';
import ErrorPage from './pages/ErrorPage';
import Directory from './pages/Directory';
import Docs from './pages/Docs';

const App = () => {
return (
Expand All @@ -31,11 +34,13 @@ const App = () => {
<Route path="/user/:username" element={<Profile />} />
<Route path="/relations/:username" element={<Visualization />} />
<Route path="/feed" element={<Feed />} />
<Route path="/docs" element={<Docs />} />
<Route path="/directory" element={<Directory />} />
<Route path="/posts/:username" element={<UserPosts />} />
<Route path="/post/:postId" element={<ShowPostByID />} />
<Route path="/privacy-policy" element={<PrivacyPolicy/>} />
<Route path="/terms-and-conditions" element={<TermsAndConditions/>}/>
<Route path="*" element={<div>404</div>} />
<Route path="*" element={<ErrorPage/>} />
</Routes>
</Router>
<Toaster richColors closeButton/>
Expand Down
100 changes: 100 additions & 0 deletions client/src/components/Feedback/FeedbackForm.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
import * as React from "react"
import { Star } from "lucide-react"
import { cn } from "@/lib/utils"
import { Button } from "@/components/ui/button"
import { Card, CardContent, CardFooter, CardHeader } from "@/components/ui/card"
import { Textarea } from "@/components/ui/textarea"
import { toast } from "sonner"

const backendUrl = import.meta.env.VITE_BACKEND_URL || "http://localhost:5000"

export function FeedbackForm() {
const [rating, setRating] = React.useState<number>(0)
const [hoveredRating, setHoveredRating] = React.useState<number>(0)
const [message, setMessage] = React.useState("")
const [loading, setLoading] = React.useState(false)
const username = localStorage.getItem("devhub_username") || "Anonymous"

const handleSubmit = async (event: React.FormEvent) => {
event.preventDefault()
setLoading(true)
try {
const response = await fetch(`${backendUrl}/feedback`, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
username,
rating: rating.toString(),
message,
}),
})
const data = await response.json()
if (data.success) {
toast.success("Feedback message sent successfully")
setRating(0)
setMessage("")
} else {
toast.error("Failed to save feedback message")
}
} catch (error) {
toast.error("An error occurred while sending feedback: " + error)
} finally {
setLoading(false)
}
}

return (
<Card className="w-full max-w-md border-none">
<form onSubmit={handleSubmit}>
<CardHeader>
<h2 className="text-center text-xl font-semibold">
Your opinion matters to us!
</h2>
</CardHeader>
<CardContent className="flex flex-col items-center space-y-6">
<div className="flex flex-col items-center space-y-3">
<span className="text-lg text-muted-foreground">
How was your experience?
</span>
<div className="flex space-x-2">
{[1, 2, 3, 4, 5].map((star) => (
<button
key={star}
type="button"
className="focus-visible:outline-none"
onClick={() => setRating(star)}
onMouseEnter={() => setHoveredRating(star)}
onMouseLeave={() => setHoveredRating(0)}
>
<Star
className={cn(
"h-8 w-8 transition-colors",
(hoveredRating || rating) >= star
? "fill-primary text-primary"
: "fill-muted text-muted"
)}
/>
<span className="sr-only">Rate {star} stars</span>
</button>
))}
</div>
</div>
<Textarea
placeholder="Leave a message..."
value={message}
onChange={(e) => setMessage(e.target.value)}
className="w-full"
disabled={loading}
/>
</CardContent>
<CardFooter className="flex justify-center">
<Button type="submit" disabled={loading}>
{loading ? "Submitting..." : "Submit"}
</Button>
</CardFooter>
</form>
</Card>
)
}
52 changes: 36 additions & 16 deletions client/src/components/Footer/Footer.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
import { Link } from "react-router-dom"
import { ModeToggle } from "../Theme/mode-toggle"
import {
AlertDialog,
AlertDialogCancel,
AlertDialogHeader,
AlertDialogContent,
AlertDialogTrigger
} from "@/components/ui/alert-dialog";
import { Cross1Icon } from "@radix-ui/react-icons";
import { FeedbackForm } from "@/components/Feedback/FeedbackForm"

const Footer = () => {
return (
Expand All @@ -15,36 +24,47 @@ const Footer = () => {
<div>
<h3 className="font-semibold mb-3">Resources</h3>
<ul className="space-y-2">
<li><Link to="/docs" className="text-white-400 ">Docs</Link></li>
<li><Link to="/cookbook" className="text-white-400 ">Cookbook</Link></li>
<li><Link to="/providers" className="text-white-400 ">Providers</Link></li>
<li><Link to="/showcase" className="text-white-400 ">Showcase</Link></li>
<li><Link to="/github" className="text-white-400 ">GitHub</Link></li>
<li><Link to="/discussions" className="text-white-400 ">Discussions</Link></li>
<li><Link to="/docs" className="text-white-400 text-sm">Docs</Link></li>
<li><Link to="#features" className="text-white-400 text-sm">Features</Link></li>
<li><Link to="/feed" className="text-white-400 text-sm">Feed</Link></li>
<li><Link to="/directory" className="text-white-400 text-sm">Directory</Link></li>
</ul>
</div>
<div>
<h3 className="font-semibold mb-3">More</h3>
<ul className="space-y-2">
<li><Link to="/playground" className="text-white-400 ">Playground</Link></li>
<li><Link to="/v0" className="text-white-400 ">v0</Link></li>
<li><Link to="/contact" className="text-white-400 ">Contact Sales</Link></li>
<li><Link to="/x" className="text-white-400 ">X</Link></li>
<li>
<AlertDialog>
<AlertDialogTrigger>
Feedback
</AlertDialogTrigger>
<AlertDialogContent>
<div className='flex items-center'>
<AlertDialogHeader className='text-2xl'>Feedback Form</AlertDialogHeader>
<div className='flex-grow'></div>
<AlertDialogCancel className="ml-6"><Cross1Icon className='h-3 w-3' /></AlertDialogCancel>
</div>
<FeedbackForm />
</AlertDialogContent>
</AlertDialog>
</li>
<li><Link to="/playground" className="text-white-400 text-sm">DevBots</Link></li>
<li><Link to="/v0" className="text-white-400 text-sm">DevMap</Link></li>
</ul>
</div>
<div>
<h3 className="font-semibold mb-3">About Vercel</h3>
<h3 className="font-semibold mb-3">Contact</h3>
<ul className="space-y-2">
<li><Link to="/nextjs" className="text-white-400 ">Next.js + Vercel</Link></li>
<li><Link to="/open-source" className="text-white-400 ">Open Source Software</Link></li>
<li><Link to="/github" className="text-white-400 ">GitHub</Link></li>
<li><Link to="/x" className="text-white-400 ">X</Link></li>
<li><Link to="https://github.com/devhub-ai/devhub" className="text-white-400 text-sm">GitHub</Link></li>
<li><Link to="/github" className="text-white-400 text-sm">Linkedin</Link></li>
<li><Link to="/x" className="text-white-400 text-sm">X</Link></li>
</ul>
</div>
<div>
<h3 className="font-semibold mb-3">Legal</h3>
<ul className="space-y-2">
<li><Link to="/privacy" className="text-white-400 ">Privacy Policy</Link></li>
<li><Link to="/privacy-policy" className="text-white-400 text-sm">Privacy Policy</Link></li>
<li><Link to="/terms-and-conditions" className="text-white-400 text-sm">Terms & Conditions</Link></li>
</ul>
</div>
</div>
Expand Down
81 changes: 51 additions & 30 deletions client/src/components/Hero/Hero.tsx
Original file line number Diff line number Diff line change
@@ -1,75 +1,96 @@
import { UserSearch, MessagesSquare, FolderOpen, ChartNetwork, UserPen, GalleryVerticalEnd } from 'lucide-react';

export function Hero() {
return (
<div className="grid md:grid-cols-2 lg:grid-cols-3 gap-6 w-full md:w-[60%]">

<div className="bg-zinc-950 rounded-lg">
<div className="relative h-48 bg-black rounded-tl-lg rounded-tr-lg p-4 overflow-hidden">
<img src="https://i.ibb.co/tx4dhcj/Screenshot-2024-12-09-131735.png" alt="" className="object-cover h-full w-full transition-transform duration-300 group-hover:scale-105" />
<div className="bg-zinc-800 rounded-lg">
<div className="relative h-48 bg-black rounded-tl-lg rounded-tr-lg overflow-hidden p-2">
<img src="https://i.ibb.co/tx4dhcj/Screenshot-2024-12-09-131735.png" alt="" className="object-cover h-full w-full transition-transform duration-300 group-hover:scale-105 rounded-[5px]"/>
</div>
<div className="p-6 bg-zinc-800 rounded-bl-lg rounded-br-lg">
<h3 className="text-lg font-semibold">Unified Provider API</h3>
<div className='flex flex-row gap-x-2 items-center'>
<UserSearch className='h-5 w-5 text-zinc-200'/>
<h3 className="text-lg font-semibold text-zinc-200">Search and Recomendations</h3>
</div>
<p className="text-sm text-zinc-400">
Switch between AI providers by changing a single line of code.
Find People and recommendations based on skillset and prjects.
</p>
</div>
</div>

<div className="bg-zinc-950 rounded-lg">
<div className="relative h-48 bg-black rounded-tl-lg rounded-tr-lg p-4">
<img src="https://i.ibb.co/GdMdhts/Screenshot-2024-12-09-131307.png" alt="" className="object-cover h-full w-full transition-transform duration-300 group-hover:scale-105" />
<div className="bg-zinc-800 rounded-lg">
<div className="relative h-48 bg-black rounded-tl-lg rounded-tr-lg overflow-hidden p-2">
<img src="https://i.ibb.co/GdMdhts/Screenshot-2024-12-09-131307.png" alt="" className="object-cover h-full w-full transition-transform duration-300 group-hover:scale-105 rounded-[5px]" />
</div>
<div className="p-6 bg-zinc-800 rounded-bl-lg rounded-br-lg">
<h3 className="text-lg font-semibold">Generative UI</h3>
<div className='flex flex-row gap-x-2 items-center'>
<MessagesSquare className='h-5 w-5 text-zinc-200'/>
<h3 className="text-lg font-semibold text-zinc-200">Chat with People</h3>
</div>
<p className="text-sm text-zinc-400">
Create dynamic, AI-powered user interfaces that amaze your users.
Find People from list and start conversation with developers.
</p>
</div>
</div>

<div className="bg-zinc-950 rounded-lg">
<div className="relative h-48 bg-black rounded-tl-lg rounded-tr-lg p-4 overflow-hidden">
<img src="https://i.ibb.co/zhFXyWh/Screenshot-2024-12-09-101722.png" alt="" className="object-cover h-full w-full transition-transform duration-300 group-hover:scale-105" />
<div className="bg-zinc-800 rounded-lg">
<div className="relative h-48 bg-black rounded-tl-lg rounded-tr-lg overflow-hidden p-2">
<img src="https://i.ibb.co/zhFXyWh/Screenshot-2024-12-09-101722.png" alt="" className="object-cover h-full w-full transition-transform duration-300 group-hover:scale-105 rounded-[5px]"/>
</div>
<div className="p-6 bg-zinc-800 rounded-bl-lg rounded-br-lg">
<h3 className="text-lg font-semibold">Framework-agnostic</h3>
<div className='flex flex-row gap-x-2 items-center'>
<FolderOpen className='h-5 w-5 text-zinc-200'/>
<h3 className="text-lg font-semibold text-zinc-200">Showcase Projects</h3>
</div>
<p className="text-sm text-zinc-400">
Build with React, Next, Vue, Nuxt, SvelteKit, and more.
Add, Share and Star projects of your and others and show your skills.
</p>
</div>
</div>

<div className="bg-zinc-950 rounded-lg">
<div className="relative h-48 bg-black rounded-tl-lg rounded-tr-lg p-4 overflow-hidden">
<img src="https://i.ibb.co/GJ561rC/Screenshot-2024-12-09-125415.png" alt="" className="object-cover h-full w-full transition-transform duration-300 group-hover:scale-105" />
<div className="bg-zinc-800 rounded-lg">
<div className="relative h-48 bg-black rounded-tl-lg rounded-tr-lg p-2 overflow-hidden">
<img src="https://i.ibb.co/GJ561rC/Screenshot-2024-12-09-125415.png" alt="" className="object-cover h-full w-full transition-transform duration-300 group-hover:scale-105 rounded-[5px]"/>
</div>
<div className="p-6 bg-zinc-800 rounded-bl-lg rounded-br-lg">
<h3 className="text-lg font-semibold">Streaming AI Responses</h3>
<div className='flex flex-row gap-x-2 items-center'>
<ChartNetwork className='h-5 w-5 text-zinc-200'/>
<h3 className="text-lg font-semibold text-zinc-200">Connections as Nodes</h3>
</div>

<p className="text-sm text-zinc-400">
Don&apos;t let your users wait for AI responses. Send them instantly.
See your Connections and projects as nodes and execute Neo4j Queries.
</p>
</div>
</div>

<div className="bg-zinc-950 rounded-lg">
<div className="relative h-48 bg-black rounded-tl-lg rounded-tr-lg p-4 overflow-hidden">
<img src="https://i.ibb.co/MM1jQrz/Screenshot-2024-12-09-125706.png" alt="" className="object-cover h-full w-full transition-transform duration-300 group-hover:scale-105" />
<div className="bg-zinc-800 rounded-lg">
<div className="relative h-48 bg-black rounded-tl-lg rounded-tr-lg p-2 overflow-hidden">
<img src="https://i.ibb.co/MM1jQrz/Screenshot-2024-12-09-125706.png" alt="" className="object-cover h-full w-full transition-transform duration-300 group-hover:scale-105 rounded-[5px]"/>
</div>
<div className="p-6 bg-zinc-800 rounded-bl-lg rounded-br-lg">
<h3 className="text-lg font-semibold">Streaming AI Responses</h3>
<div className='flex flex-row gap-x-2 items-center'>
<GalleryVerticalEnd className='h-5 w-5 text-zinc-200'/>
<h3 className="text-lg font-semibold text-zinc-200">Feed and Posts</h3>
</div>
<p className="text-sm text-zinc-400">
Don&apos;t let your users wait for AI responses. Send them instantly.
Add, Share, Upvote, Downvote, comment on Posts and updated Feed.
</p>
</div>
</div>

<div className="bg-zinc-950 rounded-lg ">
<div className="relative h-48 bg-black rounded-tl-lg rounded-tr-lg p-4 overflow-hidden">
<img src="https://i.ibb.co/XCWQVQ1/Screenshot-2024-12-09-125857.png" alt="" className="object-cover h-full w-full transition-transform duration-300 group-hover:scale-105" />
<div className="bg-zinc-800 rounded-lg ">
<div className="relative h-48 bg-black rounded-tl-lg rounded-tr-lg p-2 overflow-hidden">
<img src="https://i.ibb.co/XCWQVQ1/Screenshot-2024-12-09-125857.png" alt="" className="object-cover h-full w-full transition-transform duration-300 group-hover:scale-105 rounded-[5px]"/>
</div>
<div className="p-6 bg-zinc-800 rounded-bl-lg rounded-br-lg">
<h3 className="text-lg font-semibold">Streaming AI Responses</h3>
<div className='flex flex-row gap-x-2 items-center'>
<UserPen className='h-5 w-5 text-zinc-200'/>
<h3 className="text-lg font-semibold text-zinc-200">Sharble Profile</h3>
</div>
<p className="text-sm text-zinc-400">
Don&apos;t let your users wait for AI responses. Send them instantly.
Update, Follow and share your profiles with others.
</p>
</div>
</div>
Expand Down
Loading

0 comments on commit dd38e30

Please sign in to comment.