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

[TASK-1083] Add utils for determining MMO labeling #5194

Merged
merged 3 commits into from
Oct 28, 2024

Conversation

jamesrkiger
Copy link
Contributor

@jamesrkiger jamesrkiger commented Oct 24, 2024

Checklist

  1. If you've added code that should be tested, add tests
  2. If you've changed APIs, update (or create!) the documentation
  3. Ensure the tests pass
  4. Run ./python-format.sh to make sure that your code lints and that you've followed our coding style
  5. Write a title and, if necessary, a description of your work suitable for publishing in our release notes
  6. Mention any related issues in this repository (as #ISSUE) and in other repositories (as kobotoolbox/other#ISSUE)
  7. Open an issue in the docs if there are UI/UX changes
  8. Create a testing plan for the reviewer and add it to the Testing section

Description

Adds two helper utils for determining whether an MMO should be referred to as an 'organization' or as a 'team'. One of the utils returns a translated string, with options for plural and capitalization.

Notes

I felt it would be unnecessarily complex to add in the potential for possessive case, so I also abstracted and exported a more simplistic util that just determines which term should be used. So if someone needs possessive case or they will use the label multiple times in a string they can just write out two separate translated strings themselves and use the util to pick which one to return.

Also note that this is may be merged ahead of the backend work for this feature: #5182. I have set the upcoming "use_team_label" field in the envStore as optional for the time being. We will want to remove that once the backend work is merged. But it should not have any impact on current functioning of the frontend.

Testing

Testing may be more hassle than it is worth for this. I'd recommend just double-checking my logic. But if you would like to test, 'yourPlan.component.tsx' already imports both the envStore and subscription context. You can import these functions there and console log the results before and after subscribing to an enterprise plan, for example.

Copy link
Member

@duvld duvld left a comment

Choose a reason for hiding this comment

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

Tiny comment related changes--I'm going to check with the figma to see if the grammar and everything is accounted for, otherwise it looks good

jsapp/js/envStore.ts Show resolved Hide resolved
@@ -0,0 +1,47 @@
import type {SubscriptionInfo} from '../stripe.types';
Copy link
Member

Choose a reason for hiding this comment

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

I think we should use absolute path for imports

@duvld duvld merged commit ffde206 into main Oct 28, 2024
7 checks passed
@duvld duvld deleted the task-1083-mmo-label-util branch October 28, 2024 21:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants