This commit is contained in:
TaiAurori
2021-08-30 18:24:35 -04:00
32 changed files with 544 additions and 205 deletions

View File

@@ -6,6 +6,7 @@ import { decodeTime } from "ulid";
import { Text } from "preact-i18n";
import { useDictionary } from "../../../lib/i18n";
import { isTouchscreenDevice } from "../../../lib/isTouchscreenDevice";
import { dayjs } from "../../../context/Locale";
@@ -34,9 +35,11 @@ export default styled.div<BaseMessageProps>`
flex-direction: row;
padding-inline-end: 16px;
@media (pointer: coarse) {
user-select: none;
}
${() =>
isTouchscreenDevice &&
css`
user-select: none;
`}
${(props) =>
props.contrast &&

View File

@@ -3,7 +3,7 @@ import Axios, { CancelTokenSource } from "axios";
import { observer } from "mobx-react-lite";
import { ChannelPermission } from "revolt.js/dist/api/permissions";
import { Channel } from "revolt.js/dist/maps/Channels";
import styled from "styled-components";
import styled, { css } from "styled-components";
import { ulid } from "ulid";
import { Text } from "preact-i18n";
@@ -99,11 +99,13 @@ const Action = styled.div`
padding: 12px;
}
.mobile {
@media (pointer: fine) {
display: none;
}
}
${() =>
!isTouchscreenDevice &&
css`
.mobile {
display: none;
}
`}
`;
// For sed replacement
@@ -316,7 +318,8 @@ export default observer(({ channel }: Props) => {
);
}
} catch (err) {
if (err?.message === "cancel") {
// eslint-disable-next-line
if ((err as any)?.message === "cancel") {
setUploadState({
type: "attached",
files,
@@ -502,6 +505,11 @@ export default observer(({ channel }: Props) => {
value={draft ?? ""}
padding="var(--message-box-padding)"
onKeyDown={(e) => {
if (e.ctrlKey && e.key === "Enter") {
e.preventDefault();
return send();
}
if (onKeyDown(e)) return;
if (

View File

@@ -1,10 +1,11 @@
import { DownArrowAlt } from "@styled-icons/boxicons-regular";
import { observer } from "mobx-react-lite";
import { Channel } from "revolt.js/dist/maps/Channels";
import styled from "styled-components";
import styled, { css } from "styled-components";
import { Text } from "preact-i18n";
import { isTouchscreenDevice } from "../../../../lib/isTouchscreenDevice";
import { getRenderer } from "../../../../lib/renderer/Singleton";
const Bar = styled.div`
@@ -42,11 +43,13 @@ const Bar = styled.div`
transform: translateY(1px);
}
@media (pointer: coarse) {
height: 34px;
top: -32px;
padding: 0 12px;
}
${() =>
isTouchscreenDevice &&
css`
height: 34px;
top: -32px;
padding: 0 12px;
`}
}
`;

View File

@@ -24,6 +24,7 @@ import { generateEmoji } from "../common/Emoji";
import { emojiDictionary } from "../../assets/emojis";
import { MarkdownProps } from "./Markdown";
import {useIntermediate} from "../../context/intermediate/Intermediate";
// TODO: global.d.ts file for defining globals
declare global {
@@ -97,6 +98,8 @@ const RE_CHANNELS = /<#([A-z0-9]{26})>/g;
export default function Renderer({ content, disallowBigEmoji }: MarkdownProps) {
const client = useContext(AppContext);
const { openScreen } = useIntermediate();
if (typeof content === "undefined") return null;
if (content.length === 0) return null;
@@ -198,6 +201,13 @@ export default function Renderer({ content, disallowBigEmoji }: MarkdownProps) {
if (!internal) {
element.setAttribute("target", "_blank");
element.onclick = (ev) => {
ev.preventDefault();
openScreen({
id: "external_link_prompt",
link: href
})
}
}
},
);

View File

@@ -240,15 +240,18 @@ export const ServerListSidebar = observer(({ unreads, lastOpened }: Props) => {
let homeUnread: "mention" | "unread" | undefined;
let alertCount = 0;
for (const x of channels) {
if (
(x.channel?.channel_type === "DirectMessage"
? x.channel?.active
: x.channel?.channel_type === "Group") &&
x.unread
) {
if (x.channel?.channel_type === "Group" && x.unread) {
homeUnread = "unread";
alertCount += x.alertCount ?? 0;
}
if (
x.channel?.channel_type === "DirectMessage" &&
x.channel.active &&
x.unread
) {
alertCount++;
}
}
alertCount += [...client.users.values()].filter(

View File

@@ -37,9 +37,11 @@ export default styled.div<Props>`
padding: 0 12px;
}*/
@media (pointer: coarse) {
height: 56px;
}
${() =>
isTouchscreenDevice &&
css`
height: 56px;
`}
${(props) =>
props.background &&