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

Feature/8418 content language #671

Merged
merged 12 commits into from
Aug 6, 2020
Merged

Conversation

amoedoamorim
Copy link
Contributor

No description provided.

Copy link
Contributor

@adamhooper adamhooper left a comment

Choose a reason for hiding this comment

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

Looking solid!

I have some suggestions based on patterns and anti-patterns.

The biggest: A component that commits a mutation must be a fragment container. Please make everything a fragment container.

Second is something dear to my heart: a mutation should do exactly one thing. Inline, I suggested two mutation functions for LanguageListItem.js. It might be even nicer to make make sub-components (SetDefaultLanguageAction, DeleteLanguageAction) with one mutation per action.

The final theme: I got confused by languagesList and Team.get_languages. I've put recommendations inline. Client-side, I think we should have a LanguageRegistry.js with helper functions. API-side, can we make Rails return Team.languages, an Array of Strings, and then obliterate Team.get_languages? @caiosba?

Copy link
Contributor

@caiosba caiosba left a comment

Choose a reason for hiding this comment

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

The comments I would add were addressed by Adam :)

@caiosba
Copy link
Contributor

caiosba commented Jul 31, 2020

can we make Rails return Team.languages, an Array of Strings, and then obliterate Team.get_languages? @caiosba?

Yes, this is happening in a branch that is refactoring some things on the GraphQL layer.

Copy link
Contributor

@adamhooper adamhooper left a comment

Choose a reason for hiding this comment

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

This looks fantastic to me! I commented with a couple of nits.

disabled: PropTypes.bool,
checkBoxLabel: PropTypes.object,
continueButtonLabel: PropTypes.object,
checkBoxLabel: PropTypes.oneOfType([
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel this should be PropTypes.node (which captures both).

PropTypes.string,
PropTypes.element,
]),
continueButtonLabel: PropTypes.oneOfType([
Copy link
Contributor

Choose a reason for hiding this comment

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

PropTypes.node

const options = Object.keys(LanguageRegistry)
.filter(code => !languages.includes(code))
.sort((a, b) => compareLanguages(null, a, b));
const getOptionLabel = code => `${languageLabel(code)} (${code})`;
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 Author

Choose a reason for hiding this comment

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

Interesting! Looks like I'll need to use injectIntl and props.intl on this one as the Autocomplete component expects a string and performs .toLowerCase on it

Copy link
Contributor

Choose a reason for hiding this comment

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

Good catch. I think you can call it renderOption instead. (The default renderOption() implementation calls getOptionLabel(). I don't see why there are two methods in the first place....)

team {
id
get_language
get_languages
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this changes ... does it?

value="languages"
/>
: null }
{UserUtil.myRole(this.getCurrentUser(), team.slug) === 'owner' ?
Copy link
Contributor

Choose a reason for hiding this comment

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

Should be currentUserIsOwner

@amoedoamorim amoedoamorim merged commit d58dc10 into develop Aug 6, 2020
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.

3 participants