File tree 5 files changed +41
-58
lines changed
static/app/components/idBadge
5 files changed +41
-58
lines changed Original file line number Diff line number Diff line change 1
- import type { BaseBadgeProps } from 'sentry/components/idBadge/baseBadge' ;
2
- import type { MemberBadgeProps } from 'sentry/components/idBadge/memberBadge' ;
3
- import MemberBadge from 'sentry/components/idBadge/memberBadge' ;
4
- import type { OrganizationBadgeProps } from 'sentry/components/idBadge/organizationBadge' ;
5
- import OrganizationBadge from 'sentry/components/idBadge/organizationBadge' ;
6
- import type { ProjectBadgeProps } from 'sentry/components/idBadge/projectBadge' ;
7
- import ProjectBadge from 'sentry/components/idBadge/projectBadge' ;
8
- import { TeamBadge } from 'sentry/components/idBadge/teamBadge' ;
9
- import type { UserBadgeProps } from 'sentry/components/idBadge/userBadge' ;
10
- import UserBadge from 'sentry/components/idBadge/userBadge' ;
11
-
12
- import type { TeamBadgeProps } from './teamBadge/badge' ;
1
+ import type { BaseBadgeProps } from './baseBadge' ;
2
+ import MemberBadge , { type MemberBadgeProps } from './memberBadge' ;
3
+ import OrganizationBadge , { type OrganizationBadgeProps } from './organizationBadge' ;
4
+ import ProjectBadge , { type ProjectBadgeProps } from './projectBadge' ;
5
+ import { TeamBadge , type TeamBadgeProps } from './teamBadge' ;
6
+ import UserBadge , { type UserBadgeProps } from './userBadge' ;
13
7
14
8
type DisplayName = BaseBadgeProps [ 'displayName' ] ;
15
9
File renamed without changes.
Original file line number Diff line number Diff line change
1
+ import TeamStore from 'sentry/stores/teamStore' ;
2
+ import { useLegacyStore } from 'sentry/stores/useLegacyStore' ;
3
+ import type { Team } from 'sentry/types' ;
4
+
5
+ import BadgeDisplayName from './badgeDisplayName' ;
6
+ import BaseBadge , { type BaseBadgeProps } from './baseBadge' ;
7
+
8
+ export interface TeamBadgeProps
9
+ extends Partial < Omit < BaseBadgeProps , 'project' | 'organization' | 'team' > > {
10
+ team : Team ;
11
+ /**
12
+ * When true will default max-width, or specify one as a string
13
+ */
14
+ hideOverflow ?: boolean | string ;
15
+ }
16
+
17
+ function TeamBadge ( { hideOverflow = true , team, ...props } : TeamBadgeProps ) {
18
+ const { teams} = useLegacyStore ( TeamStore ) ;
19
+
20
+ // Get the most up-to-date team from the store
21
+ const resolvedTeam = teams . find ( t => t . id === team . id ) ?? team ;
22
+ const teamName = `#${ resolvedTeam . slug } ` ;
23
+
24
+ return (
25
+ < BaseBadge
26
+ displayName = {
27
+ < BadgeDisplayName hideOverflow = { hideOverflow } > { teamName } </ BadgeDisplayName >
28
+ }
29
+ team = { resolvedTeam }
30
+ { ...props }
31
+ />
32
+ ) ;
33
+ }
34
+
35
+ export { TeamBadge } ;
Load Diff This file was deleted.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments