Skip to content

Commit dee1056

Browse files
committed
org notification quota
1 parent 2ffd3ed commit dee1056

File tree

3 files changed

+21
-9
lines changed

3 files changed

+21
-9
lines changed

src/components/pages/environments/_components/CardView.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,11 @@ export const CardView: FC<Props> = ({
107107
<NewEnvironment projectName={projectName} refetch={refetch} />
108108
</StyledEnvironmentsWrapper>
109109

110-
{environments.length > slicedEnvsByCount.length ? <StyledEnvText $button onClick={handleShowMore}>Show more...</StyledEnvText> : null}
110+
{environments.length > slicedEnvsByCount.length ? (
111+
<StyledEnvText $button onClick={handleShowMore}>
112+
Show more...
113+
</StyledEnvText>
114+
) : null}
111115
<StyledEnvText>
112116
Showing {slicedEnvsByCount.length} of {environments.length} Environments
113117
</StyledEnvText>

src/components/pages/environments/styles.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,16 @@ export const StyledToggle = styled.div`
4545
cursor: pointer;
4646
`;
4747

48-
export const StyledEnvText = styled.div<{$button?: boolean}>`
48+
export const StyledEnvText = styled.div<{ $button?: boolean }>`
4949
font-family: 'ArabicPro-Regular', sans-serif;
5050
margin-top: 1rem;
5151
52-
${props => props.$button && css`
53-
cursor: pointer;
54-
&:hover{
55-
text-decoration: underline;
56-
}
57-
`}
52+
${props =>
53+
props.$button &&
54+
css`
55+
cursor: pointer;
56+
&:hover {
57+
text-decoration: underline;
58+
}
59+
`}
5860
`;

src/components/pages/organizations/organization/OrganizationPage.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { DetailedStats, Details, Head2 } from '@uselagoon/ui-library';
1111
import { Description } from './_components/Description';
1212
import { OrgActionsWrapper, OrgDeployTargets } from './_components/styles';
1313

14+
type Notification = 'slacks' | 'rocketchats' | 'webhook' | 'teams' | 'emails';
1415
export default function OrganizationPage({
1516
queryRef,
1617
orgSlug,
@@ -32,6 +33,11 @@ export default function OrganizationPage({
3233

3334
const groupCount = Object.values(organization.groups).filter(group => group.type !== 'project-default-group').length;
3435

36+
const totalNotificationCount = ['slacks', 'rocketchats', 'webhook', 'teams', 'emails'].reduce(
37+
(acc, key) => acc + (organization[key as Notification] ? organization[key as Notification].length : 0),
38+
0
39+
);
40+
3541
const orgDetailedItems = [
3642
{
3743
key: 'org_id',
@@ -67,7 +73,7 @@ export default function OrganizationPage({
6773
label: 'NOTIFICATIONS',
6874
children: (
6975
<>
70-
Notification quota: {organization.quotaNotification} of{' '}
76+
Notification quota: {totalNotificationCount} of{' '}
7177
{organization.quotaNotification === -1 ? 'unlimited' : organization.quotaNotification}
7278
</>
7379
),

0 commit comments

Comments
 (0)