Skip to content

Commit

Permalink
feat: loader implemented and minor ui fixes + small copyright
Browse files Browse the repository at this point in the history
  • Loading branch information
Sanchitbajaj02 committed Dec 23, 2023
1 parent 5e00503 commit 6b8db1a
Show file tree
Hide file tree
Showing 12 changed files with 54 additions and 14 deletions.
1 change: 0 additions & 1 deletion src/app/feed/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import Feed from "@/components/pages/feed";
import Navbar from "@/components/core/navbar";

Expand Down
23 changes: 23 additions & 0 deletions src/app/loading.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
export default function Loader() {
return (
<div className="text-center">
<svg
aria-hidden="true"
className="inline w-12 h-12 animate-spin text-gray-300 dark:text-gray-600 fill-primary"
viewBox="0 0 100 101"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z"
fill="currentColor"
/>
<path
d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z"
fill="currentFill"
/>
</svg>
<span className="sr-only">Loading...</span>
</div>
);
}
2 changes: 1 addition & 1 deletion src/app/providers.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use client";

import { ThemeProvider } from "next-themes";
import {ReactNode} from "react";
import { ReactNode } from "react";

export function Providers({ children }: { children: ReactNode }) {
return <ThemeProvider attribute="class">{children}</ThemeProvider>;
Expand Down
2 changes: 2 additions & 0 deletions src/app/user/bookmarks/page.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { Suspense } from "react";
import Loader from "@/app/loading";
import UserBookmark from "@/components/pages/user/bookmark";

export default function Bookmarks() {
Expand Down
5 changes: 4 additions & 1 deletion src/app/user/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import "@/styles/globals.css";
import { Suspense } from "react";

import { Metadata } from "next";
import Loader from "@/app/loading";
import Navbar from "@/components/core/navbar";

export const metadata: Metadata = {
Expand All @@ -16,7 +19,7 @@ export default async function UserLayout({ children }: { children: React.ReactNo
return (
<>
<Navbar />
{children}
<Suspense fallback={<Loader />}>{children}</Suspense>
</>
);
}
2 changes: 1 addition & 1 deletion src/components/core/footer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React from "react";
export default function Footer() {
return (
<section className="mt-12 text-center">
<p className="py-4 text-base text-secondary-light dark:text-primary-light">
<p className="py-4 text-sm text-secondary-light dark:text-primary-light">
Copyright &copy; {new Date().getFullYear()} Palettegram | All Rights Reserved.
</p>
</section>
Expand Down
2 changes: 1 addition & 1 deletion src/components/core/navbar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const Navbar = () => {
}, 2000);

return () => {
clearTimeout(timeoutId)
clearTimeout(timeoutId);
console.log("clear");
};
}, [cookies, dispatch]);
Expand Down
4 changes: 3 additions & 1 deletion src/components/core/posts/SinglePost.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,9 @@ export default function SinglePost({
: "fill-transparent"
}`}
/>
<span className="text-base">{singlePost && singlePost?.likes && singlePost?.likes.length}</span>
<span className="text-base">
{singlePost && singlePost?.likes && singlePost?.likes.length}
</span>
</article>

<article className="flex flex-row gap-3 items-center transition ease-in-out duration-200 hover:cursor-pointer text-secondary-light dark:text-white hover:text-primary">
Expand Down
19 changes: 13 additions & 6 deletions src/components/core/trendingFeed/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { User, ArrowRight } from "react-feather";
import Link from "next/link";
import Image from "next/image";
import { trendingPosts } from "@/backend/trendingPosts.dummy";
Expand Down Expand Up @@ -30,11 +29,19 @@ export default function TrendingFeed() {
);
})}
</div>
<div className="flex flex-wrap gap-2 justify-center items-center text-sm">
<Link href="/"> About</Link>
<Link href="/">Accessibility</Link>
<Link href="/">Help Center</Link>
<Link href="/">Privacy & Terms</Link>
<div className="flex flex-wrap gap-2 justify-center items-center">
<Link href="/" className="text-xs text-slate-500 hover:text-primary-light">
About
</Link>
<Link href="/" className="text-xs text-slate-500 hover:text-primary-light">
Accessibility
</Link>
<Link href="/" className="text-xs text-slate-500 hover:text-primary-light">
Help Center
</Link>
<Link href="/" className="text-xs text-slate-500 hover:text-primary-light">
Privacy & Terms
</Link>
</div>
</section>
);
Expand Down
1 change: 1 addition & 0 deletions src/components/original.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export default function CoreHub() {
Get started by editing&nbsp;
<code className="font-mono font-bold">src/app/page.tsx</code>
</p>
lorem4
<div className="fixed bottom-0 left-0 flex h-48 w-full items-end justify-center bg-gradient-to-t from-white via-white dark:from-black dark:via-black lg:static lg:h-auto lg:w-auto lg:bg-none">
<a
className="pointer-events-none flex place-items-center gap-2 p-8 lg:pointer-events-auto lg:p-0"
Expand Down
6 changes: 5 additions & 1 deletion src/components/pages/feed/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
"use client";
import { Suspense } from "react";
import Link from "next/link";
import { useSelector } from "react-redux";
import { User, Bookmark } from "react-feather";

import Loader from "@/app/loading";
import CreatePost from "@/components/core/createPost";
import Posts from "@/components/core/posts";
import TrendingFeed from "@/components/core/trendingFeed";
Expand Down Expand Up @@ -30,7 +32,9 @@ const Feed = () => {
</div>
<div className="flex-[5]">
<CreatePost />
<Posts />
<Suspense fallback={<Loader />}>
<Posts />
</Suspense>
</div>
<div className="flex-[2] hidden md:block">
<TrendingFeed />
Expand Down
1 change: 0 additions & 1 deletion src/redux/reducers/postsReducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ export const postsReducer = createSlice({

state.loading = false;
},

},
});

Expand Down

1 comment on commit 6b8db1a

@vercel
Copy link

@vercel vercel bot commented on 6b8db1a Dec 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.