Merge pull request #516 from Tert0/feature/priority-color

Added Different notification color for priority
This commit is contained in:
Jannis Mattheis 2022-10-21 18:50:29 +00:00 committed by GitHub
commit a8049f5138
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 2 deletions

View File

@ -73,11 +73,22 @@ interface IProps {
image?: string;
date: string;
content: string;
priority: number;
fDelete: VoidFunction;
extras?: IMessageExtras;
height: (height: number) => void;
}
const priorityColor = (priority: number) => {
if (priority >= 4 && priority <= 7) {
return 'rgba(230, 126, 34, 0.7)';
} else if (priority > 7) {
return '#e74c3c';
} else {
return 'transparent';
}
};
class Message extends React.PureComponent<IProps & WithStyles<typeof styles>> {
private node: HTMLDivElement | null = null;
@ -96,11 +107,17 @@ class Message extends React.PureComponent<IProps & WithStyles<typeof styles>> {
};
public render(): React.ReactNode {
const {fDelete, classes, title, date, image} = this.props;
const {fDelete, classes, title, date, image, priority} = this.props;
return (
<div className={`${classes.wrapperPadding} message`} ref={(ref) => (this.node = ref)}>
<Container style={{display: 'flex'}}>
<Container
style={{
display: 'flex',
borderLeftColor: priorityColor(priority),
borderLeftWidth: 6,
borderLeftStyle: 'solid',
}}>
<div className={classes.imageWrapper}>
{image !== null ? (
<img

View File

@ -149,6 +149,7 @@ class Messages extends Component<IProps & Stores<'messagesStore' | 'appStore'>,
content={message.message}
image={message.image}
extras={message.extras}
priority={message.priority}
/>
);