Skip to content

Commit

Permalink
feat(channels): display an icon next to channels with disabled notifi…
Browse files Browse the repository at this point in the history
…cations
  • Loading branch information
AXeL-dev committed May 20, 2022
1 parent 23b8c32 commit 0d0bcc8
Showing 1 changed file with 26 additions and 10 deletions.
36 changes: 26 additions & 10 deletions src/ui/components/pages/Channels/ChannelCard/ChannelTitle.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import { Link } from '@mui/material';
import { Box, Link, Tooltip } from '@mui/material';
import { Channel } from 'types';
import NotificationsOffIcon from '@mui/icons-material/NotificationsOff';

interface ChannelTitleProps {
channel: Channel;
Expand All @@ -10,17 +11,30 @@ function ChannelTitle(props: ChannelTitleProps) {
const { channel } = props;

return (
<Link
<Box
sx={{
color: 'text.primary',
textDecoration: 'none',
display: 'flex',
alignItems: 'center',
gap: 2,
}}
href={channel.url}
target="_blank"
rel="noopener"
>
{channel.title}
</Link>
<Link
sx={{
color: 'text.primary',
textDecoration: 'none',
}}
href={channel.url}
target="_blank"
rel="noopener"
>
{channel.title}
</Link>
{channel.notifications?.isDisabled && (
<Tooltip title="Notifications disabled">
<NotificationsOffIcon color="disabled" fontSize="small" />
</Tooltip>
)}
</Box>
);
}

Expand All @@ -30,7 +44,9 @@ function propsAreEqual(
) {
return (
prevProps.channel.title === nextProps.channel.title &&
prevProps.channel.url === nextProps.channel.url
prevProps.channel.url === nextProps.channel.url &&
prevProps.channel.notifications?.isDisabled ===
nextProps.channel.notifications?.isDisabled
);
}

Expand Down

0 comments on commit 0d0bcc8

Please sign in to comment.