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

feat: Updated editor teams and team selection pages #3303

Merged
merged 5 commits into from
Jun 21, 2024

Conversation

ianjon3s
Copy link
Contributor

@ianjon3s ianjon3s commented Jun 20, 2024

What does this PR do?

Introduces style and minor structural changes across Teams and Team pages.

Summary of changes:

  • Background changed to light
  • Council branding added to teams list
  • Teams list separated into separate lists based on permissions, teams which a user has editing permissions to will appear first
  • Services styled similar to editor portals

In addition to this a <Dashboard> component has been created to standardise layout and spacing across editor pages (applied to only these two pages for now). This also contains layout styles that make it ready to drop in the editor in-page navigation elements.

Copy link

github-actions bot commented Jun 20, 2024

Removed vultr server and associated DNS entries

@DafyddLlyr
Copy link
Contributor

@ianjon3s Don't sweat too much about failing E2E tests here, I'll jump on and take a look once the PR is ready. It's very likely something very simple to do with the content or location of links changing in the DOM. I'll take a look through and maybe you, me and @RODO94 can debug and work through the fixes together 👍

@ianjon3s
Copy link
Contributor Author

@DafyddLlyr I think it may be as simple as me changing a <h2> to <h3> and not updating tests, I've pushed up a fix for this.

@ianjon3s ianjon3s force-pushed the ian/team-services-pages-update branch from fe4fb5b to 1f0d1a5 Compare June 20, 2024 13:53
@ianjon3s ianjon3s marked this pull request as ready for review June 20, 2024 14:58
@ianjon3s ianjon3s requested a review from a team June 20, 2024 14:59
Copy link
Contributor

@DafyddLlyr DafyddLlyr left a comment

Choose a reason for hiding this comment

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

A few small comments on, visually looking good though.

This isn't introduced here, but the missing focus styles on the DashboardListItems are a bit more noticeable now. This can be addressed now or later (this is fairly inconsistent across the Editor tbh).

Screen.Recording.2024-06-20.at.16.29.30.mov

Comment on lines 34 to 38
teamThemes: teams_summary {
slug
primaryColour: primary_colour
logo
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Rather than adding an additional query here, a better pattern (and actually I think the intended one) would be to use the existing relationships to find the corresponding theme details for the relevant team directly in this query (as opposed to having to match them up later using the .find() iterator).

Try this out in Hasura - it should be both faster/more efficient and allow us to simplify our code -

query GetTeams {
  teams(order_by: {name: asc}) {
    id
    name
    slug
    theme {
      primaryColour: primary_colour
      logo
    }
  }
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've updated the query to the above which has simplified the component 👍

Comment on lines 56 to 57
const editableTeams = teams.filter((team) => canUserEditTeam(team.slug));
const viewOnlyTeams = teams.filter((team) => !canUserEditTeam(team.slug));
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: You could also do this in a single iteration with a .reduce() or .forEach()

reduce()

const { editableTeams, viewOnlyTeams } = teams.reduce(
  (acc, team) => {
    canUserEditTeam(team.slug)
      ? acc.editableTeams.push(team)
      : acc.viewOnlyTeams.push(team)
    
    return acc;
  },
  { editableTeams: [], viewOnlyTeams: [] }
);

forEach()

const editableTeams = [];
const viewOnlyTeams = [];

teams.forEach((team) => (
  canUserEditTeam(team.slug)
    ? editableTeams.push(team)
    : viewOnlyTeams.push(team)
));

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for this, I've gone with forEach as it reads better as a piece of logic.

const renderTeams = (teamsToRender: Array<Team>) =>
teamsToRender.map(({ name, slug }) => {
const theme = teamTheme.find((t) => t.slug === slug);
const primaryColour = theme ? theme.primaryColour : "#000";
Copy link
Contributor

Choose a reason for hiding this comment

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

team_theme.primary_colour is a required field (with a default value) in the database so we should be fine to not have a default here.

It's possible that this is required to get around some TypeScript issues, but this should be resolved by improving the query and dropping the find() (see previous comment).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm now calling this as team.theme.primaryColour without a default value

flexDirection: "row",
width: "100%",
minHeight: `calc(100vh - ${HEADER_HEIGHT}px)`,
"& > .MuiContainer-root": {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should be able to import this classname from MUI 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good spot, applied

{flow.name}
</DashboardLink>
</Typography>
<HiddenText aria-hidden="true">{flow.slug}</HiddenText>
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not too sure how much this is really needed? I know it's helpful as a pseudo-search until we have this feature but we can still CTRL+F on flow names?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed, I've pulled it out. I added as I was getting frustrated when using CTRL+F and typing in a slug, but it's just a case of waiting for new features to be in place.

@DafyddLlyr
Copy link
Contributor

(Also good work on solving the E2E test issues 🙌)

Copy link
Contributor

@DafyddLlyr DafyddLlyr left a comment

Choose a reason for hiding this comment

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

Looking good 👍

Before merging this, let's get a prod deploy done first so we can batch a few Editor changes together. There's a PR here to approve which will let us clear the decks a little first - #3310

@ianjon3s
Copy link
Contributor Author

Thanks for the detailed review and suggestions @DafyddLlyr. I've also added focus outline style to the team cards on initial screen.

@DafyddLlyr
Copy link
Contributor

Thanks @ianjon3s, prod deploy underway so please feel free to merge this 👍

@ianjon3s ianjon3s merged commit ad816b9 into main Jun 21, 2024
12 checks passed
@ianjon3s ianjon3s deleted the ian/team-services-pages-update branch June 21, 2024 11:13
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