Skip to content

Commit

Permalink
Add priority colors
Browse files Browse the repository at this point in the history
  • Loading branch information
Tert0 authored and jmattheis committed Oct 21, 2022
1 parent fb7d910 commit 2fce3bd
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
21 changes: 19 additions & 2 deletions ui/src/message/Message.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions ui/src/message/Messages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ class Messages extends Component<IProps & Stores<'messagesStore' | 'appStore'>,
content={message.message}
image={message.image}
extras={message.extras}
priority={message.priority}
/>
);

Expand Down

0 comments on commit 2fce3bd

Please sign in to comment.