-
Notifications
You must be signed in to change notification settings - Fork 428
Added entityName prop for custom labels #700
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
base: dev
Are you sure you want to change the base?
Conversation
…am-creation pages
Someone is attempting to deploy a commit to the Stack Team on Vercel. A member of the Team first needs to authorize it. |
Vamshi Adimalla seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
✨ No issues found! Your code is sparkling clean! ✨ 🗒️ View all ignored comments in this repo
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
Added entityName
prop to multiple components to allow customization of 'Team' terminology to other terms like 'Course', addressing issue #655's request for label customization.
- Added
entityName
prop with default 'Team' toTeamCreation
,AccountSettings
, andSelectedTeamSwitcher
components - Integrated
pluralize
package for proper handling of singular/plural entity names - Updated validation messages and UI labels to use the custom entity name
- Note: URL paths and component IDs still use 'team' terminology, which may need addressing in a broader refactor
💡 (1/5) You can manually trigger the bot by mentioning @greptileai in a comment!
5 file(s) reviewed, 6 comment(s)
Edit PR Review Bot Settings | Greptile
|
||
const schema = yupObject({ | ||
displayName: yupString().defined().nonEmpty(t('Please enter a team name')), | ||
displayName: yupString().defined().nonEmpty(t(`Please enter ${entityName.toLowerCase()} name`)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: Translation string with interpolation should use a translation key instead of direct interpolation to support proper localization
icon: <Icon name="CirclePlus"/>, | ||
type: 'item', | ||
id: 'team-creation', | ||
id: `team-creation`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: ID still uses hardcoded 'team-creation' instead of entityName like other IDs
@@ -101,7 +104,7 @@ export function AccountSettings(props: { | |||
content: item.content, | |||
} as const)) || []), | |||
...(teams.length > 0 || project.config.clientTeamCreationEnabled) ? [{ | |||
title: t('Teams'), | |||
title: t(`${pluralize(entityName)}`), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: t() call with template literal could cause translation issues. Consider using t('plural_entity', {entity: entityName})
title: t(`${pluralize(entityName)}`), | |
title: t('plural_entity', { entity: entityName }), |
</SelectTrigger> | ||
<SelectContent className="stack-scope"> | ||
{user?.selectedTeam ? <SelectGroup> | ||
<SelectLabel> | ||
<div className="flex items-center justify-between"> | ||
<span> | ||
{t('Current team')} | ||
{t(`Current ${entityName.toLowerCase()}`)} | ||
</span> | ||
<Button variant='ghost' size='icon' className="h-6 w-6" onClick={() => navigate(`${app.urls.accountSettings}#team-${user.selectedTeam?.id}`)}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: URL path still uses hardcoded 'team-' prefix in #team-${user.selectedTeam?.id}. Should use entityName for consistency.
</SelectTrigger> | ||
<SelectContent className="stack-scope"> | ||
{user?.selectedTeam ? <SelectGroup> | ||
<SelectLabel> | ||
<div className="flex items-center justify-between"> | ||
<span> | ||
{t('Current team')} | ||
{t(`Current ${entityName.toLowerCase()}`)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Translation key uses string interpolation which may not work with all translation systems. Consider using a mapping of fixed keys instead.
Documentation Changes Required1. docs/fern/docs/pages-template/components/account-settings.mdx
2. docs/fern/docs/pages-template/components/selected-team-switcher.mdx
3. docs/fern/docs/pages-template/sdk/types/project.mdxNo changes needed to this file. The changes in the TeamCreation component are UI-related customizations that don't affect the core functionality described in the documentation. Please ensure these changes are reflected in the relevant documentation files. |
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution! Just one comment, all occurences like t(`abc ${def} ghi`) must be like t(`abc {myvar1} ghi`, { myvar1: def }), or it'll break translation
nevermind, just saw you already signed on your other account |
I'll be making another PR soon after making these changes "t( |
Just made the new PR here: #762 |
This PR adds the entityName prop to the following components/pages as requested in #655 issue.
While this addresses part of the issue, it's not a complete solution. Fully supporting this feature would likely require a broader change to the use of "team" terminology across the codebase.
I'm happy to take on this larger refactor if the maintainers agree it's the right direction.
Important
Adds
entityName
prop for customizable labels inAccountSettings
,TeamCreation
, andSelectedTeamSwitcher
, usingpluralize
for plural forms.entityName
prop toAccountSettings
,TeamCreation
, andSelectedTeamSwitcher
components for customizable labels.entityName
is not provided.pluralize
for handling plural forms ofentityName
.pluralize
todevDependencies
inpackage.json
andpackages/template/package.json
.entityName
inaccount-settings.tsx
,team-creation.tsx
, andselected-team-switcher.tsx
.This description was created by
for 763fff6. You can customize this summary. It will automatically update as commits are pushed.