From f638d1c88b78974819191fa6d9c700d8e0dbf9b8 Mon Sep 17 00:00:00 2001 From: Ankit Kashyap Date: Mon, 28 Oct 2024 23:04:03 +0530 Subject: [PATCH 1/3] Fix/performance (#557) * ignored swc files * optimized code --- .gitignore | 6 ++++++ public/robots.txt | 6 ++++++ .../[token]/EmailVerificationLinkExpired.tsx | 10 ++++++++-- src/app/(auth)/verify-email/[token]/page.tsx | 8 ++++++-- src/app/[...404]/page.tsx | 1 + src/app/layout.tsx | 1 + src/components/ApproveJobDialog.tsx | 1 + src/components/DeleteDialog.tsx | 1 + src/components/Faqs.tsx | 1 + src/components/FaqsGetintouchCard.tsx | 4 +++- src/components/JobManagementHeader.tsx | 2 +- src/components/ShareJobDialog.tsx | 2 ++ src/components/ToggleApproveJobButton.tsx | 1 + src/components/auth/forgot-password.tsx | 7 ++++++- src/components/auth/reset-password.tsx | 3 ++- src/components/auth/signin.tsx | 1 + src/components/auth/signup.tsx | 1 + src/components/auth/social-auth.tsx | 1 + src/components/auth/welcome.tsx | 8 +++++++- src/components/comboBox.tsx | 1 + src/components/hero-section.tsx | 20 +++++++++++++------ src/components/job-creation-success.tsx | 2 +- src/components/job-form.tsx | 8 +++++++- src/components/job-landing.tsx | 5 ++++- src/components/job.tsx | 5 ++++- src/components/password-input.tsx | 1 + src/components/profile-menu.tsx | 1 + src/components/profile/ChangePassword.tsx | 2 ++ .../profile/DeleteAccountDialog.tsx | 2 ++ src/components/profile/EditProfile.tsx | 1 + src/components/profile/EditProfilePicture.tsx | 1 + src/components/skills-combobox.tsx | 1 + src/components/toggleJobButton.tsx | 7 ++++++- src/components/ui/theme-toggle.tsx | 1 + .../user-multistep-form/add-project-form.tsx | 3 ++- .../user-multistep-form/add-resume-form.tsx | 3 ++- .../user-multistep-form/add-skills-form.tsx | 2 +- .../addExperience-form.tsx | 2 +- .../user-multistep-form.tsx | 8 +++++++- src/components/userDetails.tsx | 14 +++++++++---- src/layouts/footer.tsx | 1 + src/layouts/header.tsx | 7 +++++-- src/layouts/mobile-nav.tsx | 6 +++++- 43 files changed, 137 insertions(+), 32 deletions(-) create mode 100644 public/robots.txt diff --git a/.gitignore b/.gitignore index ba44e4d0..82fc4d5c 100644 --- a/.gitignore +++ b/.gitignore @@ -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 \ No newline at end of file diff --git a/public/robots.txt b/public/robots.txt new file mode 100644 index 00000000..a4fb0fd7 --- /dev/null +++ b/public/robots.txt @@ -0,0 +1,6 @@ +User-agent: * +Allow: / +Disallow: /admin/* +Disallow: /manage/* + +Sitemap: https://job.vineet.tech/sitemap.xml \ No newline at end of file diff --git a/src/app/(auth)/verify-email/[token]/EmailVerificationLinkExpired.tsx b/src/app/(auth)/verify-email/[token]/EmailVerificationLinkExpired.tsx index a2bf0bc9..4a39b2fa 100644 --- a/src/app/(auth)/verify-email/[token]/EmailVerificationLinkExpired.tsx +++ b/src/app/(auth)/verify-email/[token]/EmailVerificationLinkExpired.tsx @@ -39,13 +39,19 @@ export const EmailVerificationLinkExpired = ({ token }: { token: string }) => { > {!isEmailSent ? ( - ) : ( - + )} diff --git a/src/app/(auth)/verify-email/[token]/page.tsx b/src/app/(auth)/verify-email/[token]/page.tsx index 0a64b44a..012eab75 100644 --- a/src/app/(auth)/verify-email/[token]/page.tsx +++ b/src/app/(auth)/verify-email/[token]/page.tsx @@ -29,7 +29,9 @@ const EmailVerifiedSuccess = () => { } > - + @@ -44,7 +46,9 @@ const EmailVerificationLinkNotFound = () => { description={'The verification link you used is invalid or not found.'} > - + diff --git a/src/app/[...404]/page.tsx b/src/app/[...404]/page.tsx index 1fec2b23..ddf9a334 100644 --- a/src/app/[...404]/page.tsx +++ b/src/app/[...404]/page.tsx @@ -43,6 +43,7 @@ const Custom404Page = () => { diff --git a/src/components/DeleteDialog.tsx b/src/components/DeleteDialog.tsx index 86423484..873eb442 100644 --- a/src/components/DeleteDialog.tsx +++ b/src/components/DeleteDialog.tsx @@ -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'} diff --git a/src/components/Faqs.tsx b/src/components/Faqs.tsx index 9958af8e..b6a5297a 100644 --- a/src/components/Faqs.tsx +++ b/src/components/Faqs.tsx @@ -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" >

{faq.question} diff --git a/src/components/FaqsGetintouchCard.tsx b/src/components/FaqsGetintouchCard.tsx index fbe1937c..af91f3be 100644 --- a/src/components/FaqsGetintouchCard.tsx +++ b/src/components/FaqsGetintouchCard.tsx @@ -6,7 +6,9 @@ export default function FaqsGetintouchCard() {

Can't find what you're looking for?

- + ); } diff --git a/src/components/JobManagementHeader.tsx b/src/components/JobManagementHeader.tsx index 30035d79..fec842b5 100644 --- a/src/components/JobManagementHeader.tsx +++ b/src/components/JobManagementHeader.tsx @@ -13,7 +13,7 @@ const JobManagementHeader = () => {
-
diff --git a/src/components/ShareJobDialog.tsx b/src/components/ShareJobDialog.tsx index e718a5af..ac9de6c7 100644 --- a/src/components/ShareJobDialog.tsx +++ b/src/components/ShareJobDialog.tsx @@ -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 @@ -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} diff --git a/src/components/ToggleApproveJobButton.tsx b/src/components/ToggleApproveJobButton.tsx index 78af648c..5f964b78 100644 --- a/src/components/ToggleApproveJobButton.tsx +++ b/src/components/ToggleApproveJobButton.tsx @@ -66,6 +66,7 @@ const ToggleApproveJobButton = ({ job }: { job: JobType }) => { className="mt-2" variant={'secondary'} onClick={handleToggleJob} + aria-label="approve" > {isApproved ? 'Unapprove' : 'Approve'} diff --git a/src/components/auth/forgot-password.tsx b/src/components/auth/forgot-password.tsx index ad4b8f8b..838a06cb 100644 --- a/src/components/auth/forgot-password.tsx +++ b/src/components/auth/forgot-password.tsx @@ -52,7 +52,12 @@ export const ForgotPassword = () => { }} /> - diff --git a/src/components/auth/reset-password.tsx b/src/components/auth/reset-password.tsx index 7ffa25f0..0b79f786 100644 --- a/src/components/auth/reset-password.tsx +++ b/src/components/auth/reset-password.tsx @@ -78,7 +78,7 @@ export const ResetPassword = () => { {errorMessage ? (

{errorMessage}

) : null} - @@ -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 ? : } diff --git a/src/components/auth/signin.tsx b/src/components/auth/signin.tsx index 76d6f7f1..a164f3dc 100644 --- a/src/components/auth/signin.tsx +++ b/src/components/auth/signin.tsx @@ -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'} diff --git a/src/components/auth/signup.tsx b/src/components/auth/signup.tsx index 7f66aa73..5319d393 100644 --- a/src/components/auth/signup.tsx +++ b/src/components/auth/signup.tsx @@ -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'} diff --git a/src/components/auth/social-auth.tsx b/src/components/auth/social-auth.tsx index 7b7a8b09..8a7d5392 100644 --- a/src/components/auth/social-auth.tsx +++ b/src/components/auth/social-auth.tsx @@ -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" > { variant="link" className="mt-4 text-primary underline" onClick={() => router.push(APP_PATHS.SIGNIN)} + aria-label="go-to-login" > Go to Login @@ -56,7 +57,12 @@ const CountdownButton = () => { }, [isDisabled, secondsRemaining]); return ( -
- - + + Explore Jobs + + + View Testimonials +
diff --git a/src/components/job-creation-success.tsx b/src/components/job-creation-success.tsx index cab36a59..90c3a9a9 100644 --- a/src/components/job-creation-success.tsx +++ b/src/components/job-creation-success.tsx @@ -9,7 +9,7 @@ const JobCreateSuccess = ({ isVerifiedJob }: { isVerifiedJob: boolean }) => {

Job created successfully!

{message}

- +
); }; diff --git a/src/components/job-form.tsx b/src/components/job-form.tsx index 0bb247fa..2a6c2959 100644 --- a/src/components/job-form.tsx +++ b/src/components/job-form.tsx @@ -566,6 +566,7 @@ const PostJobForm = () => {
-
diff --git a/src/components/job-landing.tsx b/src/components/job-landing.tsx index c87df6f8..c931bfb8 100644 --- a/src/components/job-landing.tsx +++ b/src/components/job-landing.tsx @@ -27,7 +27,10 @@ export const JobLanding = () => {
- diff --git a/src/components/password-input.tsx b/src/components/password-input.tsx index 2099ef12..2d0b0721 100644 --- a/src/components/password-input.tsx +++ b/src/components/password-input.tsx @@ -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 ? : } diff --git a/src/components/profile-menu.tsx b/src/components/profile-menu.tsx index eb34a405..e5dc52a3 100644 --- a/src/components/profile-menu.tsx +++ b/src/components/profile-menu.tsx @@ -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" > Profile diff --git a/src/components/profile/ChangePassword.tsx b/src/components/profile/ChangePassword.tsx index 21edafd1..4b253568 100644 --- a/src/components/profile/ChangePassword.tsx +++ b/src/components/profile/ChangePassword.tsx @@ -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 ? : } @@ -172,6 +173,7 @@ export const ChangePassword = () => { diff --git a/src/components/profile/DeleteAccountDialog.tsx b/src/components/profile/DeleteAccountDialog.tsx index fee934ef..4b3950f1 100644 --- a/src/components/profile/DeleteAccountDialog.tsx +++ b/src/components/profile/DeleteAccountDialog.tsx @@ -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" > Delete Account @@ -128,6 +129,7 @@ export const DeleteAccountDialog = () => { diff --git a/src/components/profile/EditProfile.tsx b/src/components/profile/EditProfile.tsx index bdaffb90..9be75b5d 100644 --- a/src/components/profile/EditProfile.tsx +++ b/src/components/profile/EditProfile.tsx @@ -174,6 +174,7 @@ export const EditProfile = ({ name, email }: Props) => { diff --git a/src/components/profile/EditProfilePicture.tsx b/src/components/profile/EditProfilePicture.tsx index 1f277256..f8653ea5 100644 --- a/src/components/profile/EditProfilePicture.tsx +++ b/src/components/profile/EditProfilePicture.tsx @@ -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" > Remove diff --git a/src/components/skills-combobox.tsx b/src/components/skills-combobox.tsx index 1a90f6ef..6977dfb8 100644 --- a/src/components/skills-combobox.tsx +++ b/src/components/skills-combobox.tsx @@ -105,6 +105,7 @@ export function SkillsCombobox({ return prev; }); }} + aria-label="x" > diff --git a/src/components/toggleJobButton.tsx b/src/components/toggleJobButton.tsx index e7b9f7b4..f7e48cba 100644 --- a/src/components/toggleJobButton.tsx +++ b/src/components/toggleJobButton.tsx @@ -22,7 +22,12 @@ const ToggleDelete = ({ job }: { job: JobType }) => { }; return ( <> - diff --git a/src/components/ui/theme-toggle.tsx b/src/components/ui/theme-toggle.tsx index 2a5b7385..202f72c3 100644 --- a/src/components/ui/theme-toggle.tsx +++ b/src/components/ui/theme-toggle.tsx @@ -21,6 +21,7 @@ export function ModeToggle() { variant="ghost" size="icon" className="text-slate-500 dark:text-slate-400 focus-visible:outline-0 focus-visible:ring-0 focus-visible:ring-offset-0 py-2 h-10 w-10 px-0 border rounded-sm text-center" + aria-label="toggle-theme" > { type="button" onClick={clearImage} 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" + aria-label="x" > @@ -290,7 +291,7 @@ export const AddProject = () => {
) : ( - )} diff --git a/src/components/user-multistep-form/add-resume-form.tsx b/src/components/user-multistep-form/add-resume-form.tsx index 648faba8..45359a03 100644 --- a/src/components/user-multistep-form/add-resume-form.tsx +++ b/src/components/user-multistep-form/add-resume-form.tsx @@ -125,6 +125,7 @@ export const AddResume = () => { type="button" onClick={clearResumeFile} className="w-6 h-6 bg-red-500 rounded-full flex items-center justify-center cursor-pointer translate-x-1/2 -translate-y-1/2" + aria-label="x" > @@ -144,7 +145,7 @@ export const AddResume = () => { {isLoading ? ( ) : ( - )} diff --git a/src/components/user-multistep-form/add-skills-form.tsx b/src/components/user-multistep-form/add-skills-form.tsx index 417f320e..fe57859c 100644 --- a/src/components/user-multistep-form/add-skills-form.tsx +++ b/src/components/user-multistep-form/add-skills-form.tsx @@ -66,7 +66,7 @@ export const AddSkills = () => { {' '} ) : ( - )} diff --git a/src/components/user-multistep-form/addExperience-form.tsx b/src/components/user-multistep-form/addExperience-form.tsx index 5444579f..c9e3f97b 100644 --- a/src/components/user-multistep-form/addExperience-form.tsx +++ b/src/components/user-multistep-form/addExperience-form.tsx @@ -270,7 +270,7 @@ export const AddExperience = () => { {' '} ) : ( - )} diff --git a/src/components/user-multistep-form/user-multistep-form.tsx b/src/components/user-multistep-form/user-multistep-form.tsx index 0535585a..e4e60dc8 100644 --- a/src/components/user-multistep-form/user-multistep-form.tsx +++ b/src/components/user-multistep-form/user-multistep-form.tsx @@ -113,7 +113,11 @@ export default function VerticalLinearStepper() { - @@ -132,6 +136,7 @@ export default function VerticalLinearStepper() { index === forms.length - 1 ? handleFinish : handleNext } sx={{ mt: 1, mr: 1 }} + aria-label="next/finish" > {index === forms.length - 1 ? 'Finish' : 'Next'} @@ -139,6 +144,7 @@ export default function VerticalLinearStepper() { disabled={index === 0} onClick={handleBack} sx={{ mt: 1, mr: 1 }} + aria-label="back" > Back diff --git a/src/components/userDetails.tsx b/src/components/userDetails.tsx index 88470d92..c29409f1 100644 --- a/src/components/userDetails.tsx +++ b/src/components/userDetails.tsx @@ -7,10 +7,14 @@ const UserDetails = () => {
- +
- +
@@ -35,14 +39,16 @@ const UserDetails = () => {
- +
- +
diff --git a/src/layouts/footer.tsx b/src/layouts/footer.tsx index d4b37c23..eaf3f7af 100644 --- a/src/layouts/footer.tsx +++ b/src/layouts/footer.tsx @@ -20,6 +20,7 @@ const Footer = () => { key={i} href={social.href} className="p-3 rounded-full border mx-2 hover:bg-slate-50 duration-150 ease-in-out transition" + aria-label={`${social.icon}-logo`} > diff --git a/src/layouts/header.tsx b/src/layouts/header.tsx index 2f345a32..b589c7ce 100644 --- a/src/layouts/header.tsx +++ b/src/layouts/header.tsx @@ -36,7 +36,7 @@ export const CompanyLogo = () => { > 100xJobs { return ( <> -