Skip to content

Commit

Permalink
Fix/performance (#557)
Browse files Browse the repository at this point in the history
* ignored swc files

* optimized code
  • Loading branch information
Kashyap1ankit authored Oct 28, 2024
1 parent e48bbef commit f638d1c
Show file tree
Hide file tree
Showing 43 changed files with 137 additions and 32 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,9 @@ bun.lockb
package-lock.json
yarn.lock

**/public/sw.js
**/public/workbox-*.js
**/public/worker-*.js
**/public/sw.js.map
**/public/workbox-*.js.map
**/public/worker-*.js.map
6 changes: 6 additions & 0 deletions public/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
User-agent: *
Allow: /
Disallow: /admin/*
Disallow: /manage/*

Sitemap: https://job.vineet.tech/sitemap.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,19 @@ export const EmailVerificationLinkExpired = ({ token }: { token: string }) => {
>
{!isEmailSent ? (
<Link href={APP_PATHS.SIGNIN}>
<Button className="w-full" disabled={isLoading}>
<Button
className="w-full"
disabled={isLoading}
aria-label="login-redirect"
>
Go to Login
</Button>
</Link>
) : (
<Link href={APP_PATHS.SIGNIN} onClick={handleResendClick}>
<Button className="w-full">Resend Verification Email</Button>
<Button className="w-full" aria-label="resend">
Resend Verification Email
</Button>
</Link>
)}
</FormContainer>
Expand Down
8 changes: 6 additions & 2 deletions src/app/(auth)/verify-email/[token]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ const EmailVerifiedSuccess = () => {
}
>
<Link href={APP_PATHS.SIGNIN}>
<Button className="w-full">Go to Login</Button>
<Button className="w-full" aria-label="login">
Go to Login
</Button>
</Link>
</FormContainer>
</div>
Expand All @@ -44,7 +46,9 @@ const EmailVerificationLinkNotFound = () => {
description={'The verification link you used is invalid or not found.'}
>
<Link href={APP_PATHS.SIGNUP}>
<Button className="w-full">Go to Signup</Button>
<Button className="w-full" aria-label="signip-redirect">
Go to Signup
</Button>
</Link>
</FormContainer>
</div>
Expand Down
1 change: 1 addition & 0 deletions src/app/[...404]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const Custom404Page = () => {
<Button
asChild
className="bg-blue-600 hover:bg-blue-700 text-white font-semibold py-2 px-6 rounded-full transition-colors duration-300"
aria-label="home-redirect"
>
<Link href="/">
<span className="flex items-center">
Expand Down
1 change: 1 addition & 0 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const satoshi = localFont({
export const metadata: Metadata = {
title: '100xJobs',
description: 'Get your dream job',
// icons: '/main.png',
};

export default async function RootLayout({
Expand Down
1 change: 1 addition & 0 deletions src/components/ApproveJobDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const ApproveJobDialog = ({
className="mt-2"
variant={'secondary'}
onClick={handleClick}
aria-label="approve"
>
Approve
</Button>
Expand Down
1 change: 1 addition & 0 deletions src/components/DeleteDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ const JobDialog = ({ job }: { job: JobType }) => {
className="mt-2"
variant={job.deleted ? 'secondary' : 'destructive'}
onClick={handelToggle}
aria-label="delete"
>
{job.deleted ? 'Restore' : 'Delete'}
</Button>
Expand Down
1 change: 1 addition & 0 deletions src/components/Faqs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export default function Faqs() {
className="flex w-full justify-between items-center cursor-pointer focus:outline-none dark:bg-[#0F172A] bg-[#F1F5F9] p-4 rounded-xl"
onClick={() => toggleExpand(i)}
aria-expanded={expandedIndex === i}
aria-label="toggle-expand"
>
<p className="text-left font-medium dark:text-white text-gray-900">
{faq.question}
Expand Down
4 changes: 3 additions & 1 deletion src/components/FaqsGetintouchCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ export default function FaqsGetintouchCard() {
<p className="font-semibold md:text-base text-xs">
Can&apos;t find what you&apos;re looking for?
</p>
<Button className="md:text-base text-xs">Get in touch</Button>
<Button className="md:text-base text-xs" aria-label="get-in-touch">
Get in touch
</Button>
</div>
);
}
2 changes: 1 addition & 1 deletion src/components/JobManagementHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const JobManagementHeader = () => {
</span>
</div>
<div>
<Button>
<Button aria-label="post-new-job">
<Link href={'/create'}>Post new Job</Link>
</Button>
</div>
Expand Down
2 changes: 2 additions & 0 deletions src/components/ShareJobDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export const ShareJobDialog = ({ job }: { job: JobType }) => {
variant="outline"
size="sm"
className="px-4 py-2 h-fit gap-2 flex items-center"
aria-label="share-job"
>
Share Job <Share2 size={16} />
</Button>
Expand All @@ -81,6 +82,7 @@ export const ShareJobDialog = ({ job }: { job: JobType }) => {
variant="outline"
className="w-full justify-start gap-2"
onClick={() => option.shareFunction(job)}
aria-label="share-on-social"
>
{option.icon}
Share on {option.name}
Expand Down
1 change: 1 addition & 0 deletions src/components/ToggleApproveJobButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ const ToggleApproveJobButton = ({ job }: { job: JobType }) => {
className="mt-2"
variant={'secondary'}
onClick={handleToggleJob}
aria-label="approve"
>
{isApproved ? 'Unapprove' : 'Approve'}
</Button>
Expand Down
7 changes: 6 additions & 1 deletion src/components/auth/forgot-password.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,12 @@ export const ForgotPassword = () => {
}}
/>

<Button type="submit" className="mt-4" disabled={isLoading}>
<Button
type="submit"
className="mt-4"
disabled={isLoading}
aria-label="submit"
>
Submit
</Button>
</form>
Expand Down
3 changes: 2 additions & 1 deletion src/components/auth/reset-password.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export const ResetPassword = () => {
{errorMessage ? (
<p className="text-sm font-medium text-destructive">{errorMessage}</p>
) : null}
<Button type="submit" disabled={isLoading}>
<Button type="submit" disabled={isLoading} aria-label="submit">
Submit
</Button>
</form>
Expand Down Expand Up @@ -114,6 +114,7 @@ export const PasswordInput = ({
type="button"
onClick={togglePasswordVisibility}
className="absolute right-2 top-1/2 transform -translate-y-1/2 focus:outline-none"
aria-label="toggle-password"
>
{showPassword ? <EyeOffIcon /> : <EyeIcon />}
</button>
Expand Down
1 change: 1 addition & 0 deletions src/components/auth/signin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ export const Signin = () => {
type="submit"
disabled={form.formState.isSubmitting}
className="w-full h-10"
aria-label="submit"
>
{form.formState.isSubmitting ? 'Please wait...' : 'Sign In'}
</Button>
Expand Down
1 change: 1 addition & 0 deletions src/components/auth/signup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ export const Signup = () => {
type="submit"
disabled={form.formState.isSubmitting}
className="w-full h-10"
aria-label="submit"
>
{form.formState.isSubmitting ? 'Please wait...' : 'Create Account'}
</Button>
Expand Down
1 change: 1 addition & 0 deletions src/components/auth/social-auth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export const GoogleOauthButton = ({ label }: { label: string }) => (
signIn('google');
}}
className="w-full h-10 bg-white border border-gray-300 text-gray-700 font-medium hover:bg-gray-50"
aria-label="google-oauth-button"
>
<svg
className="w-4 h-4 mr-2"
Expand Down
8 changes: 7 additions & 1 deletion src/components/auth/welcome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const Welcome = () => {
variant="link"
className="mt-4 text-primary underline"
onClick={() => router.push(APP_PATHS.SIGNIN)}
aria-label="go-to-login"
>
Go to Login
</Button>
Expand Down Expand Up @@ -56,7 +57,12 @@ const CountdownButton = () => {
}, [isDisabled, secondsRemaining]);

return (
<Button onClick={handleClick} disabled={isDisabled} className="w-full">
<Button
onClick={handleClick}
disabled={isDisabled}
className="w-full"
aria-label="wait"
>
{isDisabled
? `Wait ${secondsRemaining} second${secondsRemaining !== 1 ? 's' : ''}...`
: 'Click Me'}
Expand Down
1 change: 1 addition & 0 deletions src/components/comboBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export function Combobox({
role="combobox"
aria-expanded={open}
className="w-full justify-between dark:bg-gray-800 border-none dark:text-white"
aria-label="skillset"
>
Search skillset ...
<ChevronsUpDown className="ml-2 h-4 w-4 shrink-0 opacity-50" />
Expand Down
20 changes: 14 additions & 6 deletions src/components/hero-section.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,20 @@ const HeroSection = () => {
</p>
</div>
<div className="md:w-4/6 w-full flex md:flex-row flex-col items-center justify-center my-4">
<button className="md:w-fit w-full rounded-lg py-2 px-3 bg-[#3259E8] text-sm text-[#FFFF] font-medium hover:bg-[#3e63e9] ">
<Link href={'/jobs'}>Explore Jobs </Link>
</button>
<button className="md:w-fit w-full rounded-lg py-2 px-3 border text-sm md:ml-3 md:my-0 my-3 dark:text-[#94A3B8] text-[#64748B] font-medium dark:hover:bg-slate-900 hover:bg-slate-100">
<Link href={'#testimonials'}>View Testimonials</Link>
</button>
<Link
href={'/jobs'}
aria-label="explore-jobs"
className="md:w-fit w-full rounded-lg py-2 px-3 bg-[#3259E8] text-sm text-[#FFFF] font-medium hover:bg-[#3e63e9] text-center"
>
Explore Jobs
</Link>
<Link
href={'#testimonials'}
className="md:w-fit w-full rounded-lg py-2 px-3 border text-sm md:ml-3 md:my-0 my-3 bg-transparent dark:bg-slate-900 dark:text-[#94A3B8] text-[#64748B] font-medium dark:hover:bg-slate-900 hover:bg-slate-100 text-center"
aria-label="view-testimonals"
>
View Testimonials
</Link>
</div>
</div>
<div className="flex flex-col items-center my-5">
Expand Down
2 changes: 1 addition & 1 deletion src/components/job-creation-success.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const JobCreateSuccess = ({ isVerifiedJob }: { isVerifiedJob: boolean }) => {
<div>
<h1>Job created successfully!</h1>
<p>{message}</p>
<Button>Post another job</Button>
<Button aria-label="post-another-job">Post another job</Button>
</div>
);
};
Expand Down
8 changes: 7 additions & 1 deletion src/components/job-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,7 @@ const PostJobForm = () => {
<PopoverTrigger asChild>
<Button
variant="outline"
aria-label="pick-date"
className={`w-[240px] pl-3 text-left font-normal dark:bg-gray-800
`} // No color change on hover
>
Expand Down Expand Up @@ -675,6 +676,7 @@ const PostJobForm = () => {
<button
type="button"
onClick={clearLogoImage}
aria-label="x"
className="absolute top-0 right-0 w-5 h-5 bg-red-500 rounded-full items-center flex justify-center cursor-pointer translate-x-1/2 -translate-y-1/2"
>
<X size="16" />
Expand Down Expand Up @@ -751,7 +753,11 @@ const PostJobForm = () => {
</div>
</div>
<div className="w-full flex justify-end items-center my-4 ">
<Button type="submit" disabled={form.formState.isSubmitting}>
<Button
type="submit"
disabled={form.formState.isSubmitting}
aria-label="submit-job"
>
{form.formState.isSubmitting ? 'Please wait...' : 'Create Job'}
</Button>
</div>
Expand Down
5 changes: 4 additions & 1 deletion src/components/job-landing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ export const JobLanding = () => {
</div>
<RecentJobs />
<div className="w-full flex justify-center items-center my-5">
<button className="flex items-center text-[#4E7AFF] border-none outline-none text-lg font-medium group">
<button
className="flex items-center text-[#4E7AFF] border-none outline-none text-lg font-medium group"
aria-label="view-all-jobs"
>
<Link href={'/jobs'} className="flex items-center">
View all jobs
<ChevronRight className="w-4 h-4 mx-2 group-hover:translate-x-1 duration-200 ease-in-out transition" />
Expand Down
5 changes: 4 additions & 1 deletion src/components/job.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,10 @@ export const Job = ({ job }: { job: JobType }) => {

<div className="mt-4 flex gap-2">
<Link href={job.application ? job.application : ''}>
<Button className="justify-self-start px-6 dark:text-white py-2 w-fit h-fit">
<Button
className="justify-self-start px-6 dark:text-white py-2 w-fit h-fit"
aria-label="apply-now"
>
Apply Now
</Button>
</Link>
Expand Down
1 change: 1 addition & 0 deletions src/components/password-input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export const PasswordInput = ({ placeholder, field }: PasswordInputProps) => {
type="button"
onClick={togglePasswordVisibility}
className="absolute right-2 top-1/2 transform -translate-y-1/2"
aria-label="password"
>
{showPassword ? <EyeOffIcon /> : <EyeIcon />}
</button>
Expand Down
1 change: 1 addition & 0 deletions src/components/profile-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export function ProfileMenu() {
variant="ghost"
size="icon"
className="focus-visible:outline-0 focus-visible:ring-0 focus-visible:ring-offset-0 py-2 h-8 w-8 px-0"
aria-label="profile"
>
<Icon icon="profile" className="h-[1.2rem] w-[1.2rem]" />
<span className="sr-only">Profile</span>
Expand Down
2 changes: 2 additions & 0 deletions src/components/profile/ChangePassword.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ export const ChangePassword = () => {
type="button"
onClick={togglePasswordVisibility}
className="absolute right-2 top-1/2 transform -translate-y-1/2"
aria-label="password"
>
{showPassword ? <EyeOffIcon /> : <EyeIcon />}
</button>
Expand All @@ -172,6 +173,7 @@ export const ChangePassword = () => {
<Button
disabled={isPending}
className="bg-slate-950 text-white dark:text-slate-950 dark:bg-white rounded-md py-2 px-4 md:w-56 w-full"
aria-label="save"
>
{isPending ? <Loader /> : 'Save'}
</Button>
Expand Down
2 changes: 2 additions & 0 deletions src/components/profile/DeleteAccountDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ export const DeleteAccountDialog = () => {
className="w-40 flex gap-2 text-red-500"
variant={'ghost'}
onClick={() => setModalOpen(true)}
aria-label="delete-account"
>
<Trash size={15} />
Delete Account
Expand Down Expand Up @@ -128,6 +129,7 @@ export const DeleteAccountDialog = () => {
<Button
disabled={disabled}
className="mt-4 bg-red-500 hover:bg-red-500 text-white"
aria-label="submit"
>
{isPending ? <FaSpinner className="animate-spin" /> : 'Yes'}
</Button>
Expand Down
1 change: 1 addition & 0 deletions src/components/profile/EditProfile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ export const EditProfile = ({ name, email }: Props) => {
<Button
disabled={isPending}
className="bg-slate-950 text-white dark:text-slate-950 dark:bg-white rounded-md py-2 px-4 md:w-56 w-full"
aria-label="submit"
>
{isPending ? <Loader /> : 'Save'}
</Button>
Expand Down
1 change: 1 addition & 0 deletions src/components/profile/EditProfilePicture.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ export const EditProfilePicture = () => {
disabled={isPending}
onClick={removeImage}
className="flex items-center justify-center gap-3 text-xs text-red-400 bg-none border-none bg-transparent hover:bg-transparent"
aria-label="remove"
>
<Trash className="w-4 h-4" />
Remove
Expand Down
1 change: 1 addition & 0 deletions src/components/skills-combobox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ export function SkillsCombobox({
return prev;
});
}}
aria-label="x"
>
<X className="text-white" size={15} />
</Button>
Expand Down
Loading

0 comments on commit f638d1c

Please sign in to comment.