Skip to content

Commit

Permalink
feat: display bitbucket repository name
Browse files Browse the repository at this point in the history
Signed-off-by: Adam Setch <adam.setch@outlook.com>
  • Loading branch information
setchy committed Sep 16, 2024
1 parent 83a6920 commit b449402
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/components/NotificationRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { getCategoryDetails } from '../utils/filters';
import {
formatNotificationUpdatedAt,
formatProperCase,
getRepositoryName,
} from '../utils/helpers';
import { openNotification } from '../utils/links';

Expand Down Expand Up @@ -116,8 +117,11 @@ export const NotificationRow: FC<INotificationRow> = ({
)}
>
<notification.product.icon size="xsmall" appearance="brand" />
{notification.path?.title ??
formatProperCase(notification.product.name)}
{notification.path?.title
? notification.path.title
: notification.product.name === 'bitbucket'
? getRepositoryName(notification)
: formatProperCase(notification.product.name)}
</div>
</div>
</div>
Expand Down
4 changes: 4 additions & 0 deletions src/utils/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ export function formatProperCase(text: string) {
});
}

export function getRepositoryName(notification: AtlasifyNotification): string {
return notification.entity.url.split('/').slice(3, 5).join('/');
}

export function formatNotificationUpdatedAt(
notification: AtlasifyNotification,
): string {
Expand Down

0 comments on commit b449402

Please sign in to comment.