mirror of
https://github.com/revoltchat/revite.git
synced 2024-11-27 01:20:57 -05:00
Compare commits
4 commits
35ca83c38f
...
fb7aa08b70
Author | SHA1 | Date | |
---|---|---|---|
|
fb7aa08b70 | ||
|
478d375125 | ||
|
cd4d8eb96d | ||
|
ffee147aed |
12 changed files with 58 additions and 54 deletions
|
@ -185,7 +185,8 @@ const Container = styled.div<{ largeEmoji: boolean }>`
|
||||||
/**
|
/**
|
||||||
* Regex for matching execessive recursion of blockquotes and lists
|
* Regex for matching execessive recursion of blockquotes and lists
|
||||||
*/
|
*/
|
||||||
const RE_RECURSIVE = /(^(?:[>*+-][^\S\r\n]*){5})(?:[>*+-][^\S\r\n]*)+(.*$)/gm;
|
const RE_RECURSIVE =
|
||||||
|
/(^(?:(?:[>*+-]|\d+\.)[^\S\r\n]*){5})(?:(?:[>*+-]|\d+\.)[^\S\r\n]*)+(.*$)/gm;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Regex for matching multi-line blockquotes
|
* Regex for matching multi-line blockquotes
|
||||||
|
@ -247,9 +248,13 @@ export default memo(({ content, disallowBigEmoji }: MarkdownProps) => {
|
||||||
const [Content, setContent] = useState<React.ReactElement>(null!);
|
const [Content, setContent] = useState<React.ReactElement>(null!);
|
||||||
|
|
||||||
useLayoutEffect(() => {
|
useLayoutEffect(() => {
|
||||||
|
try {
|
||||||
render
|
render
|
||||||
.process(sanitisedContent)
|
.process(sanitisedContent)
|
||||||
.then((file) => setContent(file.result));
|
.then((file) => setContent(file.result));
|
||||||
|
} catch (err) {
|
||||||
|
setContent("Message failed to render." as never);
|
||||||
|
}
|
||||||
}, [sanitisedContent]);
|
}, [sanitisedContent]);
|
||||||
|
|
||||||
const largeEmoji = useMemo(
|
const largeEmoji = useMemo(
|
||||||
|
|
|
@ -106,9 +106,9 @@ export default observer(() => {
|
||||||
"scrollbar-thumb",
|
"scrollbar-thumb",
|
||||||
"scrollbar-track",
|
"scrollbar-track",
|
||||||
"status-online",
|
"status-online",
|
||||||
"status-away",
|
"status-idle",
|
||||||
|
"status-focus",
|
||||||
"status-busy",
|
"status-busy",
|
||||||
"status-streaming",
|
|
||||||
"status-invisible",
|
"status-invisible",
|
||||||
"success",
|
"success",
|
||||||
"warning",
|
"warning",
|
||||||
|
|
|
@ -73,7 +73,6 @@ export function PermissionSelect({
|
||||||
}
|
}
|
||||||
|
|
||||||
return "Neutral";
|
return "Neutral";
|
||||||
|
|
||||||
}, [value]);
|
}, [value]);
|
||||||
|
|
||||||
function onSwitch(state: State) {
|
function onSwitch(state: State) {
|
||||||
|
|
|
@ -30,10 +30,9 @@ export type Variables =
|
||||||
| "tertiary-foreground"
|
| "tertiary-foreground"
|
||||||
| "tooltip"
|
| "tooltip"
|
||||||
| "status-online"
|
| "status-online"
|
||||||
| "status-away"
|
| "status-idle"
|
||||||
| "status-focus"
|
| "status-focus"
|
||||||
| "status-busy"
|
| "status-busy"
|
||||||
| "status-streaming"
|
|
||||||
| "status-invisible";
|
| "status-invisible";
|
||||||
|
|
||||||
// While this isn't used, it'd be good to keep this up to date as a reference or for future use
|
// While this isn't used, it'd be good to keep this up to date as a reference or for future use
|
||||||
|
@ -283,10 +282,9 @@ export const PRESETS: Record<string, Theme> = {
|
||||||
"tertiary-background": "#4D4D4D",
|
"tertiary-background": "#4D4D4D",
|
||||||
"tertiary-foreground": "#3a3a3a",
|
"tertiary-foreground": "#3a3a3a",
|
||||||
"status-online": "#3ABF7E",
|
"status-online": "#3ABF7E",
|
||||||
"status-away": "#F39F00",
|
"status-idle": "#F39F00",
|
||||||
"status-focus": "#4799F0",
|
"status-focus": "#4799F0",
|
||||||
"status-busy": "#F84848",
|
"status-busy": "#F84848",
|
||||||
"status-streaming": "#977EFF",
|
|
||||||
"status-invisible": "#A5A5A5",
|
"status-invisible": "#A5A5A5",
|
||||||
},
|
},
|
||||||
dark: {
|
dark: {
|
||||||
|
@ -311,10 +309,9 @@ export const PRESETS: Record<string, Theme> = {
|
||||||
"tertiary-background": "#4D4D4D",
|
"tertiary-background": "#4D4D4D",
|
||||||
"tertiary-foreground": "#848484",
|
"tertiary-foreground": "#848484",
|
||||||
"status-online": "#3ABF7E",
|
"status-online": "#3ABF7E",
|
||||||
"status-away": "#F39F00",
|
"status-idle": "#F39F00",
|
||||||
"status-focus": "#4799F0",
|
"status-focus": "#4799F0",
|
||||||
"status-busy": "#F84848",
|
"status-busy": "#F84848",
|
||||||
"status-streaming": "#977EFF",
|
|
||||||
"status-invisible": "#A5A5A5",
|
"status-invisible": "#A5A5A5",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -10,7 +10,7 @@ export function takeError(error: any): string {
|
||||||
case 429:
|
case 429:
|
||||||
return "TooManyRequests";
|
return "TooManyRequests";
|
||||||
case 401:
|
case 401:
|
||||||
return "Unauthorized"
|
return "Unauthorized";
|
||||||
case 403:
|
case 403:
|
||||||
return "Forbidden";
|
return "Forbidden";
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -7,10 +7,10 @@ import { ModalForm } from "@revoltchat/ui";
|
||||||
|
|
||||||
import { noopAsync } from "../../../lib/js";
|
import { noopAsync } from "../../../lib/js";
|
||||||
|
|
||||||
|
import { IS_REVOLT } from "../../../version";
|
||||||
import { takeError } from "../../client/jsx/error";
|
import { takeError } from "../../client/jsx/error";
|
||||||
import { modalController } from "../ModalController";
|
import { modalController } from "../ModalController";
|
||||||
import { ModalProps } from "../types";
|
import { ModalProps } from "../types";
|
||||||
import { IS_REVOLT } from "../../../version";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Code block which displays invite
|
* Code block which displays invite
|
||||||
|
@ -79,7 +79,9 @@ export default function CreateInvite({
|
||||||
children: <Text id="app.context_menu.copy_link" />,
|
children: <Text id="app.context_menu.copy_link" />,
|
||||||
onClick: () =>
|
onClick: () =>
|
||||||
modalController.writeText(
|
modalController.writeText(
|
||||||
IS_REVOLT ? `https://rvlt.gg/${code}` : `${window.location.host}/invite/${code}`
|
IS_REVOLT
|
||||||
|
? `https://rvlt.gg/${code}`
|
||||||
|
: `${window.location.host}/invite/${code}`,
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
|
|
|
@ -2,29 +2,32 @@ import { ChevronRight, Trash } from "@styled-icons/boxicons-regular";
|
||||||
import { Cog, UserVoice } from "@styled-icons/boxicons-solid";
|
import { Cog, UserVoice } from "@styled-icons/boxicons-solid";
|
||||||
import { isFirefox } from "react-device-detect";
|
import { isFirefox } from "react-device-detect";
|
||||||
import { useHistory } from "react-router-dom";
|
import { useHistory } from "react-router-dom";
|
||||||
import { Channel, Message, Server, User, API, Permission, UserPermission, Member } from "revolt.js";
|
import {
|
||||||
|
Channel,
|
||||||
|
Message,
|
||||||
|
Server,
|
||||||
|
User,
|
||||||
|
API,
|
||||||
|
Permission,
|
||||||
|
UserPermission,
|
||||||
|
Member,
|
||||||
|
} from "revolt.js";
|
||||||
|
|
||||||
|
import {
|
||||||
|
ContextMenuWithData,
|
||||||
import { ContextMenuWithData, MenuItem, openContextMenu } from "preact-context-menu";
|
MenuItem,
|
||||||
|
openContextMenu,
|
||||||
|
} from "preact-context-menu";
|
||||||
import { Text } from "preact-i18n";
|
import { Text } from "preact-i18n";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import { Column, IconButton, LineDivider } from "@revoltchat/ui";
|
import { Column, IconButton, LineDivider } from "@revoltchat/ui";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import { useApplicationState } from "../mobx/State";
|
import { useApplicationState } from "../mobx/State";
|
||||||
import { QueuedMessage } from "../mobx/stores/MessageQueue";
|
import { QueuedMessage } from "../mobx/stores/MessageQueue";
|
||||||
import { NotificationState } from "../mobx/stores/NotificationOptions";
|
import { NotificationState } from "../mobx/stores/NotificationOptions";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import CMNotifications from "./contextmenu/CMNotifications";
|
import CMNotifications from "./contextmenu/CMNotifications";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import Tooltip from "../components/common/Tooltip";
|
import Tooltip from "../components/common/Tooltip";
|
||||||
import UserStatus from "../components/common/user/UserStatus";
|
import UserStatus from "../components/common/user/UserStatus";
|
||||||
import { useSession } from "../controllers/client/ClientController";
|
import { useSession } from "../controllers/client/ClientController";
|
||||||
|
@ -33,7 +36,6 @@ import { modalController } from "../controllers/modals/ModalController";
|
||||||
import { internalEmit } from "./eventEmitter";
|
import { internalEmit } from "./eventEmitter";
|
||||||
import { getRenderer } from "./renderer/Singleton";
|
import { getRenderer } from "./renderer/Singleton";
|
||||||
|
|
||||||
|
|
||||||
interface ContextMenuData {
|
interface ContextMenuData {
|
||||||
user?: string;
|
user?: string;
|
||||||
server?: string;
|
server?: string;
|
||||||
|
|
|
@ -86,7 +86,6 @@ export default class SAudio {
|
||||||
const el = new Audio(path);
|
const el = new Audio(path);
|
||||||
this.cache.set(path, el);
|
this.cache.set(path, el);
|
||||||
return el;
|
return el;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
loadCache() {
|
loadCache() {
|
||||||
|
@ -100,7 +99,7 @@ export default class SAudio {
|
||||||
try {
|
try {
|
||||||
audio.play();
|
audio.play();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error("Hit error while playing", `${sound }:`, err);
|
console.error("Hit error while playing", `${sound}:`, err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,7 +110,7 @@ export default class STheme {
|
||||||
for (const key of Object.keys(variables)) {
|
for (const key of Object.keys(variables)) {
|
||||||
const value = variables[key];
|
const value = variables[key];
|
||||||
if (typeof value === "string") {
|
if (typeof value === "string") {
|
||||||
variables[`${key }-contrast`] = getContrastingColour(value);
|
variables[`${key}-contrast`] = getContrastingColour(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -89,7 +89,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
&.idle {
|
&.idle {
|
||||||
background: var(--status-away);
|
background: var(--status-idle);
|
||||||
}
|
}
|
||||||
|
|
||||||
&.focus {
|
&.focus {
|
||||||
|
|
|
@ -29,7 +29,7 @@ precacheAndRoute(
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const key of locale_keys) {
|
for (const key of locale_keys) {
|
||||||
if (fn.startsWith(`${key }.`)) {
|
if (fn.startsWith(`${key}.`)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue