diff --git a/src/core/auth/AuthGuard.tsx b/src/core/auth/AuthGuard.tsx
index 9230924c..cb337a6f 100644
--- a/src/core/auth/AuthGuard.tsx
+++ b/src/core/auth/AuthGuard.tsx
@@ -254,7 +254,7 @@ export function AuthGuard({ children }: PropsWithChildren) {
)
const handleCheckPermissions = useCallback(
- (...permission: Permissions[]) => permission.map((permission) => handleCheckPermission(permission)),
+ (...permissions: Permissions[]) => permissions.map((permission) => handleCheckPermission(permission)),
[handleCheckPermission],
)
diff --git a/src/core/theme/Theme.tsx b/src/core/theme/Theme.tsx
index 9386f0cc..9be30dc5 100644
--- a/src/core/theme/Theme.tsx
+++ b/src/core/theme/Theme.tsx
@@ -233,6 +233,22 @@ export function Theme({ children, emotionCache }: ThemeProps) {
info: ,
},
},
+ styleOverrides: {
+ root: {
+ borderRadius: '12px',
+ color: panelUI.uiThemePalette.primary.white,
+ backgroundColor: panelUI.uiThemePalette.text.darkGray,
+ },
+ standardError: {
+ backgroundColor: panelUI.uiThemePalette.severity.error,
+ },
+ standardSuccess: {
+ backgroundColor: panelUI.uiThemePalette.severity.success,
+ },
+ standardWarning: {
+ backgroundColor: panelUI.uiThemePalette.severity.warning,
+ },
+ },
},
MuiTooltip: {
styleOverrides: {
diff --git a/src/core/theme/ThemeContext.ts b/src/core/theme/ThemeContext.ts
index 02e78cb5..85dc8346 100644
--- a/src/core/theme/ThemeContext.ts
+++ b/src/core/theme/ThemeContext.ts
@@ -5,7 +5,7 @@ export type ThemeContextRealValues = {
}
export interface ThemeContextValue extends Partial {
- toggleColorMode: (themeMode?: 'light' | 'dark') => void
+ toggleColorMode: (mode?: ThemeContextRealValues['mode']) => void
}
export const ThemeContext = createContext(null)
diff --git a/src/locales/de-DE/messages.po b/src/locales/de-DE/messages.po
index 8ced1f55..e2b88a29 100644
--- a/src/locales/de-DE/messages.po
+++ b/src/locales/de-DE/messages.po
@@ -402,7 +402,7 @@ msgstr ""
msgid "Age"
msgstr "Alter"
-#: src/shared/layouts/panel-settings-layout/settingsMenuList.tsx:52
+#: src/shared/layouts/panel-settings-layout/settingsMenuList.tsx:65
msgid "Alert settings"
msgstr "Benachrichtigungseinstellungen"
@@ -488,7 +488,7 @@ msgstr "API-Zugriff"
msgid "API Key"
msgstr "API-Schlüssel"
-#: src/shared/layouts/panel-settings-layout/settingsMenuList.tsx:37
+#: src/shared/layouts/panel-settings-layout/settingsMenuList.tsx:39
msgid "API tokens"
msgstr ""
@@ -616,8 +616,8 @@ msgid "Benchmarks"
msgstr "Benchmarks"
#: src/shared/layouts/panel-layout/useBreadcrumbs.ts:21
-#: src/shared/layouts/panel-layout/UserButton.tsx:47
-#: src/shared/layouts/panel-settings-layout/settingsMenuList.tsx:56
+#: src/shared/layouts/panel-layout/UserButton.tsx:53
+#: src/shared/layouts/panel-settings-layout/settingsMenuList.tsx:70
msgid "Billing"
msgstr "Abrechnung"
@@ -834,7 +834,7 @@ msgid "Cloud accounts"
msgstr ""
#: src/shared/layouts/panel-layout/useBreadcrumbs.ts:9
-#: src/shared/layouts/panel-layout/UserButton.tsx:42
+#: src/shared/layouts/panel-layout/UserButton.tsx:45
msgid "Cloud Accounts"
msgstr ""
@@ -939,11 +939,11 @@ msgstr "Verbinden Sie PagerDuty"
msgid "Connect Teams"
msgstr "Verbinden Sie Teams"
-#: src/shared/layouts/panel-settings-layout/settingsMenuList.tsx:33
+#: src/shared/layouts/panel-settings-layout/settingsMenuList.tsx:35
msgid "Connected accounts"
msgstr "Verbundene konten"
-#: src/shared/layouts/panel-settings-layout/settingsMenuList.tsx:48
+#: src/shared/layouts/panel-settings-layout/settingsMenuList.tsx:60
msgid "Connected services"
msgstr "Vernetzte dienste"
@@ -1050,7 +1050,7 @@ msgstr ""
msgid "Current Product Tier"
msgstr ""
-#: src/shared/layouts/panel-settings-layout/settingsMenuList.tsx:63
+#: src/shared/layouts/panel-settings-layout/settingsMenuList.tsx:78
msgid "Current users"
msgstr ""
@@ -1732,7 +1732,7 @@ msgstr "Melden Sie sich mit {formattedName} an"
msgid "Log Out"
msgstr "Ausloggen"
-#: src/shared/layouts/panel-layout/UserButton.tsx:60
+#: src/shared/layouts/panel-layout/UserButton.tsx:67
msgid "Logout"
msgstr ""
@@ -1978,7 +1978,7 @@ msgstr ""
msgid "Nothing to show yet"
msgstr "Noch nichts zu zeigen"
-#: src/shared/layouts/panel-settings-layout/settingsMenuList.tsx:29
+#: src/shared/layouts/panel-settings-layout/settingsMenuList.tsx:31
msgid "Notifications"
msgstr "Benachrichtigungen"
@@ -2167,7 +2167,7 @@ msgstr ""
msgid "Payment update failed: The provided payment method is unrecognized. Please verify your details and use a supported payment method."
msgstr ""
-#: src/shared/layouts/panel-settings-layout/settingsMenuList.tsx:67
+#: src/shared/layouts/panel-settings-layout/settingsMenuList.tsx:82
msgid "Pending invitations"
msgstr ""
@@ -2769,6 +2769,10 @@ msgstr ""
msgid "There's already another api tokens with the same description"
msgstr ""
+#: src/pages/panel/workspace-settings-connected-services/WorkspaceSettingsConnectedServicesPage.tsx:42
+msgid "There's no connected services"
+msgstr ""
+
#: src/pages/panel/accounts/AccountRow.tsx:489
msgid "This account is currently in a degraded state possibly due to a misconfiguration.<0/>Fix was unable to gather data from this account."
msgstr ""
@@ -2936,7 +2940,7 @@ msgstr ""
msgid "Use OTP instead"
msgstr ""
-#: src/shared/layouts/panel-settings-layout/settingsMenuList.tsx:25
+#: src/shared/layouts/panel-settings-layout/settingsMenuList.tsx:27
msgid "User details"
msgstr ""
@@ -2948,11 +2952,11 @@ msgstr ""
msgid "User Invitations"
msgstr ""
-#: src/shared/layouts/panel-settings-layout/settingsMenuList.tsx:18
+#: src/shared/layouts/panel-settings-layout/settingsMenuList.tsx:20
msgid "User settings"
msgstr "Benutzereinstellungen"
-#: src/shared/layouts/panel-layout/UserButton.tsx:27
+#: src/shared/layouts/panel-layout/UserButton.tsx:28
msgid "User Settings"
msgstr "Benutzereinstellungen"
@@ -3066,7 +3070,7 @@ msgstr ""
msgid "Workspace Alerting Settings"
msgstr "Workspace-Benachrichtigungseinstellungen"
-#: src/shared/layouts/panel-settings-layout/settingsMenuList.tsx:44
+#: src/shared/layouts/panel-settings-layout/settingsMenuList.tsx:56
msgid "Workspace details"
msgstr ""
@@ -3079,21 +3083,21 @@ msgstr "Workspace Id"
msgid "Workspace Name"
msgstr "Arbeitsbereichsname"
-#: src/shared/layouts/panel-settings-layout/settingsMenuList.tsx:19
+#: src/shared/layouts/panel-settings-layout/settingsMenuList.tsx:21
msgid "Workspace settings"
msgstr ""
#: src/shared/layouts/panel-layout/useBreadcrumbs.ts:7
-#: src/shared/layouts/panel-layout/UserButton.tsx:32
+#: src/shared/layouts/panel-layout/UserButton.tsx:35
msgid "Workspace Settings"
msgstr "Arbeitsbereichseinstellungen"
-#: src/shared/layouts/panel-settings-layout/settingsMenuList.tsx:20
+#: src/shared/layouts/panel-settings-layout/settingsMenuList.tsx:22
msgid "Workspace users"
msgstr ""
#: src/pages/panel/workspace-users-settings/WorkspaceUsersSettingsPage.tsx:91
-#: src/shared/layouts/panel-layout/UserButton.tsx:37
+#: src/shared/layouts/panel-layout/UserButton.tsx:40
msgid "Workspace Users"
msgstr "Workspace-Benutzer"
diff --git a/src/locales/en-US/messages.po b/src/locales/en-US/messages.po
index 0f73b7e3..9c38cab2 100644
--- a/src/locales/en-US/messages.po
+++ b/src/locales/en-US/messages.po
@@ -402,7 +402,7 @@ msgstr "Affected resources"
msgid "Age"
msgstr "Age"
-#: src/shared/layouts/panel-settings-layout/settingsMenuList.tsx:52
+#: src/shared/layouts/panel-settings-layout/settingsMenuList.tsx:65
msgid "Alert settings"
msgstr "Alert settings"
@@ -488,7 +488,7 @@ msgstr "API Access"
msgid "API Key"
msgstr "API Key"
-#: src/shared/layouts/panel-settings-layout/settingsMenuList.tsx:37
+#: src/shared/layouts/panel-settings-layout/settingsMenuList.tsx:39
msgid "API tokens"
msgstr "API tokens"
@@ -616,8 +616,8 @@ msgid "Benchmarks"
msgstr "Benchmarks"
#: src/shared/layouts/panel-layout/useBreadcrumbs.ts:21
-#: src/shared/layouts/panel-layout/UserButton.tsx:47
-#: src/shared/layouts/panel-settings-layout/settingsMenuList.tsx:56
+#: src/shared/layouts/panel-layout/UserButton.tsx:53
+#: src/shared/layouts/panel-settings-layout/settingsMenuList.tsx:70
msgid "Billing"
msgstr "Billing"
@@ -834,7 +834,7 @@ msgid "Cloud accounts"
msgstr "Cloud accounts"
#: src/shared/layouts/panel-layout/useBreadcrumbs.ts:9
-#: src/shared/layouts/panel-layout/UserButton.tsx:42
+#: src/shared/layouts/panel-layout/UserButton.tsx:45
msgid "Cloud Accounts"
msgstr "Cloud Accounts"
@@ -939,11 +939,11 @@ msgstr "Connect PagerDuty"
msgid "Connect Teams"
msgstr "Connect Teams"
-#: src/shared/layouts/panel-settings-layout/settingsMenuList.tsx:33
+#: src/shared/layouts/panel-settings-layout/settingsMenuList.tsx:35
msgid "Connected accounts"
msgstr "Connected accounts"
-#: src/shared/layouts/panel-settings-layout/settingsMenuList.tsx:48
+#: src/shared/layouts/panel-settings-layout/settingsMenuList.tsx:60
msgid "Connected services"
msgstr "Connected services"
@@ -1050,7 +1050,7 @@ msgstr "Current"
msgid "Current Product Tier"
msgstr "Current Product Tier"
-#: src/shared/layouts/panel-settings-layout/settingsMenuList.tsx:63
+#: src/shared/layouts/panel-settings-layout/settingsMenuList.tsx:78
msgid "Current users"
msgstr "Current users"
@@ -1732,7 +1732,7 @@ msgstr "Log in with {formattedName}"
msgid "Log Out"
msgstr "Log Out"
-#: src/shared/layouts/panel-layout/UserButton.tsx:60
+#: src/shared/layouts/panel-layout/UserButton.tsx:67
msgid "Logout"
msgstr "Logout"
@@ -1978,7 +1978,7 @@ msgstr "Nothing"
msgid "Nothing to show yet"
msgstr "Nothing to show yet"
-#: src/shared/layouts/panel-settings-layout/settingsMenuList.tsx:29
+#: src/shared/layouts/panel-settings-layout/settingsMenuList.tsx:31
msgid "Notifications"
msgstr "Notifications"
@@ -2167,7 +2167,7 @@ msgstr "Payment method unrecognized: Ensure you are using a payment method that
msgid "Payment update failed: The provided payment method is unrecognized. Please verify your details and use a supported payment method."
msgstr "Payment update failed: The provided payment method is unrecognized. Please verify your details and use a supported payment method."
-#: src/shared/layouts/panel-settings-layout/settingsMenuList.tsx:67
+#: src/shared/layouts/panel-settings-layout/settingsMenuList.tsx:82
msgid "Pending invitations"
msgstr "Pending invitations"
@@ -2769,6 +2769,10 @@ msgstr "The workspace you requested cannot be accessed. Please request access fr
msgid "There's already another api tokens with the same description"
msgstr "There's already another api tokens with the same description"
+#: src/pages/panel/workspace-settings-connected-services/WorkspaceSettingsConnectedServicesPage.tsx:42
+msgid "There's no connected services"
+msgstr "There's no connected services"
+
#: src/pages/panel/accounts/AccountRow.tsx:489
msgid "This account is currently in a degraded state possibly due to a misconfiguration.<0/>Fix was unable to gather data from this account."
msgstr "This account is currently in a degraded state possibly due to a misconfiguration.<0/>Fix was unable to gather data from this account."
@@ -2936,7 +2940,7 @@ msgstr "Uploading your Google Cloud Service Account file..."
msgid "Use OTP instead"
msgstr "Use OTP instead"
-#: src/shared/layouts/panel-settings-layout/settingsMenuList.tsx:25
+#: src/shared/layouts/panel-settings-layout/settingsMenuList.tsx:27
msgid "User details"
msgstr "User details"
@@ -2948,11 +2952,11 @@ msgstr "User Impersonation permission"
msgid "User Invitations"
msgstr "User Invitations"
-#: src/shared/layouts/panel-settings-layout/settingsMenuList.tsx:18
+#: src/shared/layouts/panel-settings-layout/settingsMenuList.tsx:20
msgid "User settings"
msgstr "User settings"
-#: src/shared/layouts/panel-layout/UserButton.tsx:27
+#: src/shared/layouts/panel-layout/UserButton.tsx:28
msgid "User Settings"
msgstr "User Settings"
@@ -3066,7 +3070,7 @@ msgstr "Within a billing cycle you will be charged for the highest product tier
msgid "Workspace Alerting Settings"
msgstr "Workspace Alerting Settings"
-#: src/shared/layouts/panel-settings-layout/settingsMenuList.tsx:44
+#: src/shared/layouts/panel-settings-layout/settingsMenuList.tsx:56
msgid "Workspace details"
msgstr "Workspace details"
@@ -3079,21 +3083,21 @@ msgstr "Workspace Id"
msgid "Workspace Name"
msgstr "Workspace Name"
-#: src/shared/layouts/panel-settings-layout/settingsMenuList.tsx:19
+#: src/shared/layouts/panel-settings-layout/settingsMenuList.tsx:21
msgid "Workspace settings"
msgstr "Workspace settings"
#: src/shared/layouts/panel-layout/useBreadcrumbs.ts:7
-#: src/shared/layouts/panel-layout/UserButton.tsx:32
+#: src/shared/layouts/panel-layout/UserButton.tsx:35
msgid "Workspace Settings"
msgstr "Workspace Settings"
-#: src/shared/layouts/panel-settings-layout/settingsMenuList.tsx:20
+#: src/shared/layouts/panel-settings-layout/settingsMenuList.tsx:22
msgid "Workspace users"
msgstr "Workspace users"
#: src/pages/panel/workspace-users-settings/WorkspaceUsersSettingsPage.tsx:91
-#: src/shared/layouts/panel-layout/UserButton.tsx:37
+#: src/shared/layouts/panel-layout/UserButton.tsx:40
msgid "Workspace Users"
msgstr "Workspace Users"
diff --git a/src/pages/panel/workspace-settings-alert-settings/WorkspaceAlertingSettingsCheckbox.tsx b/src/pages/panel/workspace-settings-alert-settings/WorkspaceSettingsAlertSettingsCheckbox.tsx
similarity index 86%
rename from src/pages/panel/workspace-settings-alert-settings/WorkspaceAlertingSettingsCheckbox.tsx
rename to src/pages/panel/workspace-settings-alert-settings/WorkspaceSettingsAlertSettingsCheckbox.tsx
index 8ee8bbe9..4b2b2b36 100644
--- a/src/pages/panel/workspace-settings-alert-settings/WorkspaceAlertingSettingsCheckbox.tsx
+++ b/src/pages/panel/workspace-settings-alert-settings/WorkspaceSettingsAlertSettingsCheckbox.tsx
@@ -2,7 +2,7 @@ import { Box, CircularProgress, IconButton, Stack } from '@mui/material'
import { CheckIcon, CloseIcon } from 'src/assets/icons'
import { NotificationChannel } from 'src/shared/types/server-shared'
-interface WorkspaceAlertingSettingsCheckboxProps {
+interface WorkspaceSettingsAlertSettingsCheckboxProps {
benchmark: string
checked: boolean
isPending: boolean
@@ -11,14 +11,14 @@ interface WorkspaceAlertingSettingsCheckboxProps {
hasPermission: boolean
}
-export const WorkspaceAlertingSettingsCheckbox = ({
+export const WorkspaceSettingsAlertSettingsCheckbox = ({
benchmark,
checked,
isPending,
name,
onChange,
hasPermission,
-}: WorkspaceAlertingSettingsCheckboxProps) => {
+}: WorkspaceSettingsAlertSettingsCheckboxProps) => {
const checkedIcon = checked ? (
) : (
diff --git a/src/pages/panel/workspace-settings-alert-settings/WorkspaceSettingsAlertSettingsPage.tsx b/src/pages/panel/workspace-settings-alert-settings/WorkspaceSettingsAlertSettingsPage.tsx
index f5e7d7f3..a10f3dff 100644
--- a/src/pages/panel/workspace-settings-alert-settings/WorkspaceSettingsAlertSettingsPage.tsx
+++ b/src/pages/panel/workspace-settings-alert-settings/WorkspaceSettingsAlertSettingsPage.tsx
@@ -11,7 +11,7 @@ import { SeverityDropDown, SeverityItem } from 'src/shared/severity'
import { NotificationChannel, SeverityType } from 'src/shared/types/server-shared'
import { getWorkspaceAlertingSettingsQuery } from './getWorkspaceAlertingSettings.query'
import { putWorkspaceAlertingSettingsQuery } from './putWorkspaceAlertingSettings.query'
-import { WorkspaceAlertingSettingsCheckbox } from './WorkspaceAlertingSettingsCheckbox'
+import { WorkspaceSettingsAlertSettingsCheckbox } from './WorkspaceSettingsAlertSettingsCheckbox'
export default function WorkspaceSettingsAlertSettingsPage() {
const { selectedWorkspace, checkPermission } = useUserProfile()
@@ -179,7 +179,7 @@ export default function WorkspaceSettingsAlertSettingsPage() {
{notifications?.email ? (
- -1}
isPending={isPending}
@@ -191,7 +191,7 @@ export default function WorkspaceSettingsAlertSettingsPage() {
) : undefined}
{notifications?.slack ? (
- -1}
isPending={isPending}
@@ -203,7 +203,7 @@ export default function WorkspaceSettingsAlertSettingsPage() {
) : undefined}
{notifications?.teams ? (
- -1}
isPending={isPending}
@@ -215,7 +215,7 @@ export default function WorkspaceSettingsAlertSettingsPage() {
) : undefined}
{notifications?.discord ? (
- -1}
isPending={isPending}
@@ -227,7 +227,7 @@ export default function WorkspaceSettingsAlertSettingsPage() {
) : undefined}
{notifications?.pagerduty ? (
- -1}
isPending={isPending}
@@ -239,7 +239,7 @@ export default function WorkspaceSettingsAlertSettingsPage() {
) : undefined}
{notifications?.opsgenie ? (
- -1}
isPending={isPending}
diff --git a/src/pages/panel/workspace-settings-connected-services/WorkspaceSettingsConnectedServicesPage.tsx b/src/pages/panel/workspace-settings-connected-services/WorkspaceSettingsConnectedServicesPage.tsx
index 6861e1ce..f9702ca0 100644
--- a/src/pages/panel/workspace-settings-connected-services/WorkspaceSettingsConnectedServicesPage.tsx
+++ b/src/pages/panel/workspace-settings-connected-services/WorkspaceSettingsConnectedServicesPage.tsx
@@ -1,5 +1,5 @@
-import { t } from '@lingui/macro'
-import { Stack } from '@mui/material'
+import { t, Trans } from '@lingui/macro'
+import { Alert, Stack } from '@mui/material'
import { useQuery } from '@tanstack/react-query'
import { useEffect } from 'react'
import { useSearchParams } from 'react-router-dom'
@@ -36,7 +36,12 @@ export default function WorkspaceSettingsConnectedServicesPage() {
queryFn: getWorkspaceNotificationsQuery,
enabled: !!selectedWorkspace,
})
- return (
+ const noConnected = !data?.slack && !data?.discord && !data?.teams && !data?.pagerduty && !data?.email && !data?.opsgenie
+ return noConnected ? (
+
+ There's no connected services
+
+ ) : (
diff --git a/src/pages/panel/workspace-users-settings/WorkspaceSettingsUserActionRowItem.tsx b/src/pages/panel/workspace-users-settings/WorkspaceSettingsUserActionRowItem.tsx
index cc3b92c5..8ee32e46 100644
--- a/src/pages/panel/workspace-users-settings/WorkspaceSettingsUserActionRowItem.tsx
+++ b/src/pages/panel/workspace-users-settings/WorkspaceSettingsUserActionRowItem.tsx
@@ -13,9 +13,9 @@ interface WorkspaceSettingsUserActionRowItemProps {
export const WorkspaceSettingsUserActionRowItem = ({ workspaceUser }: WorkspaceSettingsUserActionRowItemProps) => {
const [anchorEl, setAnchorEl] = useState(null)
const { checkPermissions } = useUserProfile()
- const [hasInvitePermission, hasRemoveUserPermission] = checkPermissions('inviteTo', 'removeFrom')
+ const [hasUpdateRolePermission, hasRemoveUserPermission] = checkPermissions('updateRoles', 'removeFrom')
- return hasInvitePermission || hasRemoveUserPermission ? (
+ return hasUpdateRolePermission || hasRemoveUserPermission ? (
<>
setAnchorEl(e.currentTarget)}>
@@ -26,7 +26,9 @@ export const WorkspaceSettingsUserActionRowItem = ({ workspaceUser }: WorkspaceS
onClose={() => setAnchorEl(null)}
slotProps={{ paper: { sx: { bgcolor: 'common.white' } } }}
>
- {hasInvitePermission ? setAnchorEl(null)} /> : null}
+ {hasUpdateRolePermission ? (
+ setAnchorEl(null)} />
+ ) : null}
{hasRemoveUserPermission ? (
setAnchorEl(null)} />
) : null}
diff --git a/src/shared/layouts/panel-layout/UserButton.tsx b/src/shared/layouts/panel-layout/UserButton.tsx
index ebad23c8..f694ff6f 100644
--- a/src/shared/layouts/panel-layout/UserButton.tsx
+++ b/src/shared/layouts/panel-layout/UserButton.tsx
@@ -7,7 +7,8 @@ import { stringAvatar } from 'src/shared/utils/stringAvatar'
import { PanelHeaderMenu } from './PanelHeaderMenu'
export const UserButton = () => {
- const { currentUser, logout } = useUserProfile(true) ?? {}
+ const { currentUser, logout, checkPermissions } = useUserProfile(true) ?? {}
+ const [hasReadSettingsPermission, hasReadBillingPermission] = checkPermissions?.('readSettings', 'readBilling') ?? [false, false]
const userEmail = currentUser?.email ?? 'N/A'
const avatarProps = stringAvatar(userEmail)
return (
@@ -27,26 +28,32 @@ export const UserButton = () => {
User Settings
- } to={'/settings/workspace'}>
-
- Workspace Settings
-
-
- } to={'/settings/workspace-users'}>
-
- Workspace Users
-
-
- } to={'/accounts'}>
-
- Cloud Accounts
-
-
- } to={'/settings/workspace/billing-receipts'}>
-
- Billing
-
-
+ {hasReadSettingsPermission ? (
+ <>
+ } to={'/settings/workspace'}>
+
+ Workspace Settings
+
+
+ } to={'/settings/workspace-users'}>
+
+ Workspace Users
+
+
+ } to={'/accounts'}>
+
+ Cloud Accounts
+
+
+ >
+ ) : null}
+ {hasReadBillingPermission ? (
+ } to={'/settings/workspace/billing-receipts'}>
+
+ Billing
+
+
+ ) : null}
{/* } to={'/developer'}>
Developer
diff --git a/src/shared/layouts/panel-settings-layout/PanelSettingsContent.tsx b/src/shared/layouts/panel-settings-layout/PanelSettingsContent.tsx
index 6982476a..bcadcb8f 100644
--- a/src/shared/layouts/panel-settings-layout/PanelSettingsContent.tsx
+++ b/src/shared/layouts/panel-settings-layout/PanelSettingsContent.tsx
@@ -19,8 +19,9 @@ interface PanelSettingsMenuListItemProps extends MenuListItem {
isCurrent: boolean
}
-const PanelSettingsMenuListItem = ({ isCurrent, name, route }: PanelSettingsMenuListItemProps) => {
- return (
+const PanelSettingsMenuListItem = ({ isCurrent, name, route, useGuard }: PanelSettingsMenuListItemProps) => {
+ const hasPermissionToShow = useGuard?.() ?? true
+ return hasPermissionToShow ? (
{isCurrent ? : }
- )
+ ) : null
}
export const PanelSettingsContent = ({ children }: PropsWithChildren) => {
diff --git a/src/shared/layouts/panel-settings-layout/settingsMenuList.tsx b/src/shared/layouts/panel-settings-layout/settingsMenuList.tsx
index e3ec0dd5..d51f6d58 100644
--- a/src/shared/layouts/panel-settings-layout/settingsMenuList.tsx
+++ b/src/shared/layouts/panel-settings-layout/settingsMenuList.tsx
@@ -1,8 +1,10 @@
import { Trans } from '@lingui/macro'
import { ReactNode } from 'react'
+import { useHasAccountsCheck, usePermissionCheck } from 'src/shared/layouts/panel-layout'
export interface MenuListItem {
name: ReactNode
+ useGuard?: () => boolean
route: string
}
@@ -39,6 +41,16 @@ export const userSettingsMenuList: MenuListItem[] = [
},
]
+const useGuardForAlertSettings = () => {
+ const { doesNotHaveAccount, haveError, paymentOnHold } = useHasAccountsCheck()
+ return !doesNotHaveAccount && !haveError && !paymentOnHold
+}
+
+const useGuardForBilling = () => {
+ const hasPermission = usePermissionCheck('readBilling')
+ return hasPermission
+}
+
export const workspaceSettingsMenuList: MenuListItem[] = [
{
name: Workspace details,
@@ -46,14 +58,17 @@ export const workspaceSettingsMenuList: MenuListItem[] = [
},
{
name: Connected services,
+ useGuard: useGuardForAlertSettings,
route: `${routes.workspaceSettingsRoute}/connected-services`,
},
{
name: Alert settings,
+ useGuard: useGuardForAlertSettings,
route: `${routes.workspaceSettingsRoute}/alert-settings`,
},
{
name: Billing,
+ useGuard: useGuardForBilling,
route: `${routes.workspaceSettingsRoute}/billing-receipts`,
},
]