mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-15 01:52:42 +03:00
Merge branch 'la-chat-sidebar' (#1885)
* la-chat-sidebar: chat-ui: fix image previews from url types chat-js: make clicking a url message open in a new tab chat-js: fix chat sorting and selection in sidebar Signed-off-by: Jared Tobin <jared@tlon.io>
This commit is contained in:
commit
7add660077
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -29,9 +29,27 @@ export class Message extends Component {
|
||||
</span>
|
||||
);
|
||||
} else if ('url' in letter) {
|
||||
let imgMatch =
|
||||
/(jpg|img|png|gif|tiff|jpeg|JPG|IMG|PNG|TIFF|GIF|webp|WEBP|webm|WEBM)$/
|
||||
.exec(letter.url);
|
||||
let contents = letter.url;
|
||||
if (imgMatch) {
|
||||
contents = (
|
||||
<img
|
||||
src={letter.url}
|
||||
style={{
|
||||
width: "50%",
|
||||
maxWidth: "250px"
|
||||
}}
|
||||
></img>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<a className="body-regular-400 v-top" href={letter.url}>
|
||||
{letter.url}
|
||||
<a className="body-regular-400 v-top"
|
||||
href={letter.url}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer">
|
||||
{contents}
|
||||
</a>
|
||||
);
|
||||
} else if ('me' in letter) {
|
||||
|
@ -21,7 +21,7 @@ export class Sidebar extends Component {
|
||||
|
||||
render() {
|
||||
const { props, state } = this;
|
||||
let station = props.match.params.ship + props.match.params.station;
|
||||
let station = `/${props.match.params.ship}/${props.match.params.station}`;
|
||||
|
||||
let sidebarItems = Object.keys(props.inbox)
|
||||
.map((box) => {
|
||||
@ -42,7 +42,7 @@ export class Sidebar extends Component {
|
||||
};
|
||||
})
|
||||
.sort((a, b) => {
|
||||
return b.wen - a.wen;
|
||||
return b.when - a.when;
|
||||
})
|
||||
.map((obj) => {
|
||||
let unread = props.unreads[obj.box];
|
||||
|
Loading…
Reference in New Issue
Block a user