Skip to content

Commit f6d6cb4

Browse files
authored
Major ui revamp (#1135)
* ui refresh * fixed static pages (tnc, privacy-policy), fixed Navbar being rendered twice on landing page
1 parent 97cd178 commit f6d6cb4

File tree

141 files changed

+3117
-3342
lines changed

Some content is hidden

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

141 files changed

+3117
-3342
lines changed

next.config.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,20 @@ const nextConfig = {
1313
},
1414
experimental: {
1515
serverActions: {
16-
allowedOrigins: ['localhost:3000', 'app.100xdevs.com', 'app2.100xdevs.com']
17-
}
16+
allowedOrigins: [
17+
'localhost:3000',
18+
'app.100xdevs.com',
19+
'app2.100xdevs.com',
20+
],
21+
},
1822
},
1923
swcMinify: true,
2024
webpack: (config) => {
2125
// Enable polling based on env variable being set
2226
if (process.env.NEXT_WEBPACK_USEPOLLING) {
2327
config.watchOptions = {
2428
poll: 500,
25-
aggregateTimeout: 300
29+
aggregateTimeout: 300,
2630
};
2731
}
2832
return config;

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"@discordjs/next": "^0.1.1-dev.1673526225-a580768.0",
4040
"@hookform/resolvers": "^3.6.0",
4141
"@icons-pack/react-simple-icons": "^9.4.0",
42-
"@prisma/client": "^5.6.0",
42+
"@prisma/client": "^5.18.0",
4343
"@radix-ui/react-accordion": "^1.1.2",
4444
"@radix-ui/react-avatar": "^1.0.4",
4545
"@radix-ui/react-dialog": "^1.0.5",
@@ -48,9 +48,11 @@
4848
"@radix-ui/react-navigation-menu": "^1.1.4",
4949
"@radix-ui/react-popover": "^1.1.1",
5050
"@radix-ui/react-scroll-area": "^1.1.0",
51+
"@radix-ui/react-slot": "^1.1.0",
52+
"@radix-ui/react-switch": "^1.1.0",
5153
"@radix-ui/react-separator": "^1.1.0",
52-
"@radix-ui/react-slot": "^1.0.2",
5354
"@radix-ui/react-tooltip": "^1.0.7",
55+
"@tabler/icons-react": "^3.14.0",
5456
"@types/bcrypt": "^5.0.2",
5557
"@types/jsonwebtoken": "^9.0.5",
5658
"@uiw/react-md-editor": "^4.0.4",
@@ -69,15 +71,13 @@
6971
"jose": "^5.2.2",
7072
"jsonwebtoken": "^9.0.2",
7173
"lucide-react": "^0.321.0",
72-
"moment": "^2.30.1",
7374
"next": "14.0.2",
7475
"next-auth": "^4.24.5",
7576
"next-themes": "^0.2.1",
7677
"nextjs-toploader": "^1.6.11",
7778
"node-fetch": "^3.3.2",
7879
"notion-client": "^6.16.0",
7980
"pdf-lib": "^1.17.1",
80-
"qs": "^6.13.0",
8181
"react": "^18",
8282
"react-big-calendar": "^1.13.2",
8383
"react-day-picker": "8.10.1",
@@ -128,7 +128,7 @@
128128
"postcss": "^8",
129129
"prettier": "^3.2.4",
130130
"prettier-plugin-tailwindcss": "^0.6.1",
131-
"prisma": "^5.17.0",
131+
"prisma": "^5.18.0",
132132
"tailwindcss": "^3.3.0",
133133
"ts-node": "^10.9.2",
134134
"typescript": "^5.4.5",

pnpm-lock.yaml

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

public/Mockup.png

1.19 MB
Loading

public/banner-img.jpeg

-215 KB
Binary file not shown.

public/banner_placeholder.png

9.24 MB
Loading

public/platform/dailycode.png

-753 KB
Binary file not shown.

public/platform/dashboard.png

-1.71 MB
Binary file not shown.

public/platform/discord.png

-1.22 MB
Binary file not shown.

public/platform/platform.png

-700 KB
Binary file not shown.

public/platform/playstore.png

-50.8 KB
Binary file not shown.

src/actions/answer/index.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ const createAnswerHandler = async (
5858
return answer;
5959
});
6060

61-
revalidatePath(`/questions/${result.id}`);
62-
revalidatePath(`/questions`);
61+
revalidatePath(`/question/${result.id}`);
62+
revalidatePath(`/question`);
6363

6464
return { data: result };
6565
} catch (error) {
@@ -99,8 +99,8 @@ const updateAnswerHandler = async (
9999
content, // Update content
100100
},
101101
});
102-
revalidatePath(`/questions/${answerId}`);
103-
revalidatePath(`/questions`);
102+
revalidatePath(`/question/${answerId}`);
103+
revalidatePath(`/question`);
104104
return { data: updatedAnswer };
105105
} catch (error) {
106106
console.error(error);
@@ -174,8 +174,8 @@ const deleteAnswerHandler = async (
174174
await prisma.answer.delete({ where: { id: answerId } });
175175
});
176176

177-
revalidatePath(`/questions/${answerId}`);
178-
revalidatePath(`/questions`);
177+
revalidatePath(`/question/${answerId}`);
178+
revalidatePath(`/question`);
179179

