-
Notifications
You must be signed in to change notification settings - Fork 429
Added entityName property #762
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
@A-Vamshi is attempting to deploy a commit to the Stack Team on Vercel. A member of the Team first needs to authorize it. |
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 configurable entity naming across team-related components, allowing customization of team terminology (e.g., 'Team' to 'Course') throughout the UI.
- Added
entityName
prop to key components (TeamCreation
,SelectedTeamSwitcher
,TeamInvitation
,AccountSettings
) with pluralization support - Uses a new
pluralize
package dependency for handling entity name pluralization consistently - Inconsistent casing and type handling for
entityName
prop across components needs standardization - Potential prop type mismatches in
packages/template/src/components-page/team-invitation.tsx
require attention - Consider using a
Map
instead of plain objects for dynamic string templating to prevent prototype pollution
5 files reviewed, 6 comments
Edit PR Review Bot Settings | Greptile
const entityName = props.entityName ?? "Team"; | ||
const pluralEntity = 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.
style: Consider caching pluralized value in useMemo to prevent unnecessary recalculations on re-renders
export function TeamInvitation(props: { | ||
fullPage?: boolean, | ||
searchParams: Record<string, string> | ||
entityName: string, | ||
}) { |
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: Type mismatch between TeamInvitation and TeamInvitationInner components. entityName is required here but optional in TeamInvitationInner.
export function TeamInvitation(props: { | |
fullPage?: boolean, | |
searchParams: Record<string, string> | |
entityName: string, | |
}) { | |
export function TeamInvitation(props: { | |
fullPage?: boolean, | |
searchParams: Record<string, string> | |
entityName?: string, | |
}) { |
<MessageCard title={t('Expired {entity} Invitation Link', {entity: entityName})} fullPage={fullPage}> | ||
<Typography>{t('Your team invitation link has expired. Please request a new {entity} invitation link ', {entity: entityName.toLowerCase()})}</Typography> | ||
</MessageCard> |
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: Inconsistent string: 'team' is hardcoded here while entityName is used for the title
<MessageCard title={t('Expired {entity} Invitation Link', {entity: entityName})} fullPage={fullPage}> | |
<Typography>{t('Your team invitation link has expired. Please request a new {entity} invitation link ', {entity: entityName.toLowerCase()})}</Typography> | |
</MessageCard> | |
<MessageCard title={t('Expired {entity} Invitation Link', {entity: entityName})} fullPage={fullPage}> | |
<Typography>{t('Your {entity} invitation link has expired. Please request a new {entity} invitation link ', {entity: entityName.toLowerCase()})}</Typography> | |
</MessageCard> |
@@ -160,13 +164,13 @@ export function AccountSettings(props: { | |||
<Typography className="max-w-[320px] md:w-[90%] truncate">{team.displayName}</Typography> | |||
</div>, | |||
type: 'item', | |||
id: `team-${team.id}`, | |||
id: `${entityName.toLowerCase()}-${team.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: Keep team-related IDs consistent. Other IDs like 'team-creation' still use hardcoded 'team-' prefix while this line uses dynamic entityName
export function TeamInvitation(props: { | ||
fullPage?: boolean, | ||
searchParams: Record<string, string> | ||
entityName: string, |
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.
Breaking change in TeamInvitation component's props interface - 'entityName' is marked as required but existing usages in stack-handler.tsx and potentially other places don't provide this prop. This will cause TypeScript compilation errors and potential runtime issues if not provided. The props should maintain backward compatibility by making entityName optional with a default value of 'Team'.
React with 👍 to tell me that this comment was useful, or 👎 if not (and I'll stop posting more comments like this in the future)
😱 Found 1 issue. Time to roll up your sleeves! 😱 🗒️ View all ignored comments in this repo
Need help? Join our Discord for support! |
@@ -94,7 +99,7 @@ function Inner<AllowNull extends boolean>(props: SelectedTeamSwitcherProps<Allow | |||
if (value !== 'null-sentinel') { | |||
team = teams?.find(team => team.id === value) || null; | |||
if (!team) { | |||
throw new StackAssertionError('Team not found, this should not happen'); | |||
throw new StackAssertionError('{entity} not found, this should not happen', {entity: 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.
The error message in the StackAssertionError contains spaces and is not machine‐readable. Consider using a unique, identifier-like string (e.g. "selected-team-not-found") as the first argument.
throw new StackAssertionError('{entity} not found, this should not happen', {entity: entityName}); | |
throw new StackAssertionError('selected-team-not-found', {entity: entityName}); |
This comment was generated because it violated a code review rule: mrule_dFi2eJA7OgSpYeiv.
Documentation Changes Required1. docs/templates/components/account-settings.mdx
2. docs/templates/sdk/types/project.mdxUpdate the description of
3. docs/templates/components/selected-team-switcher.mdx
<SelectedTeamSwitcher
urlMap={(team) => `/team/${team.id}`}
selectedTeam={currentTeam}
noUpdateSelectedTeam={false}
entityName="Organization"
/> 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>
This PR adds the entityName prop to the following components/pages as requested in #655
selected-team-switcher
account-settings
team-creation
team-invitation
Important
Add
entityName
prop to customize entity name display in team-related components usingpluralize
.entityName
prop toAccountSettings
,TeamCreation
,TeamInvitation
, andSelectedTeamSwitcher
components to customize entity name display.pluralize
library inaccount-settings.tsx
andselected-team-switcher.tsx
to handle plural forms ofentityName
.AccountSettings
: UsesentityName
to customize team-related titles and IDs.TeamCreation
: UsesentityName
for form validation messages and UI text.TeamInvitation
: UsesentityName
for invitation messages and error handling.SelectedTeamSwitcher
: UsesentityName
for dropdown labels and error messages.pluralize
topackage.json
for handling pluralization.This description was created by
for 4ba52c3. You can customize this summary. It will automatically update as commits are pushed.