Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | 1x 1x 1x 1x 4x 1x 2x 2x 2x 4x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 3x | import { styled } from "@mui/material";
import Alert from "components/Alert";
import { useTranslation } from "i18n";
import { NOTIFICATIONS } from "i18n/namespaces";
const StyledAlert = styled(Alert)(({ theme }) => ({
marginBottom: theme.spacing(3),
marginTop: theme.spacing(2),
}));
const PushNotificationDenied = () => {
const { t } = useTranslation(NOTIFICATIONS);
const userAgent = navigator.userAgent.toLowerCase();
// @TODO - Add mobile browser and OS instructions per platform
const isMobile = () => {
return /android|iphone|ipad/i.test(userAgent);
};
const getBrowserInstructions = () => {
Iif (isMobile()) {
return t(
"notification_settings.push_notifications.permission_denied.instructions.mobile.browser",
);
}
Iif (userAgent.includes("chrome")) {
return t(
"notification_settings.push_notifications.permission_denied.instructions.chrome",
);
} else Iif (userAgent.includes("firefox")) {
return t(
"notification_settings.push_notifications.permission_denied.instructions.firefox",
);
} else Iif (userAgent.includes("safari")) {
return t(
"notification_settings.push_notifications.permission_denied.instructions.safari",
);
}
return t(
"notification_settings.push_notifications.permission_denied.instructions.generic",
);
};
const getOSInstructions = () => {
Iif (isMobile()) {
return t(
"notification_settings.push_notifications.permission_denied.instructions.mobile.os",
);
}
Iif (userAgent.includes("mac")) {
return t(
"notification_settings.push_notifications.permission_denied.instructions.macos",
);
} else Iif (userAgent.includes("windows")) {
return t(
"notification_settings.push_notifications.permission_denied.instructions.windows",
);
} else if (userAgent.includes("linux")) {
return t(
"notification_settings.push_notifications.permission_denied.instructions.linux.gnome",
);
}
return t(
"notification_settings.push_notifications.permission_denied.instructions.generic",
);
};
return (
<>
<StyledAlert severity="error">{getBrowserInstructions()}</StyledAlert>
<StyledAlert severity="error">
{t(
"notification_settings.push_notifications.permission_denied.platform_settings_description",
) +
" " +
getOSInstructions()}
</StyledAlert>
</>
);
};
export default PushNotificationDenied;
|