Skip to content

Commit 1f5a519

Browse files
functionality working
1 parent 3027f0b commit 1f5a519

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+3421
-143
lines changed

package-lock.json

Lines changed: 34 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"framer-motion": "^12.5.0",
2323
"immer": "^10.1.1",
2424
"lucide-react": "^0.483.0",
25+
"motion": "^12.6.2",
2526
"next": "15.2.3",
2627
"node-appwrite": "^15.0.1",
2728
"react": "^19.0.0",
@@ -34,7 +35,7 @@
3435
"@eslint/eslintrc": "^3",
3536
"@tailwindcss/postcss": "^4",
3637
"@types/node": "^20",
37-
"@types/react": "^19",
38+
"@types/react": "^19.0.12",
3839
"@types/react-dom": "^19",
3940
"eslint": "^9",
4041
"eslint-config-next": "15.2.3",

src/(auth)/layout.tsx renamed to src/app/(auth)/layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"use client";
22
import { useAuthStore } from "@/store/Auth";
3-
import { useRouter } from "next/router";
3+
import { useRouter } from "next/navigation";
44
import React from "react";
55
import { BackgroundBeams } from "@/components/ui/background-beams";
66

src/(auth)/login/page.tsx renamed to src/app/(auth)/login/page.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { Input } from "@/components/ui/input";
44
import { cn } from "@/lib/utils";
55
import { IconBrandGithub, IconBrandGoogle } from "@tabler/icons-react";
66
import { useAuthStore } from '@/store/Auth'
7-
import { useRouter } from 'next/router';
7+
import { useRouter } from 'next/navigation';
88
import React from 'react'
99
import Link from "next/link";
1010

