Skip to content

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

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

A-Vamshi
Copy link

@A-Vamshi A-Vamshi commented Jun 1, 2025

This PR adds the entityName prop to the following components/pages as requested in #655 issue.

  • selected-team-settings
  • account-settings
  • team-creation

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 in AccountSettings, TeamCreation, and SelectedTeamSwitcher, using pluralize for plural forms.

  • Behavior:
    • Adds entityName prop to AccountSettings, TeamCreation, and SelectedTeamSwitcher components for customizable labels.
    • Defaults to "Team" if entityName is not provided.
    • Uses pluralize for handling plural forms of entityName.
  • Dependencies:
    • Adds pluralize to devDependencies in package.json and packages/template/package.json.
  • Misc:
    • Updates various UI text elements to use entityName in account-settings.tsx, team-creation.tsx, and selected-team-switcher.tsx.

This description was created by Ellipsis for 763fff6. You can customize this summary. It will automatically update as commits are pushed.

Copy link

vercel bot commented Jun 1, 2025

Someone is attempting to deploy a commit to the Stack Team on Vercel.

A member of the Team first needs to authorize it.

@CLAassistant
Copy link

CLAassistant commented Jun 1, 2025

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ A-Vamshi
❌ Vamshi Adimalla


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.

Copy link

recurseml bot commented Jun 1, 2025

✨ No issues found! Your code is sparkling clean! ✨

🗒️ View all ignored comments in this repo
  • The constraint 'TokenStoreType extends string' is too restrictive. It should likely be 'TokenStoreType extends string | object' to match the condition check in line 113 where TokenStoreType is checked against {}
  • Return type mismatch - the interface declares useUsers() returning ServerUser[] but the Team interface that this extends declares useUsers() returning TeamUser[]
  • There is a syntax error in the super constructor call due to the ellipsis operator used incorrectly. Objects aren't being merged correctly. This syntax usage can lead to runtime errors when trying to pass the merged object to 'super()'. Verify that the intended alterations to the object occur before or outside of the super() call if needed.
  • Throwing an error when no active span is found is too aggressive. The log function should gracefully fallback to console.log or another logging mechanism when there's no active span, since not all execution contexts will have an active span. This makes the code less resilient and could break functionality in non-traced environments.

📚 Relevant Docs

  • Function sets backendContext with a new configuration but doesn't pass 'defaultProjectKeys'. Since defaultProjectKeys is required in the type definition and cannot be updated (throws error if tried to set), this will cause a type error.
  • The schema is using array syntax for pick() which is incorrect for Yup schemas. The pick() method in Yup expects individual arguments, not an array. Should be changed to: emailConfigSchema.pick('type', 'host', 'port', 'username', 'sender_name', 'sender_email')

📚 Relevant Docs

  • Creating a refresh token with current timestamp as expiration means it expires immediately. Should set a future date for token expiration.
  • The 'tools' object is initialized as an empty object, even though 'tools' is presumably expected to contain tool definitions. This could cause the server capabilities to lack necessary tool configurations, thus potentially impacting functionalities that depend on certain tool setups.

📚 Relevant Docs

  • 'STACK_SECRET_SERVER_KEY' is potentially being included in every request header without checking its existence again here. Although it's checked during initialization, this could lead to security issues as it's exposed in all communications where the header is logged or captured.

📚 Relevant Docs

  • When adding 'use client' directive at the beginning, it doesn't check if file.text already contains the 'use client' directive. This could lead to duplicate 'use client' directives if the file already has one.

📚 Relevant Docs

Copy link
Contributor

@greptile-apps greptile-apps bot left a 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' to TeamCreation, AccountSettings, and SelectedTeamSwitcher 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`)),
Copy link
Contributor

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`,
Copy link
Contributor

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)}`),
Copy link
Contributor

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})

Suggested change
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}`)}>
Copy link
Contributor

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()}`)}
Copy link
Contributor

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.

Copy link

patched-codes bot commented Jun 1, 2025

Documentation Changes Required

1. docs/fern/docs/pages-template/components/account-settings.mdx

  • Add the following prop to the Props section, between fullPage and extraItems:
    - `entityName` (optional): `string` - Custom name to use instead of "Team" for the team entities. The plural form will be automatically generated.

2. docs/fern/docs/pages-template/components/selected-team-switcher.mdx

  1. Add the following prop to the Props section:

    - `entityName` (optional): `string` - Used to customize the entity type name (defaults to 'Team')
  2. Add a new 'Custom Entity Example' section showing how to use the component with a different entity type (e.g., Organization)

  3. Update documentation to reflect that labels like 'Select team', 'Current team', 'Other teams' will change based on the entityName prop

3. docs/fern/docs/pages-template/sdk/types/project.mdx

No 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>
Copy link
Contributor

@N2D4 N2D4 left a 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

@N2D4
Copy link
Contributor

N2D4 commented Jul 9, 2025

Also, can you please sign the CLA?

nevermind, just saw you already signed on your other account

@A-Vamshi
Copy link
Author

I'll be making another PR soon after making these changes "t(abc {myvar1} ghi, { myvar1: def })" as requested.

@A-Vamshi
Copy link
Author

Just made the new PR here: #762

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