From cab5c17842a2a502b08f5792ff049d14f9da7194 Mon Sep 17 00:00:00 2001 From: Dotty Date: Fri, 7 Jun 2024 11:31:10 -0400 Subject: [PATCH 1/2] update style in terramatch pages --- .../PageElements/Footer/PageFooter.tsx | 6 +- src/pages/auth/layout.tsx | 36 ++++++++++ .../signup/components/usePasswordStrength.tsx | 70 +++++++++++++++++++ .../create/[frameworkUUID].page.tsx | 2 + .../[entityName]/edit/[uuid]/index.page.tsx | 3 + src/pages/home.page.tsx | 8 ++- src/pages/my-projects/index.page.tsx | 4 ++ src/pages/nursery/[uuid]/index.page.tsx | 2 +- src/pages/opportunities/index.page.tsx | 5 ++ .../[id]/components/BuildStrongerProfile.tsx | 2 +- .../organization/[id]/components/Files.tsx | 2 +- .../[id]/components/OrganizationHeader.tsx | 48 +++++++------ .../financial/FinancialInformation.tsx | 2 +- .../[id]/components/overview/About.tsx | 4 +- .../overview/PastCommunityExperience.tsx | 4 +- .../components/overview/TeamAndResources.tsx | 5 +- .../projects/ProjectsTabContent.tsx | 4 +- .../[id]/components/team/TeamTabContent.tsx | 4 +- src/pages/organization/[id]/index.page.tsx | 4 +- src/pages/project/[uuid]/index.page.tsx | 4 +- src/pages/project/[uuid]/tabs/Details.tsx | 2 + src/pages/project/[uuid]/tabs/Gallery.tsx | 2 + .../project/[uuid]/tabs/GoalsAndProgress.tsx | 21 +++--- .../project/[uuid]/tabs/ProjectSites.tsx | 9 +-- .../project/[uuid]/tabs/ReportingTasks.tsx | 2 + src/pages/site/[uuid]/index.page.tsx | 4 +- .../site/[uuid]/tabs/CompletedReports.tsx | 2 + src/pages/site/[uuid]/tabs/Details.tsx | 2 + .../site/[uuid]/tabs/GoalsAndProgress.tsx | 11 ++- 29 files changed, 211 insertions(+), 63 deletions(-) create mode 100644 src/pages/auth/layout.tsx create mode 100644 src/pages/auth/signup/components/usePasswordStrength.tsx diff --git a/src/components/extensive/PageElements/Footer/PageFooter.tsx b/src/components/extensive/PageElements/Footer/PageFooter.tsx index 1fe973c0c..d31e4db5b 100644 --- a/src/components/extensive/PageElements/Footer/PageFooter.tsx +++ b/src/components/extensive/PageElements/Footer/PageFooter.tsx @@ -1,6 +1,6 @@ import Icon, { IconNames } from "../../Icon/Icon"; -const PageFooter = () => { +const PageFooter = () => (
@@ -9,7 +9,7 @@ const PageFooter = () => {

© TerraMatch 2024

-
; -}; + +); export default PageFooter; diff --git a/src/pages/auth/layout.tsx b/src/pages/auth/layout.tsx new file mode 100644 index 000000000..6d54b1005 --- /dev/null +++ b/src/pages/auth/layout.tsx @@ -0,0 +1,36 @@ +"use client"; +import { Button } from "@mui/material"; +import { usePathname } from "next/navigation"; +import React from "react"; +import { When } from "react-if"; + +import Text from "@/components/elements/Text/Text"; + +interface LoginLayoutProps { + children: React.ReactNode; +} + +const LoginLayout: React.FC = props => { + const { children } = props; + const pathname = usePathname(); + + return ( +
+
+ {children} + +
+ +
+
+
+
+
+ ); +}; + +export default LoginLayout; diff --git a/src/pages/auth/signup/components/usePasswordStrength.tsx b/src/pages/auth/signup/components/usePasswordStrength.tsx new file mode 100644 index 000000000..76628d154 --- /dev/null +++ b/src/pages/auth/signup/components/usePasswordStrength.tsx @@ -0,0 +1,70 @@ +import { useEffect, useState } from "react"; + +interface UsePasswordStrengthProps { + password: string; +} + +interface UsePasswordStrengthResult { + passwordStrength: string; + values: { + hasUppercase: boolean; + hasLowercase: boolean; + hasNumber: boolean; + hasCorrectLength: boolean; + }; + validationCount: number; +} + +const ValidationStrength = { + STRONG: 4, + FAIR: 3, + WEAK: 2, + VERY_WEAK: 1 +}; +const usePasswordStrength = (props: UsePasswordStrengthProps): UsePasswordStrengthResult => { + const { password } = props; + const [passwordStrength, setPasswordStrength] = useState("Very Weak"); + const [values, setValues] = useState({ + hasUppercase: false, + hasLowercase: false, + hasNumber: false, + hasCorrectLength: false + }); + + const [validation, setValidation] = useState([]); + + useEffect(() => { + const hasCorrectLength = password.length >= 8; + const hasUppercase = (password.match(/[A-Z]/g) || []).length > 0; + const hasLowercase = (password.match(/[a-z]/g) || []).length > 0; + const hasNumber = (password.match(/[0-9]/g) || []).length > 0; + + const _validation = [hasUppercase, hasLowercase, hasNumber, hasCorrectLength]; + + const strengthMap = { + [ValidationStrength.STRONG]: "Strong", + [ValidationStrength.FAIR]: "Fair", + [ValidationStrength.WEAK]: "Weak" + }; + + setValues({ + hasUppercase, + hasLowercase, + hasNumber, + hasCorrectLength + }); + + setValidation(_validation); + const validationCount = _validation.filter(value => value === true).length; + + setPasswordStrength(strengthMap[validationCount]); + }, [password]); + + return { + passwordStrength, + values, + validationCount: validation.filter(Boolean).length + }; +}; + +export default usePasswordStrength; diff --git a/src/pages/entity/[entityName]/create/[frameworkUUID].page.tsx b/src/pages/entity/[entityName]/create/[frameworkUUID].page.tsx index 5330d01c7..9175fc4cc 100644 --- a/src/pages/entity/[entityName]/create/[frameworkUUID].page.tsx +++ b/src/pages/entity/[entityName]/create/[frameworkUUID].page.tsx @@ -2,6 +2,7 @@ import { useT } from "@transifex/react"; import Link from "next/link"; import { useRouter } from "next/router"; +import PageFooter from "@/components/extensive/PageElements/Footer/PageFooter"; import WizardFormIntro from "@/components/extensive/WizardForm/WizardFormIntro"; import BackgroundLayout from "@/components/generic/Layout/BackgroundLayout"; import ContentLayout from "@/components/generic/Layout/ContentLayout"; @@ -111,6 +112,7 @@ const EntityIntroPage = () => { /> + ); }; diff --git a/src/pages/entity/[entityName]/edit/[uuid]/index.page.tsx b/src/pages/entity/[entityName]/edit/[uuid]/index.page.tsx index 510e025f3..ffe2ca324 100644 --- a/src/pages/entity/[entityName]/edit/[uuid]/index.page.tsx +++ b/src/pages/entity/[entityName]/edit/[uuid]/index.page.tsx @@ -3,6 +3,7 @@ import { notFound } from "next/navigation"; import { useRouter } from "next/router"; import { useMemo } from "react"; +import PageFooter from "@/components/extensive/PageElements/Footer/PageFooter"; import WizardForm from "@/components/extensive/WizardForm"; import BackgroundLayout from "@/components/generic/Layout/BackgroundLayout"; import LoadingContainer from "@/components/generic/Loading/LoadingContainer"; @@ -154,6 +155,8 @@ const EditEntityPage = () => { }} /> +
+ ); }; diff --git a/src/pages/home.page.tsx b/src/pages/home.page.tsx index 710b46183..73df2e65c 100644 --- a/src/pages/home.page.tsx +++ b/src/pages/home.page.tsx @@ -8,6 +8,7 @@ import ActionTracker from "@/components/extensive/ActionTracker/ActionTracker"; import FundingCarouselList from "@/components/extensive/FundingsCarouselList/FundingsCarouselList"; import { IconNames } from "@/components/extensive/Icon/Icon"; import PageBody from "@/components/extensive/PageElements/Body/PageBody"; +import PageFooter from "@/components/extensive/PageElements/Footer/PageFooter"; import PageSection from "@/components/extensive/PageElements/Section/PageSection"; import TaskList from "@/components/extensive/TaskList/TaskList"; import { useGetHomeTourItems } from "@/components/extensive/WelcomeTour/useGetHomeTourItems"; @@ -39,7 +40,7 @@ const HomePage = () => { {t("Home")} - + {t("What would you like to do?")} @@ -65,9 +66,9 @@ const HomePage = () => { - + Funding Opportunities`)} subtitle={t("Keep your information updated to have more chances of having a successful application.")} items={[ { @@ -96,6 +97,7 @@ const HomePage = () => { /> + ); }; diff --git a/src/pages/my-projects/index.page.tsx b/src/pages/my-projects/index.page.tsx index 7c55b732a..6c4e7f49c 100644 --- a/src/pages/my-projects/index.page.tsx +++ b/src/pages/my-projects/index.page.tsx @@ -11,6 +11,7 @@ import Text from "@/components/elements/Text/Text"; import { IconNames } from "@/components/extensive/Icon/Icon"; import List from "@/components/extensive/List/List"; import PageBody from "@/components/extensive/PageElements/Body/PageBody"; +import PageFooter from "@/components/extensive/PageElements/Footer/PageFooter"; import PageHeader from "@/components/extensive/PageElements/Header/PageHeader"; import PageSection from "@/components/extensive/PageElements/Section/PageSection"; import LoadingContainer from "@/components/generic/Loading/LoadingContainer"; @@ -88,6 +89,9 @@ const MyProjectsPage = () => { +
+
+ ); diff --git a/src/pages/nursery/[uuid]/index.page.tsx b/src/pages/nursery/[uuid]/index.page.tsx index 364552260..d81a0c6a5 100644 --- a/src/pages/nursery/[uuid]/index.page.tsx +++ b/src/pages/nursery/[uuid]/index.page.tsx @@ -147,7 +147,7 @@ const NurseryDetailPage = () => { body: } ]} - containerClassName="max-w-7xl px-10 xl:px-0 w-full overflow-auto" + containerClassName="max-w-[82vw] px-10 xl:px-0 w-full overflow-y-hidden" /> ); diff --git a/src/pages/opportunities/index.page.tsx b/src/pages/opportunities/index.page.tsx index 5b3f7693b..9b80013fb 100644 --- a/src/pages/opportunities/index.page.tsx +++ b/src/pages/opportunities/index.page.tsx @@ -12,6 +12,7 @@ import FundingCarouselList from "@/components/extensive/FundingsCarouselList/Fun import { IconNames } from "@/components/extensive/Icon/Icon"; import PageBody from "@/components/extensive/PageElements/Body/PageBody"; import PageCard from "@/components/extensive/PageElements/Card/PageCard"; +import PageFooter from "@/components/extensive/PageElements/Footer/PageFooter"; import PageHeader from "@/components/extensive/PageElements/Header/PageHeader"; import PageSection from "@/components/extensive/PageElements/Section/PageSection"; import ApplicationsTable from "@/components/extensive/Tables/ApplicationsTable"; @@ -146,7 +147,11 @@ const OpportunitiesPage = () => { +
+
+ + ); }; diff --git a/src/pages/organization/[id]/components/BuildStrongerProfile.tsx b/src/pages/organization/[id]/components/BuildStrongerProfile.tsx index e1562824c..77d0f37a7 100644 --- a/src/pages/organization/[id]/components/BuildStrongerProfile.tsx +++ b/src/pages/organization/[id]/components/BuildStrongerProfile.tsx @@ -21,7 +21,7 @@ const BuildStrongerProfile = ({ subtitle, steps, onEdit }: BuildStrongerProfileP const t = useT(); return ( -
+
{t("Build a Stronger Profile")} diff --git a/src/pages/organization/[id]/components/Files.tsx b/src/pages/organization/[id]/components/Files.tsx index a8ad7883f..6eb518265 100644 --- a/src/pages/organization/[id]/components/Files.tsx +++ b/src/pages/organization/[id]/components/Files.tsx @@ -14,7 +14,7 @@ type FilesProps = { const Files = ({ files, title }: FilesProps) => { return ( -
+
{title} diff --git a/src/pages/organization/[id]/components/OrganizationHeader.tsx b/src/pages/organization/[id]/components/OrganizationHeader.tsx index 9d38e1a36..e465f8e28 100644 --- a/src/pages/organization/[id]/components/OrganizationHeader.tsx +++ b/src/pages/organization/[id]/components/OrganizationHeader.tsx @@ -49,33 +49,35 @@ const OrganizationHeader = ({ organization }: OrganizationHeaderProps) => { }} /> {/* Content Container */} -
- - {organization?.name} - -
-
- - - {formatOptionsList(getCountriesOptions(t), organization?.hq_country ?? [])} - -
+
+
+ +
+ + +
+ + {organization?.name} + +
+
+ - {formatOptionsList(getOrganisationTypeOptions(t), organization?.type!) || ""} + {formatOptionsList(getCountriesOptions(t), organization?.hq_country ?? [])} - {organization?.description}
+ + {formatOptionsList(getOrganisationTypeOptions(t), organization?.type!) || ""} + + {organization?.description}
-
- - - - - -
-
-
- +
+
+ + + + +
diff --git a/src/pages/organization/[id]/components/financial/FinancialInformation.tsx b/src/pages/organization/[id]/components/financial/FinancialInformation.tsx index 57dda62e9..e08d43313 100644 --- a/src/pages/organization/[id]/components/financial/FinancialInformation.tsx +++ b/src/pages/organization/[id]/components/financial/FinancialInformation.tsx @@ -22,7 +22,7 @@ const FinancialInformation = ({ organization }: FinancialInformationProps) => { ]; return ( -
+
{ const t = useT(); return ( -
+
{t("About")} {organization?.description}
-
+
+
{t("Social Impact")} -
+
{ const t = useT(); return ( -
+
{t("Team and Resources")}
0}> @@ -57,9 +58,11 @@ const TeamAndResources = ({ organization }: TeamAndResourcesProps) => { role: member.position, gender: member.gender }))} + variant={VARIANT_TABLE_BORDER_ALL} /> { const { data: projectsData } = useGetV2MyProjects<{ data: GetV2MyProjectsResponse }>({}); return ( - + 0}>
@@ -33,6 +34,7 @@ const ProjectsTabContent = () => {
+ variant={VARIANT_TABLE_BORDER_ALL} columns={[ { header: t("Title"), accessorKey: "name" }, { diff --git a/src/pages/organization/[id]/components/team/TeamTabContent.tsx b/src/pages/organization/[id]/components/team/TeamTabContent.tsx index 1039942cc..67acc352e 100644 --- a/src/pages/organization/[id]/components/team/TeamTabContent.tsx +++ b/src/pages/organization/[id]/components/team/TeamTabContent.tsx @@ -104,7 +104,7 @@ const TeamTabContent = () => { {t("Meet the Team")} -
+
{t("Your Organizations' TerraMatch Users ({n})", { n: approvedUsers?.data.length })} @@ -116,7 +116,7 @@ const TeamTabContent = () => {
-
+
{t("Requests to Join Organization ({n})", { n: pendingUsers?.data.length })} diff --git a/src/pages/organization/[id]/index.page.tsx b/src/pages/organization/[id]/index.page.tsx index a186183d0..ceebfbc15 100644 --- a/src/pages/organization/[id]/index.page.tsx +++ b/src/pages/organization/[id]/index.page.tsx @@ -3,6 +3,7 @@ import { useRouter } from "next/router"; import SecondaryTabs from "@/components/elements/Tabs/Secondary/SecondaryTabs"; import HeroBanner from "@/components/extensive/Banner/Hero/HeroBanner"; +import PageFooter from "@/components/extensive/PageElements/Footer/PageFooter"; import LoadingContainer from "@/components/generic/Loading/LoadingContainer"; import { useGetV2OrganisationsUUID } from "@/generated/apiComponents"; import { V2OrganisationRead } from "@/generated/apiSchemas"; @@ -35,7 +36,7 @@ const OrganizationPage = () => { /> { } ]} /> + ); }; diff --git a/src/pages/project/[uuid]/index.page.tsx b/src/pages/project/[uuid]/index.page.tsx index 8036db1b8..6018fbda3 100644 --- a/src/pages/project/[uuid]/index.page.tsx +++ b/src/pages/project/[uuid]/index.page.tsx @@ -9,6 +9,7 @@ import SecondaryTabs from "@/components/elements/Tabs/Secondary/SecondaryTabs"; import { IconNames } from "@/components/extensive/Icon/Icon"; import Modal from "@/components/extensive/Modal/Modal"; import PageBreadcrumbs from "@/components/extensive/PageElements/Breadcrumbs/PageBreadcrumbs"; +import PageFooter from "@/components/extensive/PageElements/Footer/PageFooter"; import PageHeader from "@/components/extensive/PageElements/Header/PageHeader"; import LoadingContainer from "@/components/generic/Loading/LoadingContainer"; import { useModalContext } from "@/context/modal.provider"; @@ -176,8 +177,9 @@ const ProjectDetailPage = () => { ) } ]} - containerClassName="max-w-7xl px-10 xl:px-0 w-full overflow-auto" + containerClassName="max-w-[82vw] px-10 xl:px-0 w-full" /> + ); }; diff --git a/src/pages/project/[uuid]/tabs/Details.tsx b/src/pages/project/[uuid]/tabs/Details.tsx index 2f089e57d..1f0521a5d 100644 --- a/src/pages/project/[uuid]/tabs/Details.tsx +++ b/src/pages/project/[uuid]/tabs/Details.tsx @@ -211,6 +211,8 @@ const ProjectDetailTab = ({ project }: ProjectDetailsTabProps) => { +
+
); }; diff --git a/src/pages/project/[uuid]/tabs/Gallery.tsx b/src/pages/project/[uuid]/tabs/Gallery.tsx index bc059a9a5..a7862eef2 100644 --- a/src/pages/project/[uuid]/tabs/Gallery.tsx +++ b/src/pages/project/[uuid]/tabs/Gallery.tsx @@ -35,6 +35,8 @@ const GalleryTab = (props: EntityMapAndGalleryCardProps & { sharedDriveLink?: st +
+
); }; diff --git a/src/pages/project/[uuid]/tabs/GoalsAndProgress.tsx b/src/pages/project/[uuid]/tabs/GoalsAndProgress.tsx index 493871d5f..c17b61aa0 100644 --- a/src/pages/project/[uuid]/tabs/GoalsAndProgress.tsx +++ b/src/pages/project/[uuid]/tabs/GoalsAndProgress.tsx @@ -4,6 +4,7 @@ import { Else, If, Then, When } from "react-if"; import GoalProgressCard from "@/components/elements/Cards/GoalProgressCard/GoalProgressCard"; import GenericField from "@/components/elements/Field/GenericField"; import TextField from "@/components/elements/Field/TextField"; +import { VARIANT_TABLE_BORDER } from "@/components/elements/Table/TableVariants"; import { IconNames } from "@/components/extensive/Icon/Icon"; import PageBody from "@/components/extensive/PageElements/Body/PageBody"; import PageCard from "@/components/extensive/PageElements/Card/PageCard"; @@ -21,28 +22,23 @@ const GoalsAndProgressTab = ({ project }: GoalsAndProgressProps) => { const { isPPC } = useFramework(project); return ( - + -
+
- + - + { value: project.regenerated_trees_count } ]} - className="flex-1" + className="flex-1 !items-start" />
@@ -85,12 +81,15 @@ const GoalsAndProgressTab = ({ project }: GoalsAndProgressProps) => { +
- + +
+
); }; diff --git a/src/pages/project/[uuid]/tabs/ProjectSites.tsx b/src/pages/project/[uuid]/tabs/ProjectSites.tsx index 3ed6a7e67..17f34b003 100644 --- a/src/pages/project/[uuid]/tabs/ProjectSites.tsx +++ b/src/pages/project/[uuid]/tabs/ProjectSites.tsx @@ -54,12 +54,7 @@ const ProjectSitesTab = ({ project }: ProjectNurseriesTabProps) => { /> - + @@ -67,6 +62,8 @@ const ProjectSitesTab = ({ project }: ProjectNurseriesTabProps) => { +
+
); }; diff --git a/src/pages/project/[uuid]/tabs/ReportingTasks.tsx b/src/pages/project/[uuid]/tabs/ReportingTasks.tsx index f2f56c293..0e2175f88 100644 --- a/src/pages/project/[uuid]/tabs/ReportingTasks.tsx +++ b/src/pages/project/[uuid]/tabs/ReportingTasks.tsx @@ -54,6 +54,8 @@ const ReportingTasksTab = (props: ReportingTasksProps) => { +
+
); }; diff --git a/src/pages/site/[uuid]/index.page.tsx b/src/pages/site/[uuid]/index.page.tsx index 6debfea7c..262073894 100644 --- a/src/pages/site/[uuid]/index.page.tsx +++ b/src/pages/site/[uuid]/index.page.tsx @@ -10,6 +10,7 @@ import { getActionCardStatusMapper } from "@/components/extensive/ActionTracker/ import { IconNames } from "@/components/extensive/Icon/Icon"; import Modal from "@/components/extensive/Modal/Modal"; import PageBreadcrumbs from "@/components/extensive/PageElements/Breadcrumbs/PageBreadcrumbs"; +import PageFooter from "@/components/extensive/PageElements/Footer/PageFooter"; import PageHeader from "@/components/extensive/PageElements/Header/PageHeader"; import LoadingContainer from "@/components/generic/Loading/LoadingContainer"; import { useModalContext } from "@/context/modal.provider"; @@ -148,8 +149,9 @@ const SiteDetailPage = () => { body: } ]} - containerClassName="max-w-7xl px-10 xl:px-0 w-full overflow-auto" + containerClassName="max-w-[82vw] px-10 xl:px-0 w-full" /> + ); }; diff --git a/src/pages/site/[uuid]/tabs/CompletedReports.tsx b/src/pages/site/[uuid]/tabs/CompletedReports.tsx index 02f1011b8..13a0a792e 100644 --- a/src/pages/site/[uuid]/tabs/CompletedReports.tsx +++ b/src/pages/site/[uuid]/tabs/CompletedReports.tsx @@ -55,6 +55,8 @@ const SiteCompletedReportsTab = ({ siteUUID }: SiteCompletedReportsTabProps) => +
+
); }; diff --git a/src/pages/site/[uuid]/tabs/Details.tsx b/src/pages/site/[uuid]/tabs/Details.tsx index bec51d96f..538dad327 100644 --- a/src/pages/site/[uuid]/tabs/Details.tsx +++ b/src/pages/site/[uuid]/tabs/Details.tsx @@ -91,6 +91,8 @@ const SiteDetailTab = ({ site }: SiteDetailsTabProps) => { +
+
); }; diff --git a/src/pages/site/[uuid]/tabs/GoalsAndProgress.tsx b/src/pages/site/[uuid]/tabs/GoalsAndProgress.tsx index 19eefcf58..ce590c7d3 100644 --- a/src/pages/site/[uuid]/tabs/GoalsAndProgress.tsx +++ b/src/pages/site/[uuid]/tabs/GoalsAndProgress.tsx @@ -4,6 +4,7 @@ import { When } from "react-if"; import GoalProgressCard from "@/components/elements/Cards/GoalProgressCard/GoalProgressCard"; import GenericField from "@/components/elements/Field/GenericField"; import TextField from "@/components/elements/Field/TextField"; +import { VARIANT_TABLE_BORDER } from "@/components/elements/Table/TableVariants"; import { IconNames } from "@/components/extensive/Icon/Icon"; import PageBody from "@/components/extensive/PageElements/Body/PageBody"; import PageCard from "@/components/extensive/PageElements/Card/PageCard"; @@ -24,12 +25,16 @@ const GoalsAndProgressTab = ({ site }: GoalsAndProgressTabProps) => { -
+
+ + { - + +
+
); }; From 17b2a60b4a8d4d8b29c6b52a567f596929a500d2 Mon Sep 17 00:00:00 2001 From: Dotty Date: Fri, 7 Jun 2024 13:26:57 -0400 Subject: [PATCH 2/2] fix comment PR --- src/pages/auth/signup/components/usePasswordStrength.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pages/auth/signup/components/usePasswordStrength.tsx b/src/pages/auth/signup/components/usePasswordStrength.tsx index 76628d154..e3f59b0dd 100644 --- a/src/pages/auth/signup/components/usePasswordStrength.tsx +++ b/src/pages/auth/signup/components/usePasswordStrength.tsx @@ -35,9 +35,9 @@ const usePasswordStrength = (props: UsePasswordStrengthProps): UsePasswordStreng useEffect(() => { const hasCorrectLength = password.length >= 8; - const hasUppercase = (password.match(/[A-Z]/g) || []).length > 0; - const hasLowercase = (password.match(/[a-z]/g) || []).length > 0; - const hasNumber = (password.match(/[0-9]/g) || []).length > 0; + const hasUppercase = (password.match(/[A-Z]/g) ?? []).length > 0; + const hasLowercase = (password.match(/[a-z]/g) ?? []).length > 0; + const hasNumber = (password.match(/[0-9]/g) ?? []).length > 0; const _validation = [hasUppercase, hasLowercase, hasNumber, hasCorrectLength];