diff --git a/client/app/(auth)/login/page.jsx b/client/app/(auth)/login/page.jsx index 2eafb27..7cd7056 100644 --- a/client/app/(auth)/login/page.jsx +++ b/client/app/(auth)/login/page.jsx @@ -4,7 +4,7 @@ import Link from 'next/link'; import { useRouter } from 'next/navigation'; import { useState } from 'react'; import { zodResolver } from '@hookform/resolvers/zod'; -import { useForm } from 'react-hook-form'; +import { set, useForm } from 'react-hook-form'; import { z } from 'zod'; import { LoaderCircle } from 'lucide-react'; import { Button } from '@/components/ui/button'; @@ -31,11 +31,7 @@ export default function Page() { const { toast } = useToast(); const form = useForm({ - resolver: zodResolver(formSchema), - defaultValues: { - username: '', - password: '' - } + resolver: zodResolver(formSchema) }); async function onSubmit(values) { @@ -48,6 +44,7 @@ export default function Page() { description: 'bir hata oluştu. lütfen daha sonra tekrar deneyin.', duration: 3000 }); + setIsSubmitting(false); return; } if (response.status === 401) { @@ -56,10 +53,10 @@ export default function Page() { description: 'kullanıcı adı veya parola yanlış.', duration: 3000 }); + setIsSubmitting(false); return; } - form.reset(); setIsSubmitting(false); router.push('/app'); router.refresh(); @@ -105,7 +102,7 @@ export default function Page() { parola - + diff --git a/client/app/app/explore/guilds/page.jsx b/client/app/app/explore/guilds/page.jsx new file mode 100644 index 0000000..202100d --- /dev/null +++ b/client/app/app/explore/guilds/page.jsx @@ -0,0 +1,3 @@ +export default function Page() { + return 'çöplükler'; +} diff --git a/client/app/app/explore/layout-content.jsx b/client/app/app/explore/layout-content.jsx new file mode 100644 index 0000000..c86d300 --- /dev/null +++ b/client/app/app/explore/layout-content.jsx @@ -0,0 +1,39 @@ +'use client'; + +import Link from 'next/link'; +import { usePathname } from 'next/navigation'; +import { motion, AnimatePresence } from 'framer-motion'; +import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'; + +export default function LayoutContent({ children }) { + const pathname = usePathname(); + const path = pathname.split('/')[3]; + + return ( + + + + çöpler + + + çöplükler + + + çöpçüler + + + + + {children} + {children} + {children} + + + + ); +} diff --git a/client/app/app/explore/layout.jsx b/client/app/app/explore/layout.jsx index 9b422a0..175635b 100644 --- a/client/app/app/explore/layout.jsx +++ b/client/app/app/explore/layout.jsx @@ -1,7 +1,9 @@ +import LayoutContent from "@/app/app/explore/layout-content"; + export const metadata = { title: 'keşfet' }; export default function Layout({ children }) { - return children; + return {children}; } diff --git a/client/app/app/explore/page.jsx b/client/app/app/explore/page.jsx deleted file mode 100644 index 93c2abb..0000000 --- a/client/app/app/explore/page.jsx +++ /dev/null @@ -1,36 +0,0 @@ -'use client'; - -import PostList from '@/components/app/Post/List'; -import UserList from '@/components/app/User/List'; -import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'; -import { getPosts } from '@/lib/api/posts'; -import { getUsers } from '@/lib/api/users'; - -export default function Page() { - const fetchUsers = async (offset) => { - return await getUsers(11, offset); - }; - - const fetchPosts = async (offset) => { - return await getPosts(11, offset); - }; - - return ( -
- - - çöpler - çöplükler - çöpçüler - - - - - 2 - - - - -
- ); -} diff --git a/client/app/app/explore/posts/page.jsx b/client/app/app/explore/posts/page.jsx new file mode 100644 index 0000000..009f78b --- /dev/null +++ b/client/app/app/explore/posts/page.jsx @@ -0,0 +1,14 @@ +'use client'; + +import PostList from '@/components/app/Post/List'; +import { getPosts } from '@/lib/api/posts'; + +export default function Page() { + const fetchPosts = async (offset) => { + return await getPosts(11, offset); + }; + + return ( + + ); +} \ No newline at end of file diff --git a/client/app/app/explore/users/page.jsx b/client/app/app/explore/users/page.jsx new file mode 100644 index 0000000..059d630 --- /dev/null +++ b/client/app/app/explore/users/page.jsx @@ -0,0 +1,12 @@ +'use client'; + +import UserList from '@/components/app/User/List'; +import { getUsers } from '@/lib/api/users'; + +export default function Page() { + const fetchUsers = async (offset) => { + return await getUsers(11, offset); + }; + + return ; +} diff --git a/client/app/app/users/[slug]/page.jsx b/client/app/app/users/[slug]/page.jsx index 2529962..6cc77a4 100644 --- a/client/app/app/users/[slug]/page.jsx +++ b/client/app/app/users/[slug]/page.jsx @@ -94,7 +94,7 @@ export default function Page({ params }) { )}
-
çöpler
+
çöpler
diff --git a/client/components/app/Navbar/Collapsed.jsx b/client/components/app/Navbar/Collapsed.jsx index 0b5d572..b0d665c 100644 --- a/client/components/app/Navbar/Collapsed.jsx +++ b/client/components/app/Navbar/Collapsed.jsx @@ -16,7 +16,7 @@ export default function Collapsed({ router, pathname }) { useEffect(() => { if (pathname === '/app') { setIcon(); - } else if (pathname === '/app/explore') { + } else if (pathname.startsWith('/app/explore')) { setIcon(); } else if (pathname === '/app/notifications') { setIcon(); diff --git a/client/components/app/Post/List.jsx b/client/components/app/Post/List.jsx index 82b67cb..353f400 100644 --- a/client/components/app/Post/List.jsx +++ b/client/components/app/Post/List.jsx @@ -8,7 +8,6 @@ export default function PostList({ fetchPosts }) { const [posts, setPosts] = useState([]); const [offset, setOffset] = useState(10); const [hasMorePost, setHasMorePost] = useState(true); - const [loading, setLoading] = useState(false); const { toast } = useToast(); const handleDelete = (postId) => { @@ -43,9 +42,7 @@ export default function PostList({ fetchPosts }) { useEffect(() => { const fetchInitialPosts = async () => { - setLoading(true); const response = await fetchPosts(0); - setLoading(false); if (!response) { toast({ @@ -72,10 +69,7 @@ export default function PostList({ fetchPosts }) { return (
- {loading && ( - - )} - {!loading && posts.length > 0 ? ( + {posts.length > 0 ? ( <> {posts.map((post) => ( @@ -87,11 +81,9 @@ export default function PostList({ fetchPosts }) { )} ) : ( - !loading && ( -
- buralar şimdilik sessiz. -
- ) +
+ buralar şimdilik sessiz. +
)}
); diff --git a/client/next.config.mjs b/client/next.config.mjs index 4b635d6..1570e00 100644 --- a/client/next.config.mjs +++ b/client/next.config.mjs @@ -7,6 +7,11 @@ const nextConfig = { destination: '/app/settings/profile', permanent: true, }, + { + source: '/app/explore', + destination: '/app/explore/posts', + permanent: true, + } ]; } };