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

Refactor coding clubs page #17

Merged
merged 13 commits into from
Jul 22, 2024
Merged

Refactor coding clubs page #17

merged 13 commits into from
Jul 22, 2024

Conversation

faucomte97
Copy link
Contributor

@faucomte97 faucomte97 commented Jul 17, 2024

This change is Reviewable

@faucomte97 faucomte97 self-assigned this Jul 17, 2024
@faucomte97 faucomte97 marked this pull request as ready for review July 17, 2024 15:20
Comment on lines 29 to 59
<Introduction
header="Primary coding club"
img={{ alt: "aboutUs", src: AboutUsImage }}
>
<Typography>
Download your FREE coding club pack for students aged 7-11. This
pack introduces students to the first principles of Python at a
faster pace than the regular lesson plans. It is aimed at students
already interested in learning coding and can be used in clubs, at
home or in school, on or offline.
</Typography>
<Typography>
View the resources{" "}
<Link
to="https://code-for-life.gitbook.io/teaching-resources/v/code-club-resources-primary"
target="_blank"
>
online here
</Link>
.
</Typography>
{/*TODO: Link to GTM for analytics*/}
<LinkButton
sx={{ marginTop: "auto" }}
to="https://storage.googleapis.com/codeforlife-assets/club_packs/PrimaryCodingClub.zip"
target="_blank"
endIcon={<DownloadIcon />}
>
Download the Primary coding club pack
</LinkButton>
</Introduction>
Copy link
Contributor

Choose a reason for hiding this comment

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

Make this a page component (like ) called . This will help readability - no single large components but components made of smaller components. Generally a good idea to make page sections a component. See home page as an example.

Comment on lines 62 to 93
<Introduction
header="Python coding club"
img={{ alt: "pythonCodingClub", src: PythonClubImage }}
direction="row-reverse"
>
<Typography>
Download your FREE coding club pack for students aged 12 and above.
This pack is a fast paced introduction to Python. It is aimed at
students already interested in learning coding, individuals looking
to learn and run their own club, or adults wanting to try coding
out. It is designed to be used in face-to-face or online clubs.
</Typography>
<Typography>
View the resources{" "}
<Link
to="https://code-for-life.gitbook.io/teaching-resources/v/rapid-introduction-to-python-code-club"
target="_blank"
>
online here
</Link>
.
</Typography>
{/*TODO: Link to GTM for analytics*/}
<LinkButton
sx={{ marginTop: "auto" }}
to="https://storage.googleapis.com/codeforlife-assets/club_packs/PythonCodingClub.zip"
target="_blank"
endIcon={<DownloadIcon />}
>
Download the Python coding club pack
</LinkButton>
</Introduction>
Copy link
Contributor

Choose a reason for hiding this comment

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

Make this a page component (like ) called . This will help readability - no single large components but components made of smaller components. Generally a good idea to make page sections a component. See home page as an example.

<Typography>
View the resources{" "}
<Link
to="https://code-for-life.gitbook.io/teaching-resources/v/rapid-introduction-to-python-code-club"
Copy link
Contributor

Choose a reason for hiding this comment

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

add an env variable starting with "VITE_LINK_". External links should be env vars so we don't need to redeploy if a link is updated. Then:

import.meta.env.VITE_LINK_EXAMPLE

{/*TODO: Link to GTM for analytics*/}
<LinkButton
sx={{ marginTop: "auto" }}
to="https://storage.googleapis.com/codeforlife-assets/club_packs/PythonCodingClub.zip"
Copy link
Contributor

Choose a reason for hiding this comment

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

see above comment about making this an env var

import ClubAim from "./ClubAim"
import { Link, LinkButton } from "codeforlife/components/router"

const CodingClubs: FC = () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

General rule. If we export a component, you must always export the props for the component. Even if the props are empty.

export interface CodingClubsProps {}

const CodingClubs: FC<CodingClubsProps> = () => {...}

export default CodingClubs

Comment on lines 1 to 13
import { type FC } from "react"
import { Typography, useTheme } from "@mui/material"
import { Download as DownloadIcon } from "@mui/icons-material"

import * as page from "codeforlife/components/page"

import CodeClubHeroImage from "../../images/coding_club_hero_hexagon.png"
import AboutUsImage from "../../images/about_us.jpg"
import PythonClubImage from "../../images/coding_club_python_pack.png"
import Introduction from "../../components/Introduction"

import ClubAim from "./ClubAim"
import { Link, LinkButton } from "codeforlife/components/router"
Copy link
Contributor

Choose a reason for hiding this comment

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