@@ -80,7 +80,7 @@ export default function Loginpage() {
8080
<LabelInputContainer className="mb-4">
8181
<Label htmlFor="email">Email Address</Label>
8282
<Input
83-
className="text-black"
83+
className="text-white"
8484
id="email"
8585
name="email"
8686
placeholder="projectmayhem@fc.com"
@@ -89,7 +89,7 @@ export default function Loginpage() {
8989
</LabelInputContainer>
9090
<LabelInputContainer className="mb-4">
9191
<Label htmlFor="password">Password</Label>
92-
<Input className="text-black" id="password" name="password" placeholder="••••••••" type="password" />
92+
<Input className="text-white" id="password" name="password" placeholder="••••••••" type="password" />
9393
</LabelInputContainer>
9494

9595
<button

src/(auth)/register/page.tsx renamed to src/app/(auth)/register/page.tsx

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ export default function Registerpage() {
4949
try {
5050
setIsLoading(true);
5151
setError("")
52-
const res = await createAccount(name, email, password);
52+
const res = await createAccount(email, password, name);
53+
console.log(res)
5354
if(res.error){
5455
setError(res.error!.message);
5556
}else{
@@ -83,18 +84,15 @@ export default function Registerpage() {
8384
<form className="my-8" onSubmit={handleSubmit}>
8485
<div className="mb-4 flex flex-col space-y-2 md:flex-row md:space-x-2 md:space-y-0">
8586
<LabelInputContainer>
86-
<Label htmlFor="firstname">First name</Label>
87-
<Input className="text-black" id="firstname" name="firstname" placeholder="Tyler" type="text" />
88-
</LabelInputContainer>
89-
<LabelInputContainer>
90-
<Label htmlFor="lastname">Last name</Label>
91-
<Input className="text-black" id="lastname" name="lastname" placeholder="Durden" type="text" />
87+
<Label htmlFor="name">First name</Label>
88+
<Input className="text-white" id="name" name="name" placeholder="Tyler" type="text" />
9289
</LabelInputContainer>
90+
9391
</div>
9492
<LabelInputContainer className="mb-4">
9593
<Label htmlFor="email">Email Address</Label>
9694
<Input
97-
className="text-black"
95+
className="text-white"
9896
id="email"
9997
name="email"
10098
placeholder="projectmayhem@fc.com"
@@ -103,7 +101,7 @@ export default function Registerpage() {
103101
</LabelInputContainer>
104102
<LabelInputContainer className="mb-4">
105103
<Label htmlFor="password">Password</Label>
106-
<Input className="text-black" id="password" name="password" placeholder="••••••••" type="password" />
104+
<Input className="text-white" id="password" name="password" placeholder="••••••••" type="password" />
107105
</LabelInputContainer>
108106

109107
<button

src/app/api/answer/route.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,18 @@ import {UserPrefs} from "@/store/Auth";
77

88
export async function POST(request: NextRequest){
99
try {
10-
const {questionId, content, authorId} = await request.json();
10+
const {questionId, answer, authorId} = await request.json();
11+
console.log(questionId)
12+
console.log(answer)
13+
console.log(authorId)
1114

1215
const response = await databases.createDocument(db, answerCollection, ID.unique(),
1316
{
14-
content: content,
17+
content: answer,
1518
authorId: authorId,
1619
questionId: questionId
1720
})
18-
//increase author rputation
21+
//increase author reputation
1922
const prefs = await users.getPrefs<UserPrefs>(authorId)
2023
await users.updatePrefs(authorId,
2124
{reputation: Number(prefs.reputation) + 1}

src/app/components/Footer.tsx

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import React from "react";
2+
import {AnimatedGridPattern} from "@/components/magicui/animated-grid-pattern";
3+
import { cn } from "@/lib/utils";
4+
import Link from "next/link";
5+
6+
const Footer = () => {
7+
const items = [
8+
{
9+
title: "Home",
10+
href: "/",
11+
},
12+
{
13+
title: "About",
14+
href: "/about",
15+
},
16+
{
17+
title: "Privacy Policy",
18+
href: "/privacy-policy",
19+
},
20+
{
21+
title: "Terms of Service",
22+
href: "/terms-of-service",
23+
},
24+
{
25+
title: "Questions",
26+
href: "/questions",
27+
},
28+
];
29+
return (
30+
<footer className="relative block overflow-hidden border-t border-solid border-white/30 py-20">
31+
<div className="container mx-auto px-4">
32+
<ul className="flex flex-wrap items-center justify-center gap-3">
33+
{items.map(item => (
34+
<li key={item.href}>
35+
<Link href={item.href}>{item.title}</Link>
36+
</li>
37+
))}
38+
</ul>
39+
<div className="mt-4 text-center">&copy; {new Date().getFullYear()} Riverpod</div>
40+
</div>
41+
<AnimatedGridPattern
42+
numSquares={30}
43+
maxOpacity={0.4}
44+
duration={3}
45+
repeatDelay={1}
46+
className={cn(
47+
"[mask-image:radial-gradient(3000px_circle_at_center,white,transparent)]",
48+
"inset-y-[-50%] h-[200%] skew-y-6"
49+
)}
50+
/>
51+
</footer>
52+
);
53+
};
54+
55+
export default Footer;

src/app/components/Header.tsx

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
"use client";
2+
import React from "react";
3+
import { FloatingNav } from "@/components/ui/floating-navbar";
4+
import { IconHome, IconMessage, IconWorldQuestion } from "@tabler/icons-react";
5+
import { useAuthStore } from "@/store/Auth";
6+
import slugify from "@/utils/slugify";
7+
8+
export default function Header() {
9+
const { user } = useAuthStore();
10+
11+
const navItems = [
12+
{
13+
name: "Home",
14+
link: "/",
15+
icon: <IconHome className="h-4 w-4 text-neutral-500 dark:text-white" />,
16+
},
17+
{
18+
name: "Questions",
19+
link: "/questions",
20+
icon: <IconWorldQuestion className="h-4 w-4 text-neutral-500 dark:text-white" />,
21+
},
22+
];
23+
24+
if (user)
25+
navItems.push({
26+
name: "Profile",
27+
link: `/users/${user.$id}/${slugify(user.name)}`,
28+
icon: <IconMessage className="h-4 w-4 text-neutral-500 dark:text-white" />,
29+
});
30+
31+
return (
32+
<div className="relative w-full">
33+
<FloatingNav navItems={navItems} />
34+
</div>
35+
);
36+
}

src/app/components/HeroSection.tsx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import React from "react";
2+
import { HeroParallax } from "@/components/ui/hero-parallax";
3+
import { databases } from "@/models/server/config";
4+
import { db, questionAttachmentbucket, questionCollection } from "@/models/name";
5+
import { Query } from "node-appwrite";
6+
import slugify from "@/utils/slugify";
7+
import { storage } from "@/models/client/config";
8+
import HeroSectionHeader from "./HeroSectionHeader";
9+
10+
export default async function HeroSection() {
11+
const questions = await databases.listDocuments(db, questionCollection, [
12+
Query.orderDesc("$createdAt"),
13+
Query.limit(15),
14+
]);
15+
16+
return (
17+
<HeroParallax
18+
header={<HeroSectionHeader />}
19+
products={questions.documents.map(q => ({
20+
title: q.title,
21+
link: `/questions/${q.$id}/${slugify(q.title)}`,
22+
thumbnail: storage.getFilePreview(questionAttachmentbucket, q.attachmentId),
23+
}))}
24+
/>
25+
);
26+
}

0 commit comments

Comments
 (0)