-
Notifications
You must be signed in to change notification settings - Fork 265
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #649 from hngprojects/Vxrcel-clean
- Loading branch information
Showing
48 changed files
with
403 additions
and
2 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...omponents/layout/Sidebar/sidebar.test.tsx → ...omponents/layout/Sidebar/sidebar.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...erate-with-html/preview-template/page.tsx → ...erate-with-html/preview-template/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
"use client"; | ||
|
||
import { ArrowLeft, Home } from "lucide-react"; | ||
import Image from "next/image"; | ||
import Link from "next/link"; | ||
import { useRouter } from "next/navigation"; | ||
|
||
import Particles404 from "~/components/error/Particles404"; | ||
|
||
const NotFoundPage = () => { | ||
const router = useRouter(); | ||
|
||
return ( | ||
<section className="grid h-screen w-full place-items-center bg-white"> | ||
<div className="fixed left-0 top-0 min-h-[100dvh] w-screen bg-white" /> | ||
<Particles404 /> | ||
<div className="pointer-events-none relative z-30 flex flex-col gap-y-6"> | ||
<p className="text-center font-medium uppercase text-[#f97415] sm:text-2xl md:text-3xl lg:text-4xl lg:font-bold xl:font-bold"> | ||
Page Not Found | ||
</p> | ||
<Image | ||
src="/404.gif" | ||
alt="404" | ||
width={480} | ||
height={204} | ||
unoptimized | ||
loading="eager" | ||
priority | ||
/> | ||
<div className="flex w-full items-center justify-center gap-x-4"> | ||
<button | ||
onClick={() => router.back()} | ||
className="hover:text-accent-color pointer-events-auto flex items-center gap-x-2 rounded-xl border border-gray-200 bg-white px-4 py-2 transition-colors duration-300" | ||
> | ||
<ArrowLeft className="size-5 xl:size-6" /> | ||
Back | ||
</button> | ||
<Link | ||
href="/" | ||
prefetch | ||
className="hover:text-accent-color pointer-events-auto flex items-center gap-x-2 rounded-xl border border-gray-200 bg-white px-4 py-2 transition-colors duration-300" | ||
> | ||
<Home className="size-5 xl:size-6" /> | ||
Home | ||
</Link> | ||
</div> | ||
</div> | ||
</section> | ||
); | ||
}; | ||
|
||
export default NotFoundPage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import React, { useEffect } from "react"; | ||
|
||
import useWindowWidth from "~/hooks/use-window-width"; | ||
import { handleMouseEnter } from "~/lib/utils"; | ||
import { particlesCanvas } from "./particles"; | ||
|
||
const Particles404 = () => { | ||
const canvaReference = React.useRef<HTMLCanvasElement>(null); | ||
const { winWidth } = useWindowWidth(); | ||
|
||
useEffect(() => { | ||
setTimeout(() => { | ||
if (!canvaReference.current) return; | ||
particlesCanvas(canvaReference.current); | ||
}, 500); | ||
}, [winWidth]); | ||
return ( | ||
<div className="absolute left-0 top-0 mx-auto h-full w-full max-w-[1440px] overflow-hidden"> | ||
<canvas | ||
ref={canvaReference} | ||
id="particles_404" | ||
className="absolute left-0 top-0 h-[100dvh] w-full" | ||
/> | ||
<header className="absolute left-0 top-0 w-full bg-white px-10 py-8 font-medium uppercase text-[#f97415] md:text-3xl"> | ||
<h1 | ||
className="" | ||
// @ts-expect-error Hacking the type | ||
onMouseEnter={handleMouseEnter} | ||
data-value="HNG-BOILERPLATE" | ||
> | ||
Hng-boilerplate | ||
</h1> | ||
</header> | ||
<div className="absolute bottom-10 left-10 font-sans text-2xl uppercase"> | ||
<p | ||
className="font-bold text-[#f97415] md:text-6xl lg:text-9xl xl:text-[10rem]" | ||
// @ts-expect-error Hacking the type | ||
onMouseEnter={handleMouseEnter} | ||
data-value="404!!" | ||
> | ||
404 | ||
</p> | ||
<p className="font-medium md:text-3xl lg:text-4xl"> | ||
This is not the page <br /> you are looking for | ||
</p> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Particles404; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,152 @@ | ||
interface Mouse { | ||
radius: number; | ||
x: number; | ||
y: number; | ||
} | ||
|
||
export function particlesCanvas(canvasElement: HTMLCanvasElement) { | ||
const context = canvasElement.getContext("2d"); | ||
|
||
const canvas = canvasElement; | ||
canvas.width = window.innerWidth * window.devicePixelRatio; | ||
canvas.height = window.innerHeight * window.devicePixelRatio; | ||
|
||
canvas.style.width = `${window.innerWidth}px`; | ||
canvas.style.height = `${window.innerHeight}px`; | ||
|
||
// Particles Class | ||
class Particle { | ||
private originX: number; | ||
private originY: number; | ||
private x: number; | ||
private y: number; | ||
private effect: Effect; | ||
private ctx: CanvasRenderingContext2D; | ||
private vx: number; | ||
private vy: number; | ||
private ease: number; | ||
private friction: number; | ||
private dx: number; | ||
private dy: number; | ||
private distance: number; | ||
private force: number; | ||
private angle: number; | ||
private size: number; | ||
public spread: number; | ||
|
||
constructor(x: number, y: number, effect: Effect) { | ||
this.originX = x; | ||
this.originY = y; | ||
this.effect = effect; | ||
this.x = Math.floor(x); | ||
this.y = Math.floor(y); | ||
this.ctx = effect.ctx; | ||
this.ctx.fillStyle = "#f97415"; | ||
this.vx = 0; | ||
this.vy = 0; | ||
this.ease = 0.05; | ||
this.friction = 0.9; | ||
this.dx = 0; | ||
this.dy = 0; | ||
this.distance = 0; | ||
this.force = 0; | ||
this.angle = 0; | ||
// this.size = Math.floor(Math.random() * 5 + 2); | ||
this.size = 3; | ||
this.spread = 20; | ||
this.draw(); | ||
} | ||
draw() { | ||
this.ctx.beginPath(); | ||
this.ctx.fillRect(this.x, this.y, this.size, this.size); | ||
} | ||
update() { | ||
this.dx = this.effect.mouse.x - this.x; | ||
this.dy = this.effect.mouse.y - this.y; | ||
this.distance = this.dx * this.dx + this.dy * this.dy; | ||
this.force = (-this.effect.mouse.radius / this.distance) * this.spread; | ||
|
||
if (this.distance < this.effect.mouse.radius) { | ||
this.angle = Math.atan2(this.dy, this.dx); | ||
this.vx += this.force * Math.cos(this.angle); | ||
this.vy += this.force * Math.sin(this.angle); | ||
} | ||
|
||
this.x += | ||
(this.vx *= this.friction) + (this.originX - this.x) * this.ease; | ||
this.y += | ||
(this.vy *= this.friction) + (this.originY - this.y) * this.ease; | ||
this.draw(); | ||
} | ||
} | ||
|
||
// Effect class | ||
class Effect { | ||
private width: number; | ||
private height: number; | ||
private gap: number; | ||
public ctx: CanvasRenderingContext2D; | ||
private particlesArray: Particle[]; | ||
public readonly mouse: Mouse; | ||
constructor( | ||
width: number, | ||
height: number, | ||
context: CanvasRenderingContext2D, | ||
) { | ||
this.width = width; | ||
this.height = height; | ||
this.ctx = context; | ||
this.particlesArray = []; | ||
this.gap = 20; | ||
this.mouse = { | ||
radius: 3000, | ||
x: 0, | ||
y: 0, | ||
}; | ||
|
||
window.addEventListener("mousemove", (event) => { | ||
this.mouse.x = event.clientX * window.devicePixelRatio; | ||
this.mouse.y = event.pageY * window.devicePixelRatio; | ||
this.mouse.radius = 3000; | ||
}); | ||
window.addEventListener("mouseout", () => { | ||
this.mouse.x = 0; | ||
this.mouse.y = 0; | ||
this.mouse.radius = 0; | ||
}); | ||
window.addEventListener("resize", () => { | ||
canvas.width = window.innerWidth * window.devicePixelRatio; | ||
canvas.height = window.innerHeight * window.devicePixelRatio; | ||
this.width = canvas.width; | ||
this.height = canvas.height; | ||
|
||
canvas.style.width = `${window.innerWidth}px`; | ||
canvas.style.height = `${window.innerHeight}px`; | ||
|
||
this.particlesArray = []; | ||
}); | ||
|
||
this.init(); | ||
} | ||
|
||
init() { | ||
for (let x = 0; x < this.width; x += this.gap) { | ||
for (let y = 0; y < this.height; y += this.gap) { | ||
this.particlesArray.push(new Particle(x, y, this)); | ||
} | ||
} | ||
} | ||
update() { | ||
this.ctx.clearRect(0, 0, this.width, this.height); | ||
for (let index = 0; index < this.particlesArray.length; index++) { | ||
this.particlesArray[index].update(); | ||
} | ||
} | ||
} | ||
const effect = new Effect(canvas.width, canvas.height, context!); | ||
function animate() { | ||
effect.update(); | ||
requestAnimationFrame(animate); | ||
} | ||
animate(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/** | ||
* An array of routes that are accessible to the public | ||
* These routes do not require authentication | ||
* @type {string[]} | ||
*/ | ||
export const publicRoutes = [ | ||
"/", | ||
"/career", | ||
"/faqs", | ||
"privacy-policy", | ||
"/terms", | ||
"/about-us", | ||
"/pricing", | ||
"/contact-us", | ||
"/waitlist", | ||
"/blog", | ||
]; | ||
|
||
export const authRoutes = [ | ||
"/sign-up", | ||
"/login", | ||
"/forgot-password", | ||
"/reset-password", | ||
"/verify-otp", | ||
"/recovery", | ||
]; | ||
|
||
export const apiAuthPrefix = "/api/"; | ||
|
||
/** | ||
* The default redirect after login | ||
* @type {string} | ||
*/ | ||
export const DEFAULT_LOGIN_REDIRECT = "/dashboard"; | ||
|
||
/** | ||
* An array of routes that are accessible to the client | ||
* These routes require authentication | ||
* @type {string[]} | ||
*/ | ||
export const clientRoutes = [ | ||
"/dashboard", | ||
"/hisory", | ||
"messages", | ||
"/notifications", | ||
"/profile", | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.