Sort imports. Unfortunately, prettiers import sorting works differently to isort in python (prettier's behaviour is worse IMO). Prettier sorts imports by group (not as a whole). The sort order I have been following so far is:

// {default and 3rd party imports on top}
// space here
// {codeforlife imports in the middle}
// space here
// {relative imports on the bottom}

If we want to change this order, we need to so everywhere.

import { type FC } from "react"
import { Stack, Typography } from "@mui/material"

const ClubAim: FC = () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

see other comment about exporting props

Comment on lines 12 to 17
const Introduction: FC<{
header: string
img: { alt: string; src: string }
children: ReactNode
direction?: ResponsiveStyleValue<GridDirection>
}> = ({ header, img, children, direction = "row" }) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

see other comment about export props

Copy link
Contributor

@SKairinos SKairinos left a comment

Choose a reason for hiding this comment

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

merge in dev

Copy link
Contributor Author

@faucomte97 faucomte97 left a comment

Choose a reason for hiding this comment

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

Done.

Reviewable status: 0 of 7 files reviewed, 8 unresolved discussions (waiting on @SKairinos)


src/pages/codingClubs/CodingClubs.tsx line 13 at r1 (raw file):

Previously, SKairinos (Stefan Kairinos) wrote…

Sort imports. Unfortunately, prettiers import sorting works differently to isort in python (prettier's behaviour is worse IMO). Prettier sorts imports by group (not as a whole). The sort order I have been following so far is:

// {default and 3rd party imports on top}
// space here
// {codeforlife imports in the middle}
// space here
// {relative imports on the bottom}

If we want to change this order, we need to so everywhere.

I'm confused, how come the pipeline doesn't complain about the imports then?


src/pages/codingClubs/CodingClubs.tsx line 15 at r1 (raw file):

Previously, SKairinos (Stefan Kairinos) wrote…

General rule. If we export a component, you must always export the props for the component. Even if the props are empty.

export interface CodingClubsProps {}

const CodingClubs: FC<CodingClubsProps> = () => {...}

export default CodingClubs

Done.


src/pages/codingClubs/CodingClubs.tsx line 59 at r1 (raw file):

Previously, SKairinos (Stefan Kairinos) wrote…

Make this a page component (like ) called . This will help readability - no single large components but components made of smaller components. Generally a good idea to make page sections a component. See home page as an example.

A page component like what called what?


src/pages/codingClubs/CodingClubs.tsx line 77 at r1 (raw file):

Previously, SKairinos (Stefan Kairinos) wrote…

add an env variable starting with "VITE_LINK_". External links should be env vars so we don't need to redeploy if a link is updated. Then:

import.meta.env.VITE_LINK_EXAMPLE

Wasn't sure what the convention was here since the link to the Outlook outbox in OpenInEmailButtons is not an env var. Should I make it one?

Copy link
Contributor

@SKairinos SKairinos left a comment

Choose a reason for hiding this comment

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

Reviewed 4 of 7 files at r1, all commit messages.
Reviewable status: 4 of 7 files reviewed, 8 unresolved discussions (waiting on @faucomte97)

Copy link
Contributor

@SKairinos SKairinos left a comment

Choose a reason for hiding this comment

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

Reviewable status: 4 of 7 files reviewed, 8 unresolved discussions (waiting on @faucomte97)


src/pages/codingClubs/CodingClubs.tsx line 59 at r1 (raw file):

Previously, faucomte97 (Florian Aucomte) wrote…

A page component like what called what?

That's annoying - Don't know why these words were excluded.

Make a page component called <Primary /> (like <ClubAim />)

Copy link
Contributor

@SKairinos SKairinos left a comment

Choose a reason for hiding this comment

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

Reviewable status: 4 of 7 files reviewed, 8 unresolved discussions (waiting on @faucomte97)


src/pages/codingClubs/CodingClubs.tsx line 93 at r1 (raw file):

Previously, SKairinos (Stefan Kairinos) wrote…

Make this a page component (like ) called . This will help readability - no single large components but components made of smaller components. Generally a good idea to make page sections a component. See home page as an example.

Make a page component called <Python /> (like <ClubAim />)

Copy link
Contributor

@SKairinos SKairinos left a comment

Choose a reason for hiding this comment

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

Reviewable status: 4 of 7 files reviewed, 8 unresolved discussions (waiting on @faucomte97)


src/pages/codingClubs/CodingClubs.tsx line 77 at r1 (raw file):

Previously, faucomte97 (Florian Aucomte) wrote…

Wasn't sure what the convention was here since the link to the Outlook outbox in OpenInEmailButtons is not an env var. Should I make it one?

That's my bad. Yes, please do.

Copy link
Contributor Author

@faucomte97 faucomte97 left a comment

Choose a reason for hiding this comment

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

Reviewable status: 4 of 49 files reviewed, 8 unresolved discussions (waiting on @faucomte97 and @SKairinos)


src/components/Introduction.tsx line 17 at r1 (raw file):

Previously, SKairinos (Stefan Kairinos) wrote…

see other comment about export props

Done.


src/pages/codingClubs/ClubAim.tsx line 4 at r1 (raw file):

Previously, SKairinos (Stefan Kairinos) wrote…

see other comment about exporting props

Done.


src/pages/codingClubs/CodingClubs.tsx line 13 at r1 (raw file):

Previously, faucomte97 (Florian Aucomte) wrote…

I'm confused, how come the pipeline doesn't complain about the imports then?

Done.


src/pages/codingClubs/CodingClubs.tsx line 59 at r1 (raw file):

Previously, SKairinos (Stefan Kairinos) wrote…

That's annoying - Don't know why these words were excluded.

Make a page component called <Primary /> (like <ClubAim />)

Done.


src/pages/codingClubs/CodingClubs.tsx line 77 at r1 (raw file):

Previously, SKairinos (Stefan Kairinos) wrote…

That's my bad. Yes, please do.

Done.


src/pages/codingClubs/CodingClubs.tsx line 87 at r1 (raw file):

Previously, SKairinos (Stefan Kairinos) wrote…

see above comment about making this an env var

Done.


src/pages/codingClubs/CodingClubs.tsx line 93 at r1 (raw file):

Previously, SKairinos (Stefan Kairinos) wrote…

Make a page component called <Python /> (like <ClubAim />)

Done.

Copy link
Contributor

@SKairinos SKairinos left a comment

Choose a reason for hiding this comment

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

Reviewed 2 of 48 files at r3, all commit messages.
Reviewable status: 6 of 52 files reviewed, 9 unresolved discussions (waiting on @faucomte97)


vite.config.ts line 2 at r4 (raw file):

import { defineConfig } from "vitest/config"
import path from "path"

should be in 1st group on it's own. path is a built-in module (see)


src/pages/codingClubs/CodingClubs.tsx line 13 at r1 (raw file):

Previously, faucomte97 (Florian Aucomte) wrote…

I'm confused, how come the pipeline doesn't complain about the imports then?

The way prettier work

Copy link
Contributor

@SKairinos SKairinos left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 48 files at r3.
Reviewable status: 7 of 52 files reviewed, 9 unresolved discussions (waiting on @faucomte97)

Copy link
Contributor

@SKairinos SKairinos left a comment

Choose a reason for hiding this comment

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

Reviewed 9 of 48 files at r3.
Reviewable status: 16 of 52 files reviewed, 9 unresolved discussions (waiting on @faucomte97)

Copy link
Contributor

@SKairinos SKairinos left a comment

Choose a reason for hiding this comment

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

Reviewed 3 of 48 files at r3.
Reviewable status: 19 of 52 files reviewed, 9 unresolved discussions (waiting on @faucomte97)

Copy link
Contributor

@SKairinos SKairinos left a comment

Choose a reason for hiding this comment

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

Reviewed 2 of 48 files at r3.
Reviewable status: 21 of 52 files reviewed, 9 unresolved discussions (waiting on @faucomte97)

Copy link
Contributor

@SKairinos SKairinos left a comment

Choose a reason for hiding this comment

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

Reviewed 2 of 48 files at r3.
Reviewable status: 23 of 52 files reviewed, 8 unresolved discussions (waiting on @faucomte97)

Copy link
Contributor

@SKairinos SKairinos left a comment

Choose a reason for hiding this comment

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

Reviewed 2 of 48 files at r3.
Reviewable status: 25 of 52 files reviewed, 5 unresolved discussions (waiting on @faucomte97)

Copy link
Contributor

@SKairinos SKairinos left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 48 files at r3.
Reviewable status: 26 of 52 files reviewed, 1 unresolved discussion (waiting on @faucomte97)

Copy link
Contributor

@SKairinos SKairinos left a comment

Choose a reason for hiding this comment

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

Reviewed 22 of 48 files at r3, 3 of 3 files at r4.
Reviewable status: 51 of 52 files reviewed, 3 unresolved discussions (waiting on @faucomte97)


src/pages/codingClubs/Primary.tsx line 15 at r4 (raw file):

    <Introduction
      header="Primary coding club"
      img={{ alt: "aboutUs", src: AboutUsImage }}

provide appropriate alt text that describes the image


src/pages/codingClubs/Python.tsx line 15 at r4 (raw file):

    <Introduction
      header="Python coding club"
      img={{ alt: "pythonCodingClub", src: PythonClubImage }}

provide appropriate alt text that describes the image

Copy link
Contributor

@SKairinos SKairinos left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 48 files at r3.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @faucomte97)

Copy link
Contributor Author

@faucomte97 faucomte97 left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @SKairinos)


vite.config.ts line 2 at r4 (raw file):

Previously, SKairinos (Stefan Kairinos) wrote…

should be in 1st group on it's own. path is a built-in module (see)

Done.


src/pages/codingClubs/Primary.tsx line 15 at r4 (raw file):

Previously, SKairinos (Stefan Kairinos) wrote…

provide appropriate alt text that describes the image

Done.


src/pages/codingClubs/Python.tsx line 15 at r4 (raw file):

Previously, SKairinos (Stefan Kairinos) wrote…

provide appropriate alt text that describes the image

Done.

Copy link
Contributor

@SKairinos SKairinos left a comment

Choose a reason for hiding this comment

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

Reviewed 3 of 3 files at r5, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @faucomte97)

@faucomte97 faucomte97 merged commit 89d0aa6 into development Jul 22, 2024
8 of 9 checks passed
@faucomte97 faucomte97 deleted the coding_clubs_page branch July 22, 2024 13:33
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