Skip to content

Commit

Permalink
Merge pull request #35 from bcgov/responsiveness-tweaks
Browse files Browse the repository at this point in the history
Responsiveness Form changes
  • Loading branch information
jadmsaadaot authored Aug 20, 2024
2 parents 3536bc4 + d6d8585 commit 3bdefcd
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { FC } from "react";
import { TextField, TextFieldProps } from "@mui/material";
import { Controller, useFormContext } from "react-hook-form";
import { BCDesignTokens } from "epic.theme";

type IFormInputProps = {
name: string;
Expand Down Expand Up @@ -44,6 +45,9 @@ const ControlledTextField: FC<IFormInputProps> = ({
field.onChange(e.target.value);
}}
error={!!errors[name]}
FormHelperTextProps={{
sx: { color: BCDesignTokens.typographyColorDanger },
}}
helperText={String(errors[name]?.message ?? "")}
{...otherProps}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ import { theme } from "@/styles/theme";
import KeyboardArrowDownIcon from "@mui/icons-material/KeyboardArrowDown";
import { useState } from "react";
import { OidcConfig } from "@/utils/config";
import { useNavigate } from "@tanstack/react-router";
import { BCDesignTokens } from "epic.theme";

export default function AppBarActions() {
const auth = useAuth();
const navigate = useNavigate();
const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
const open = Boolean(anchorEl);
const handleClick = (event: React.MouseEvent<HTMLElement>) => {
Expand Down Expand Up @@ -60,7 +62,13 @@ export default function AppBarActions() {
horizontal: "right",
}}
>
<MenuItem onClick={handleClose}>My Profile</MenuItem>
<MenuItem
onClick={() => {
navigate({ to: "/profile" });
}}
>
My Profile
</MenuItem>
<MenuItem
onClick={() => {
auth.signoutRedirect();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { useEffect } from "react";
import { Else, If, Then } from "react-if";

export const Route = createFileRoute(
"/_authenticated/registration/add-projects",
"/_authenticated/registration/add-projects"
)({
component: AddProjects,
});
Expand Down Expand Up @@ -87,7 +87,7 @@ function AddProjects() {

<Grid item xs={12} mt={"20px"}>
<Typography variant="body1">
We found the following projects associated with CGI Mines Inc.
We found the following project(s) associated with CGI Mines Inc.
</Typography>
</Grid>
<Grid item xs={12} mt={"20px"}>
Expand All @@ -111,7 +111,7 @@ function AddProjects() {
{isAddingProjectsPending ? (
<CircularProgress />
) : (
"Confirm Projects"
"Confirm Project(s)"
)}
</Button>
<Caption2>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,20 @@ const queryParamSchema = yup.object().shape({
type QueryParamsSchema = yup.InferType<typeof queryParamSchema>;

export const Route = createFileRoute(
"/_authenticated/registration/create-account",
"/_authenticated/registration/create-account"
)({
component: CreateAccount,
});

const createAccountSchema = yup.object().shape({
givenName: yup.string().required("Name is required"),
surname: yup.string().required("Surname is required"),
position: yup.string().required("Position is required"),
phone: yup.string().required("Phone number is required"),
email: yup.string().email("Invalid email").required("Email is required"),
givenName: yup.string().required("Please enter your given name."),
surname: yup.string().required("Please enter your surname."),
position: yup.string().required("Please enter your position."),
phone: yup.string().required("Please enter your phone number."),
email: yup
.string()
.email("Invalid email")
.required("Please enter your email."),
});

type CreateAccountForm = yup.InferType<typeof createAccountSchema>;
Expand Down Expand Up @@ -86,8 +89,8 @@ function CreateAccount() {
<Grid item xs={12}>
<Typography variant="body1">
Welcome to EPIC.submit and thank you for taking a few minutes to set
up the BC Hydro account. First of all, please create your Account as
an Adminstrator of EPIC.submit for CGI Mines Inc.
up the CGI Mines Inc account. First of all, please create your
Account as an Adminstrator of EPIC.submit for CGI Mines Inc.
<br />
<br />
Account Administrators have access to all the projects associated
Expand All @@ -99,7 +102,8 @@ function CreateAccount() {

<Grid
item
xs={3}
xs={12}
md={4}
justifyContent="center"
alignItems="flex-start"
marginTop="0.75rem"
Expand Down

0 comments on commit 3bdefcd

Please sign in to comment.