Skip to content

Commit

Permalink
Merge pull request #1416 from Feng-09/refactor/landing-page
Browse files Browse the repository at this point in the history
Refactor: include company name in copyright text
  • Loading branch information
billmal071 authored Aug 25, 2024
2 parents f72e802 + 140fbc5 commit a4901d5
Show file tree
Hide file tree
Showing 10 changed files with 6,087 additions and 6,965 deletions.
12,550 changes: 5,774 additions & 6,776 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion public/messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@
"footerBottom": {
"privacyPolicy": "Privacy Policy",
"termsOfUse": "Terms of Use",
"copyright": "2024 All Rights Reserved"
"copyright": "2024 All Rights Reserved",
"companyName": "HNG Boilerplate"
}
},
"pricing": {
Expand Down
21 changes: 1 addition & 20 deletions src/app/(auth-routes)/register/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import { registerUser, resendOtp, verifyOtp } from "~/actions/register";
import CustomButton from "~/components/common/common-button/common-button";
import { Input } from "~/components/common/input";
import LoadingSpinner from "~/components/miscellaneous/loading-spinner";
import { Checkbox } from "~/components/ui/checkbox";
import {
Dialog,
DialogContent,
Expand Down Expand Up @@ -51,7 +50,6 @@ const Register = () => {
const [showOtp, setShowOtp] = useState(false);
const [timeLeft, setTimeLeft] = useState<number>(15 * 60);
const [value, setValue] = useState("");
const [createOrg, setCreateOrg] = useState<boolean>(false);

if (status === "authenticated") {
router.push("/dashboard");
Expand All @@ -73,12 +71,7 @@ const Register = () => {
startTransition(async () => {
await registerUser(values).then(async (data) => {
if (data.status === 201) {
// Handle redirection based on createOrg condition
if (createOrg) {
router.push("/register/organisation");
} else {
router.push("/login");
}
router.push("/login");

toast({
title: "Account created successfully",
Expand Down Expand Up @@ -336,18 +329,6 @@ const Register = () => {
</FormItem>
)}
/>
<div
className="flex items-center gap-2"
onClick={() => setCreateOrg((a) => !a)}
>
<Checkbox id="createOrg" />
<label
htmlFor="createOrg"
className="font-inter ms-1 text-center text-sm leading-[19.2px] hover:cursor-pointer"
>
Also create an organisation
</label>
</div>
<CustomButton
type="submit"
variant="primary"
Expand Down
73 changes: 55 additions & 18 deletions src/app/(landing-routes)/blog/[id]/RelatedArticle.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { useRouter } from "next/navigation";
// import { blogPosts } from "../data/mock";
import { useEffect, useState } from "react";

import BlogCard from "~/components/layouts/BlogCards";
import { blogPosts } from "../data/mock";

export type New = {
id: number;
Expand All @@ -10,29 +11,65 @@ export type New = {

const RelatedArticle = () => {
const router = useRouter();
const [data, setData] = useState<
{
id: string;
title: string;
date: string;
readTime: string;
category: string;
image: string;
labelClassName: string;
}[]
>([]);
const [isLoading, setIsLoading] = useState<boolean>(true);

useEffect(() => {
const fetchData = async () => {
try {
setIsLoading(true);
const response = await fetch(
`https://staging.api-csharp.boilerplate.hng.tech/api/v1/blogs`,
);
const result = await response.json();
setData(result.data);
} finally {
setIsLoading(false);
}
};

fetchData();
}, []);

return (
<>
<div className="">
<h1 className="font-inter text-center text-xl font-bold leading-[29.05px] text-[#525252] sm:text-2xl md:text-left">
Related Articles
</h1>
<div className="mt-6 grid gap-6 sm:mt-8 sm:gap-8">
{blogPosts.slice(0, 3).map((post, index) => (
<BlogCard
key={index}
title={post.title}
date={post.date}
readTime={post.readTime}
category={post.category}
image={post.image}
labelClassName={post.labelClassName}
onClick={() => {
localStorage.setItem("currentBlogPost", JSON.stringify(post));
router.push(`/blog/${post.id}`);
}}
/>
))}
</div>
{isLoading ? (
<div className="animate-pulse text-2xl font-bold">
Loading Related...
</div>
) : (
<div className="mt-6 grid gap-6 sm:mt-8 sm:gap-8">
{data?.slice(0, 3).map((post, index) => (
<BlogCard
key={index}
title={post.title}
date={post.date}
readTime={post.readTime}
category={post.category}
image={post.image}
labelClassName={post.labelClassName}
onClick={() => {
localStorage.setItem("currentBlogPost", JSON.stringify(post));
router.push(`/blog/${post.id}`);
}}
/>
))}
</div>
)}
</div>
</>
);
Expand Down
Loading

0 comments on commit a4901d5

Please sign in to comment.