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

Working group "About" tab description and routing #4771

Merged
merged 12 commits into from
Feb 14, 2024

Conversation

Ilichhh
Copy link
Contributor

@Ilichhh Ilichhh commented Feb 13, 2024

  • Add default description for WG if metadata is not set by WG Lead
  • Fix broken Handbook links
  • Add routing to WG page

The working "About" tab is empty (for all working groups) #4654

Copy link

vercel bot commented Feb 13, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
dao ✅ Ready (Inspect) Visit Preview Feb 14, 2024 11:58am
pioneer-2 ✅ Ready (Inspect) Visit Preview Feb 14, 2024 11:58am
pioneer-2-storybook ✅ Ready (Inspect) Visit Preview Feb 14, 2024 11:58am

Copy link
Member

@thesan thesan left a comment

Choose a reason for hiding this comment

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

Nice work again! There is just a few details to tweak:


export const WorkingGroupTabs = () => {
const { name } = useParams<{ name: string }>()
const tabs = usePageTabs(workingGroupTabs.map(([title, path]) => [title, path.replace(':name', name)]))
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
const tabs = usePageTabs(workingGroupTabs.map(([title, path]) => [title, path.replace(':name', name)]))
const tabs = usePageTabs(workingGroupTabs.map(([title, path]) => [title, generatePath(path, { name })]))

Comment on lines 19 to 21
export const WorkingGroupPageHeader = React.memo(({ withButtons = false }: WorkingGroupPageHeaderProps) => {
const { name } = useParams<{ name: string }>()
const { group } = useWorkingGroup({ name: urlParamToWorkingGroupId(name) })
Copy link
Member

Choose a reason for hiding this comment

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

useWorkingGroup is called by all WorkingGroup, WorkingGroupHistory, and WorkingGroupOpenings so it's called twice on each tab. It's not a very expensive query but I think it's not cached rn so it would be better to just pass group as a property instead:

Suggested change
export const WorkingGroupPageHeader = React.memo(({ withButtons = false }: WorkingGroupPageHeaderProps) => {
const { name } = useParams<{ name: string }>()
const { group } = useWorkingGroup({ name: urlParamToWorkingGroupId(name) })
export const WorkingGroupPageHeader = React.memo(({ group, withButtons = false }: WorkingGroupPageHeaderProps) => {

@@ -53,7 +53,7 @@ const WG_JSON_OPENING = {

export default {
title: 'Pages/Working Group/WorkingGroup',
component: WorkingGroup,
component: WorkingGroupOpenings,
Copy link
Member

Choose a reason for hiding this comment

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

Please leave:

Suggested change
component: WorkingGroupOpenings,
component: WorkingGroup,

Because the stories in app/pages should test page behaviors

@@ -64,7 +64,7 @@ export default {
},

parameters: {
router: { path: '/:name', href: `/${WG_DATA.name}` },
router: { path: '/:name/openings', href: `/${WG_DATA.name}/openings` },
Copy link
Member

Choose a reason for hiding this comment

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

For the same reason I think it would be good set the default route to:

Suggested change
router: { path: '/:name/openings', href: `/${WG_DATA.name}/openings` },
router: { path: '/working-groups/:name', href: `/working-groups/${WG_DATA.name}` },

It creates a smoke test for the about tab. Although you might need to add some gql.queries in case the story crashes. The missing queries are shown in the console
image
(but no need to add everything just enough for story not to crash).

Then for the 2 tests you can set:

export const CreateOpeningImport: Story = {
  parameters: {
    router: { path: '/working-groups/:name', href: `/working-groups/${WG_DATA.name}` },
  },
  play: async ({ args, canvasElement, step }) => { ...

and same thing for CreateOpeningImport.

<MarkdownPreview markdown={workingGroup.about || defaultDescription} />
{handbookLink && (
<ExternalLinkButtonGhost size="small" href={handbookLink} disabled={false} target="_blank">
Learn more from Knowlage Book
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Learn more from Knowlage Book
Learn more from the Handbook

Copy link
Member

@thesan thesan left a comment

Choose a reason for hiding this comment

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

My suggestion here was wrong since the WorkingGroup component is now actually the About tab. What you implemented instead works but it duplicates a lot of code for testing just one page.

Instead I replaced WorkingGroup by WorkingGroupsModule which works more like the original suggestion. But I wanted to make sure it worked first so I committed it myself.

The rest LGTM !

@thesan thesan merged commit bd7d173 into Joystream:dev Feb 14, 2024
7 checks passed
@Ilichhh
Copy link
Contributor Author

Ilichhh commented Feb 14, 2024

My suggestion here was wrong since the WorkingGroup component is now actually the About tab. What you implemented instead works but it duplicates a lot of code for testing just one page.

Instead I replaced WorkingGroup by WorkingGroupsModule which works more like the original suggestion. But I wanted to make sure it worked first so I committed it myself.

The rest LGTM !

Cool, thanks!
But you just removed some gql.queries that I added, and wornings on History and Openings tabs appears again. I don't think they're really needed since they contain empty data. Plus other stories also have a lot of missing gueries and there are wornings. Just want to clarify this point for better understanding for the future.

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.

None yet

2 participants