Skip to content

Conversation

@borgesis95
Copy link
Contributor

No description provided.

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
47.5% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@borgesis95 borgesis95 force-pushed the PIN-7318_configuration_notifications_page branch from 6df6c0c to aba7bec Compare August 26, 2025 14:04
@borgesis95 borgesis95 force-pushed the PIN-7318_configuration_notifications_page branch from 66554f9 to 126fc62 Compare September 3, 2025 14:19
@borgesis95 borgesis95 force-pushed the PIN-7318_configuration_notifications_page branch from 24bf3d0 to 07a6b9a Compare September 18, 2025 13:11
@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
79.7% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@borgesis95 borgesis95 marked this pull request as ready for review October 20, 2025 12:46
Copy link
Collaborator

@sandrotaje sandrotaje left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good to me, If I'm not wrong this PR is missing the link to the configuration page but I think it will be included in another PR.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Dec 2, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
79.7% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

| UserNotificationConfig['emailNotificationPreference']
| UserNotificationConfig['inAppNotificationPreference']
) => {
const unnecessaryKeys = ['preferenceChoice']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any way to type this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

!! Too many as for my taste, can you try to remove it and make the typing work without them?

Comment on lines +98 to +107
const isEnabledShowPreferencesSwitch = (): boolean => {
return match(type)
.with('email', () => {
return preferenceChoice === 'ENABLED'
})
.with('inApp', () => {
return !!preferenceChoice
})
.exhaustive()
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MINOR: any reason why this is a function and not directly a computer property?

return () => {
subscription.unsubscribe()
}
}, [formMethods, formMethods.watch, formMethods.formState.isDirty, debouncedUpdate])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The formMethods.formState.isDirty dependency in this useEffect makes me a bit worried.
What's the reason it is there? It's important for a specific behaviour?
Can you remove it? If it is important I would at least document it in a comment

type: NotificationConfigType
}

export const NotificationConfigUserTab: React.FC<NotificationConfigUserTabProps> = ({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This component does TOO much.
I suggest at least to move all this form logic in a useNotificationConfigForm

const SectionIcon = notificationSchema[sectionName].icon

return (
<Box key={sectionName} data-testid={`config-section-${sectionName}`} sx={{ mb: 3 }}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you move out this component?

Comment on lines +236 to +243
const notificationSchema: NotificationConfigSchema = match(type)
.with('inApp', () => {
return notificationConfigSchema
})
.with('email', () => {
return notificationConfigSchema
})
.exhaustive()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this for a future implementation when the inApp and email have their own scema?

import { ConsumerIcon, ProviderIcon, MyTenantIcon } from '@/icons'
import CodeIcon from '@mui/icons-material/Code'

export function useNotificationConfigHook(type: NotificationConfigType) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Hook suffix communicates nothing, can you find a better one? What about useGetNotificationConfigSchema?

const { isAdmin } = AuthHooks.useJwt()

const { data: user } = TenantHooks.useGetActiveUserParty()
const { data: tenantEmailNotifictionConfigs } = useQuery({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo

Suggested change
const { data: tenantEmailNotifictionConfigs } = useQuery({
const { data: tenantEmailNotificationConfigs } = useQuery({

Comment on lines +21 to +23
const { data: tenantEmailNotifictionConfigs } = useQuery({
...NotificationQueries.getTenantNotificationConfigs(),
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to spread when you have nothing to add, it's a waste of performance

Suggested change
const { data: tenantEmailNotifictionConfigs } = useQuery({
...NotificationQueries.getTenantNotificationConfigs(),
})
const { data: tenantEmailNotifictionConfigs } = useQuery(NotificationQueries.getTenantNotificationConfigs())

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants