import { Trans } from "@lingui/react/macro" import { Checkbox, type CheckboxProps } from "@mantine/core" import type { ReactNode } from "react" import { useAppSelector } from "@/app/store" export const ReceivePushNotificationsChechbox = (props: CheckboxProps) => { const pushNotificationsEnabled = useAppSelector(state => state.server.serverInfos?.pushNotificationsEnabled) const pushNotificationsConfigured = useAppSelector(state => !!state.user.settings?.pushNotificationSettings.type) const disabled = !pushNotificationsEnabled || !pushNotificationsConfigured let description: ReactNode = "" if (!pushNotificationsEnabled) { description = Push notifications are not enabled on this CommaFeed instance. } else if (!pushNotificationsConfigured) { description = Push notifications are not configured in your user settings. } return Receive push notifications} disabled={disabled} description={description} {...props} /> }