180180
return {
181181
data: { message: 'Answer and all nested answers deleted successfully' },

src/actions/bookmark/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
import { revalidatePath } from 'next/cache';
1313

1414
const reloadBookmarkPage = () => {
15-
revalidatePath('/bookmarks');
15+
revalidatePath('/bookmark');
1616
};
1717

1818
const createBookmarkHandler = async (

src/actions/question/index.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
'use server';
2-
32
import {
43
DeleteTypeQuestion,
54
InputTypeCreate,
@@ -66,8 +65,8 @@ const createQuestionHandler = async (
6665
slug, // Include the slug
6766
},
6867
});
69-
revalidatePath(`/questions/${question.id}`);
70-
revalidatePath(`/questions`);
68+
revalidatePath(`/question/${question.id}`);
69+
revalidatePath(`/question`);
7170

7271
return { data: question };
7372
} catch (error) {
@@ -106,7 +105,7 @@ const updateQuestionHandler = async (
106105

107106
if (!existingQuestion || existingQuestion.authorId !== session.user.id) {
108107
return {
109-
error: 'Unauthorized: You can only update questions you have authored',
108+
error: 'Unauthorized: You can only update question you have authored',
110109
};
111110
}
112111

@@ -141,8 +140,8 @@ const updateQuestionHandler = async (
141140
slug, // Include the new slug
142141
},
143142
});
144-
revalidatePath(`/questions/${questionId}`);
145-
revalidatePath(`/questions`);
143+
revalidatePath(`/question/${questionId}`);
144+
revalidatePath(`/question`);
146145

147146
return { data: updatedQuestion };
148147
} catch (error) {
@@ -179,7 +178,7 @@ const deleteQuestionHandler = async (
179178
(question.authorId !== session.user.id && session.user.role !== ROLES.ADMIN)
180179
) {
181180
return {
182-
error: 'Unauthorized: You can only delete questions you have authored',
181+
error: 'Unauthorized: You can only delete question you have authored',
183182
};
184183
}
185184

@@ -214,8 +213,8 @@ const deleteQuestionHandler = async (
214213
});
215214
});
216215

217-
revalidatePath(`/questions/${questionId}`);
218-
revalidatePath(`/questions`);
216+
revalidatePath(`/question/${questionId}`);
217+
revalidatePath(`/question`);
219218

220219
return {
221220
data: {
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { Skeleton } from '@/components/ui/skeleton';
2+
3+
export default function Loading() {
4+
return (
5+
<div className="flex flex-col gap-4 pb-16 pt-8">
6+
<div className="flex flex-col justify-between gap-4 lg:flex-row">
7+
<Skeleton className="h-8 w-3/4 md:w-1/2" />
8+
<Skeleton className="h-10 w-full lg:w-64" />
9+
</div>
10+
<div className="grid grid-cols-1 gap-5 md:grid-cols-2 lg:grid-cols-3">
11+
{[1, 2, 3, 4, 5, 6].map((v) => (
12+
<div key={v} className="flex flex-col space-y-2">
13+
<Skeleton className="h-48 w-full" />
14+
<Skeleton className="h-6 w-3/4" />
15+
<Skeleton className="h-4 w-1/2" />
16+
</div>
17+
))}
18+
</div>
19+
</div>
20+
);
21+
}

src/app/(main)/(pages)/bookmark/page.tsx

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,15 @@ export default async function BookmarksPage() {
1313
const bookmarkData = await getBookmarkDataWithContent();
1414

1515
return (
16-
<div className="flex h-screen flex-col">
17-
<h1 className="bg-background/6 top-0 flex items-center p-5 text-3xl backdrop-blur-lg">
18-
Bookmarks
19-
</h1>
20-
21-
<main className="no-scrollbar mb-10 flex h-full flex-col overflow-y-scroll text-lg">
16+
<main className="flex flex-col gap-4 pb-16 pt-8">
17+
<div className="flex flex-col justify-between gap-2 md:flex-row">
18+
<h1 className="text-wrap text-3xl font-extrabold capitalize tracking-tighter md:text-4xl">
19+
Bookmarks
20+
</h1>
21+
</div>
22+
<div className="flex h-full flex-col gap-4 rounded-2xl py-4">
2223
<BookmarkView bookmarkData={bookmarkData} />
23-
</main>
24-
</div>
24+
</div>
25+
</main>
2526
);
2627
}

src/app/(main)/(pages)/home/page.tsx

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import { MyCourses } from '@/components/MyCourses';
2+
import { Redirect } from '@/components/Redirect';
3+
import SearchBar from '@/components/search/SearchBar';
4+
import { getServerSession } from 'next-auth';
5+
6+
export default async function MyCoursesPage() {
7+
const session = await getServerSession();
8+
9+
if (!session?.user) {
10+
return <Redirect to={'/'} />;
11+
}
12+
13+
// Get the current hour
14+
const currentHour = new Date().getHours();
15+
16+
// Determine the appropriate greeting based on the time of day
17+
let greeting = 'Good Morning';
18+
if (currentHour >= 12 && currentHour < 18) {
19+
greeting = 'Good Afternoon';
20+
} else if (currentHour >= 18 || currentHour < 5) {
21+
greeting = 'Good Evening';
22+
}
23+
24+
return (
25+
<main className="flex flex-col gap-4 pb-16 pt-8">
26+
<div className="flex flex-col justify-between gap-4 lg:flex-row">
27+
<h1 className="text-wrap text-3xl font-extrabold capitalize tracking-tighter md:text-4xl">
28+
{greeting} {session.user.name}
29+
</h1>
30+
<SearchBar />
31+
</div>
32+
33+
<div className="flex h-full flex-col gap-4 rounded-2xl py-4">
34+
<MyCourses />
35+
</div>
36+
</main>
37+
);
38+
}

src/app/(main)/(pages)/layout.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,5 @@ interface Props {
55
}
66

77
export default function MainLayout(props: Props) {
8-
return (
9-
<div className="flex h-screen overflow-hidden">
10-
<div className="w-full">{props.children}</div>
11-
</div>
12-
);
8+
return <div className="w-full py-16">{props.children}</div>;
139
}

src/app/(main)/(pages)/my-courses/page.tsx

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)