Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[M1_TR-212] Markup for M1_TR-211 #11

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Conversation

nicoleamber
Copy link
Contributor

@nicoleamber nicoleamber commented Sep 4, 2023

Related Issue

Context

  • Created markup for Job List page

Commands:

  • Run the ff commands
  cd web
  yarn install

Test Executed

  • Unit Test
  • Functional Test

Screenshot

Screencast.2023-09-07.11-07-01.webm

Nature of task

  • New Implementation
  • Bug
  • Refactoring

Risks

  • Affecting other functions

Notes

Filter buttons take a few seconds to initially load its custom styles.

@nicoleamber nicoleamber force-pushed the feature/M1_TR-212 branch 2 times, most recently from 267fb6a to ac3107a Compare September 6, 2023 10:29
@nicoleamber nicoleamber self-assigned this Sep 7, 2023
@nicoleamber nicoleamber marked this pull request as ready for review September 7, 2023 03:15
Copy link
Contributor

@jeremiahC jeremiahC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use 2 space indentation not 4 space

Copy link
Contributor

@jeremiahC jeremiahC Sep 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nicoleamber Pagination should be a molecule since it compose of multiple buttons

Comment on lines 5 to 13
export const useJobListContext = (): JobTable => {
const jobs = useContext(JobListContext);

if (jobs === undefined) {
throw new Error('Missing JobListContext');
}

return jobs;
};
Copy link
Contributor

@jeremiahC jeremiahC Sep 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nicoleamber I think we should not export, let's manage context within hooks and pass what we need in the return statement. Also, I can see the context is not used in this hooks so only use it where it is needed.

Copy link
Contributor

@jeremiahC jeremiahC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nicoleamber Please fix indentation as well

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please put it in a folder same as others

Copy link
Contributor

@jeremiahC jeremiahC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From next time if markup task, I want to request to not include the hooks for now or context, it's okay na display lang sa, kay daghan kaayo i review

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

@jeremiahC jeremiahC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better to organize the routes like this

/job/list
/job/detail/{id}

since route order is depending on the component tree. So the file structure will look like this

+ job
   + list
      - context.js
      - hooks.js
      - page.js

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please move styles to assets

<Chip
label={label}
sx={{
backgroundColor: ChipColors[label as string] ?? '#65707b33',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please define every hex value colors, so that it would be easily identified by developers.

setStartDate(date);
};

const handleEndDateChange = (date: Moment | null): void => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to use union types? This function requires date always right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jeremiahC Yes sir, there would be a type mismatch without the null as seen in this error message.
image

It's also possible to clear the date fields (i.e. when we no longer want to filter jobs by date) using null as the on change value. I'll include that change here since I implemented it in the FE task.

const [startDate, setStartDate] = useState<Moment | null>();
const [endDate, setEndDate] = useState<Moment | null>();

const handleStartDateChange = (date: Moment | null): void => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to use union types? This function requires date always right?

Comment on lines 11 to 12
const { startDate, handleStartDateChange, endDate, handleEndDateChange } =
useHooks();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

format each variable by line

linkTo = '/'
}) => {
const pathname = usePathname();
active = pathname === linkTo ? true : false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better if active is immutable, pathname === linkTo should be handled above this component. This component will just receive true or false.

setOpen((prevOpen) => !prevOpen);
};

const handleClose = (event: Event | React.SyntheticEvent) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need to use union types here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants