forked from abner/for-legacy-web
Format and automatically fix linted code.
This commit is contained in:
@@ -147,13 +147,19 @@ export default function Settings() {
|
||||
switchPage={switchPage}
|
||||
category="pages"
|
||||
custom={[
|
||||
<a href="https://gitlab.insrt.uk/revolt" target="_blank">
|
||||
<a
|
||||
href="https://gitlab.insrt.uk/revolt"
|
||||
target="_blank"
|
||||
rel="noreferrer">
|
||||
<ButtonItem compact>
|
||||
<Gitlab size={20} />
|
||||
<Text id="app.settings.pages.source_code" />
|
||||
</ButtonItem>
|
||||
</a>,
|
||||
<a href="https://ko-fi.com/insertish" target="_blank">
|
||||
<a
|
||||
href="https://ko-fi.com/insertish"
|
||||
target="_blank"
|
||||
rel="noreferrer">
|
||||
<ButtonItem className={styles.donate} compact>
|
||||
<Coffee size={20} />
|
||||
<Text id="app.settings.pages.donate.title" />
|
||||
@@ -172,7 +178,8 @@ export default function Settings() {
|
||||
<span className={styles.revision}>
|
||||
<a
|
||||
href={`${REPO_URL}/${GIT_REVISION}`}
|
||||
target="_blank">
|
||||
target="_blank"
|
||||
rel="noreferrer">
|
||||
{GIT_REVISION.substr(0, 7)}
|
||||
</a>
|
||||
{` `}
|
||||
@@ -182,7 +189,8 @@ export default function Settings() {
|
||||
? `https://gitlab.insrt.uk/revolt/client/-/tree/${GIT_BRANCH}`
|
||||
: undefined
|
||||
}
|
||||
target="_blank">
|
||||
target="_blank"
|
||||
rel="noreferrer">
|
||||
({GIT_BRANCH})
|
||||
</a>
|
||||
</span>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Channels } from "revolt.js/dist/api/objects";
|
||||
import styled, { css } from "styled-components";
|
||||
|
||||
import { Text } from "preact-i18n";
|
||||
import { useContext, useEffect, useState } from "preact/hooks";
|
||||
@@ -7,7 +8,7 @@ import TextAreaAutoSize from "../../../lib/TextAreaAutoSize";
|
||||
|
||||
import { FileUploader } from "../../../context/revoltjs/FileUploads";
|
||||
import { AppContext } from "../../../context/revoltjs/RevoltClient";
|
||||
import styled, { css } from "styled-components";
|
||||
|
||||
import Button from "../../../components/ui/Button";
|
||||
import InputBox from "../../../components/ui/InputBox";
|
||||
|
||||
@@ -45,7 +46,7 @@ export default function Overview({ channel }: Props) {
|
||||
|
||||
const [changed, setChanged] = useState(false);
|
||||
function save() {
|
||||
let changes: any = {};
|
||||
const changes: any = {};
|
||||
if (name !== channel.name) changes.name = name;
|
||||
if (description !== channel.description)
|
||||
changes.description = description;
|
||||
|
||||
@@ -33,11 +33,11 @@ export default function Permissions({ channel }: Props) {
|
||||
const client = useContext(AppContext);
|
||||
|
||||
type R = { name: string; permissions: number };
|
||||
let roles: { [key: string]: R } = {};
|
||||
const roles: { [key: string]: R } = {};
|
||||
if (channel.channel_type !== "Group") {
|
||||
const server = useServer(channel.server);
|
||||
const a = server?.roles ?? {};
|
||||
for (let b of Object.keys(a)) {
|
||||
for (const b of Object.keys(a)) {
|
||||
roles[b] = {
|
||||
name: a[b].name,
|
||||
permissions: a[b].permissions[1],
|
||||
@@ -73,7 +73,7 @@ export default function Permissions({ channel }: Props) {
|
||||
<h2>select role</h2>
|
||||
{selected}
|
||||
{keys.map((id) => {
|
||||
let role: R = id === "default" ? defaultRole : roles[id];
|
||||
const role: R = id === "default" ? defaultRole : roles[id];
|
||||
|
||||
return (
|
||||
<Checkbox
|
||||
@@ -85,7 +85,7 @@ export default function Permissions({ channel }: Props) {
|
||||
})}
|
||||
<h2>channel per??issions</h2>
|
||||
{Object.keys(ChannelPermission).map((perm) => {
|
||||
let value =
|
||||
const value =
|
||||
ChannelPermission[perm as keyof typeof ChannelPermission];
|
||||
if (value & DEFAULT_PERMISSION_DM) {
|
||||
return (
|
||||
|
||||
@@ -118,7 +118,7 @@ export function Account() {
|
||||
onClick={() =>
|
||||
openScreen({
|
||||
id: "modify_account",
|
||||
field: field,
|
||||
field,
|
||||
})
|
||||
}
|
||||
contrast>
|
||||
@@ -142,7 +142,8 @@ export function Account() {
|
||||
Currently work in progress, see{" "}
|
||||
<a
|
||||
href="https://gitlab.insrt.uk/insert/rauth/-/issues/2"
|
||||
target="_blank">
|
||||
target="_blank"
|
||||
rel="noreferrer">
|
||||
tracking issue here
|
||||
</a>
|
||||
.
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
// @ts-ignore
|
||||
import { Reset, Import } from "@styled-icons/boxicons-regular";
|
||||
import { Pencil } from "@styled-icons/boxicons-solid";
|
||||
import pSBC from "shade-blend-color";
|
||||
|
||||
import styles from "./Panes.module.scss";
|
||||
@@ -26,6 +28,7 @@ import {
|
||||
import { useIntermediate } from "../../../context/intermediate/Intermediate";
|
||||
|
||||
import CollapsibleSection from "../../../components/common/CollapsibleSection";
|
||||
import Tooltip from "../../../components/common/Tooltip";
|
||||
import Button from "../../../components/ui/Button";
|
||||
import Checkbox from "../../../components/ui/Checkbox";
|
||||
import ColourSwatches from "../../../components/ui/ColourSwatches";
|
||||
@@ -37,9 +40,6 @@ import mutantSVG from "../assets/mutant_emoji.svg";
|
||||
import notoSVG from "../assets/noto_emoji.svg";
|
||||
import openmojiSVG from "../assets/openmoji_emoji.svg";
|
||||
import twemojiSVG from "../assets/twemoji_emoji.svg";
|
||||
import { Reset, Import } from "@styled-icons/boxicons-regular";
|
||||
import { Pencil } from "@styled-icons/boxicons-solid";
|
||||
import Tooltip from "../../../components/common/Tooltip";
|
||||
|
||||
interface Props {
|
||||
settings: Settings;
|
||||
@@ -205,7 +205,8 @@ export function Component(props: Props) {
|
||||
Mutant Remix{" "}
|
||||
<a
|
||||
href="https://mutant.revolt.chat"
|
||||
target="_blank">
|
||||
target="_blank"
|
||||
rel="noreferrer">
|
||||
(by Revolt)
|
||||
</a>
|
||||
</h4>
|
||||
@@ -247,23 +248,37 @@ export function Component(props: Props) {
|
||||
id="settings_overrides"
|
||||
summary={<Text id="app.settings.pages.appearance.overrides" />}>
|
||||
<div className={styles.actions}>
|
||||
<Tooltip content={<Text id="app.settings.pages.appearance.reset_overrides" />}>
|
||||
<Button contrast iconbutton onClick={() => setTheme({ custom: {} })}>
|
||||
<Reset size={22}/>
|
||||
<Tooltip
|
||||
content={
|
||||
<Text id="app.settings.pages.appearance.reset_overrides" />
|
||||
}>
|
||||
<Button
|
||||
contrast
|
||||
iconbutton
|
||||
onClick={() => setTheme({ custom: {} })}>
|
||||
<Reset size={22} />
|
||||
</Button>
|
||||
</Tooltip>
|
||||
<div className={styles.code} onClick={() => writeClipboard(JSON.stringify(theme))}>
|
||||
<Tooltip content={<Text id="app.special.copy" />}> {/*TOFIX: Try to put the tooltip above the .code div without messing up the css challenge */}
|
||||
<div
|
||||
className={styles.code}
|
||||
onClick={() => writeClipboard(JSON.stringify(theme))}>
|
||||
<Tooltip content={<Text id="app.special.copy" />}>
|
||||
{" "}
|
||||
{/*TOFIX: Try to put the tooltip above the .code div without messing up the css challenge */}
|
||||
{JSON.stringify(theme)}
|
||||
</Tooltip>
|
||||
</div>
|
||||
<Tooltip content={<Text id="app.settings.pages.appearance.import" />}>
|
||||
<Tooltip
|
||||
content={
|
||||
<Text id="app.settings.pages.appearance.import" />
|
||||
}>
|
||||
<Button
|
||||
contrast
|
||||
iconbutton
|
||||
onClick={async () => {
|
||||
try {
|
||||
const text = await navigator.clipboard.readText();
|
||||
const text =
|
||||
await navigator.clipboard.readText();
|
||||
setOverride(JSON.parse(text));
|
||||
} catch (err) {
|
||||
openScreen({
|
||||
@@ -279,13 +294,11 @@ export function Component(props: Props) {
|
||||
});
|
||||
}
|
||||
}}>
|
||||
<Import size={22}/>
|
||||
<Import size={22} />
|
||||
</Button>
|
||||
</Tooltip>
|
||||
</div>
|
||||
<h3>
|
||||
App
|
||||
</h3>
|
||||
<h3>App</h3>
|
||||
<div className={styles.overrides}>
|
||||
{(
|
||||
[
|
||||
@@ -315,7 +328,9 @@ export function Component(props: Props) {
|
||||
"hover",
|
||||
] as const
|
||||
).map((x) => (
|
||||
<div className={styles.entry} key={x}
|
||||
<div
|
||||
className={styles.entry}
|
||||
key={x}
|
||||
style={{ backgroundColor: theme[x] }}>
|
||||
<div className={styles.input}>
|
||||
<input
|
||||
@@ -330,8 +345,13 @@ export function Component(props: Props) {
|
||||
</div>
|
||||
<span>{x}</span>
|
||||
<div className={styles.override}>
|
||||
<div className={styles.picker}
|
||||
onClick={e => e.currentTarget.parentElement?.parentElement?.querySelector('input')?.click()}>
|
||||
<div
|
||||
className={styles.picker}
|
||||
onClick={(e) =>
|
||||
e.currentTarget.parentElement?.parentElement
|
||||
?.querySelector("input")
|
||||
?.click()
|
||||
}>
|
||||
<Pencil size={24} />
|
||||
</div>
|
||||
<InputBox
|
||||
|
||||
@@ -32,8 +32,8 @@ export function Component(props: Props) {
|
||||
key,
|
||||
})
|
||||
}
|
||||
description={ EXPERIMENTS[key].description }>
|
||||
{ EXPERIMENTS[key].title }
|
||||
description={EXPERIMENTS[key].description}>
|
||||
{EXPERIMENTS[key].title}
|
||||
</Checkbox>
|
||||
))}
|
||||
{AVAILABLE_EXPERIMENTS.length === 0 && (
|
||||
|
||||
@@ -76,7 +76,8 @@ export function Component(props: Props) {
|
||||
</span>{" "}
|
||||
<a
|
||||
href="https://weblate.insrt.uk/engage/revolt/?utm_source=widget"
|
||||
target="_blank">
|
||||
target="_blank"
|
||||
rel="noreferrer">
|
||||
<Text id="app.settings.tips.languages.b" />
|
||||
</a>
|
||||
</Tip>
|
||||
|
||||
@@ -59,7 +59,8 @@ export function Component({ options }: Props) {
|
||||
}
|
||||
onChange={async (desktopEnabled) => {
|
||||
if (desktopEnabled) {
|
||||
let permission = await Notification.requestPermission();
|
||||
const permission =
|
||||
await Notification.requestPermission();
|
||||
if (permission !== "granted") {
|
||||
return openScreen({
|
||||
id: "error",
|
||||
@@ -126,7 +127,7 @@ export function Component({ options }: Props) {
|
||||
</h3>
|
||||
{SOUNDS_ARRAY.map((key) => (
|
||||
<Checkbox
|
||||
checked={enabledSounds[key] ? true : false}
|
||||
checked={!!enabledSounds[key]}
|
||||
onChange={(enabled) =>
|
||||
dispatch({
|
||||
type: "SETTINGS_SET_NOTIFICATION_OPTIONS",
|
||||
|
||||
@@ -1,12 +1,18 @@
|
||||
import { Chrome, Android, Apple, Windows } from "@styled-icons/boxicons-logos";
|
||||
import { HelpCircle } from "@styled-icons/boxicons-regular";
|
||||
import {
|
||||
Safari,
|
||||
Firefoxbrowser,
|
||||
Microsoftedge,
|
||||
Linux,
|
||||
Macos,
|
||||
} from "@styled-icons/simple-icons";
|
||||
import relativeTime from "dayjs/plugin/relativeTime";
|
||||
import { useHistory } from "react-router-dom";
|
||||
import { decodeTime } from "ulid";
|
||||
|
||||
import styles from "./Panes.module.scss";
|
||||
import { Text } from "preact-i18n";
|
||||
import { Safari, Firefoxbrowser, Microsoftedge, Linux, Macos } from "@styled-icons/simple-icons";
|
||||
import { Chrome, Android, Apple, Windows } from "@styled-icons/boxicons-logos";
|
||||
import { useContext, useEffect, useState } from "preact/hooks";
|
||||
|
||||
import { dayjs } from "../../../context/Locale";
|
||||
@@ -95,7 +101,7 @@ export function Sessions() {
|
||||
});
|
||||
|
||||
mapped.sort((a, b) => b.timestamp - a.timestamp);
|
||||
let id = mapped.findIndex((x) => x.id === deviceId);
|
||||
const id = mapped.findIndex((x) => x.id === deviceId);
|
||||
|
||||
const render = [
|
||||
mapped[id],
|
||||
@@ -114,7 +120,9 @@ export function Sessions() {
|
||||
<div
|
||||
className={styles.entry}
|
||||
data-active={session.id === deviceId}
|
||||
data-deleting={attemptingDelete.indexOf(session.id) > -1}>
|
||||
data-deleting={
|
||||
attemptingDelete.indexOf(session.id) > -1
|
||||
}>
|
||||
{deviceId === session.id && (
|
||||
<span className={styles.label}>
|
||||
<Text id="app.settings.pages.sessions.this_device" />{" "}
|
||||
@@ -122,18 +130,25 @@ export function Sessions() {
|
||||
)}
|
||||
<div className={styles.session}>
|
||||
<div className={styles.detail}>
|
||||
<svg width={42} height={42}
|
||||
viewBox="0 0 32 32">
|
||||
<svg width={42} height={42} viewBox="0 0 32 32">
|
||||
<foreignObject
|
||||
x="0"
|
||||
y="0"
|
||||
width="32"
|
||||
height="32"
|
||||
mask={systemIcon ? "url(#session)": undefined}>
|
||||
mask={
|
||||
systemIcon
|
||||
? "url(#session)"
|
||||
: undefined
|
||||
}>
|
||||
{getIcon(session)}
|
||||
</foreignObject>
|
||||
<foreignObject x="18" y="18" width="14" height="14">
|
||||
{ systemIcon }
|
||||
<foreignObject
|
||||
x="18"
|
||||
y="18"
|
||||
width="14"
|
||||
height="14">
|
||||
{systemIcon}
|
||||
</foreignObject>
|
||||
</svg>
|
||||
<div className={styles.info}>
|
||||
@@ -142,7 +157,8 @@ export function Sessions() {
|
||||
className={styles.name}
|
||||
value={session.friendly_name}
|
||||
autocomplete="off"
|
||||
style={{ pointerEvents: 'none' }} />
|
||||
style={{ pointerEvents: "none" }}
|
||||
/>
|
||||
<span className={styles.time}>
|
||||
<Text
|
||||
id="app.settings.pages.sessions.created"
|
||||
@@ -155,7 +171,7 @@ export function Sessions() {
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
{deviceId !== session.id && (
|
||||
{deviceId !== session.id && (
|
||||
<Button
|
||||
onClick={async () => {
|
||||
setDelete([
|
||||
@@ -173,35 +189,37 @@ export function Sessions() {
|
||||
);
|
||||
}}
|
||||
disabled={
|
||||
attemptingDelete.indexOf(session.id) > -1
|
||||
attemptingDelete.indexOf(session.id) >
|
||||
-1
|
||||
}>
|
||||
<Text id="app.settings.pages.logOut" />
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
);
|
||||
})}
|
||||
<Button error
|
||||
<Button
|
||||
error
|
||||
onClick={async () => {
|
||||
// ! FIXME: add to rAuth
|
||||
let del: string[] = [];
|
||||
const del: string[] = [];
|
||||
render.forEach((session) => {
|
||||
if (deviceId !== session.id) {
|
||||
del.push(session.id);
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
setDelete(del);
|
||||
|
||||
for (let id of del) {
|
||||
for (const id of del) {
|
||||
await client.req(
|
||||
"DELETE",
|
||||
`/auth/sessions/${id}` as "/auth/sessions",
|
||||
);
|
||||
}
|
||||
|
||||
setSessions(sessions.filter(x => x.id === deviceId));
|
||||
setSessions(sessions.filter((x) => x.id === deviceId));
|
||||
}}>
|
||||
<Text id="app.settings.pages.sessions.logout" />
|
||||
</Button>
|
||||
|
||||
@@ -46,8 +46,8 @@ export function Invites({ server }: Props) {
|
||||
</div>
|
||||
{typeof invites === "undefined" && <Preloader type="ring" />}
|
||||
{invites?.map((invite) => {
|
||||
let creator = users.find((x) => x?._id === invite.creator);
|
||||
let channel = channels.find((x) => x?._id === invite.channel);
|
||||
const creator = users.find((x) => x?._id === invite.creator);
|
||||
const channel = channels.find((x) => x?._id === invite.channel);
|
||||
|
||||
return (
|
||||
<div
|
||||
|
||||
@@ -40,7 +40,7 @@ export function Overview({ server }: Props) {
|
||||
|
||||
const [changed, setChanged] = useState(false);
|
||||
function save() {
|
||||
let changes: Partial<
|
||||
const changes: Partial<
|
||||
Pick<Servers.Server, "name" | "description" | "system_messages">
|
||||
> = {};
|
||||
if (name !== server.name) changes.name = name;
|
||||
|
||||
@@ -88,15 +88,14 @@ export function Roles({ server }: Props) {
|
||||
<Text id="app.settings.permissions.default_role" />
|
||||
</ButtonItem>
|
||||
);
|
||||
} else {
|
||||
return (
|
||||
<ButtonItem
|
||||
active={role === id}
|
||||
onClick={() => setRole(id)}>
|
||||
{roles[id].name}
|
||||
</ButtonItem>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<ButtonItem
|
||||
active={role === id}
|
||||
onClick={() => setRole(id)}>
|
||||
{roles[id].name}
|
||||
</ButtonItem>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
<div className={styles.permissions}>
|
||||
@@ -118,7 +117,7 @@ export function Roles({ server }: Props) {
|
||||
</Overline>
|
||||
{Object.keys(ServerPermission).map((key) => {
|
||||
if (key === "View") return;
|
||||
let value =
|
||||
const value =
|
||||
ServerPermission[
|
||||
key as keyof typeof ServerPermission
|
||||
];
|
||||
@@ -143,7 +142,7 @@ export function Roles({ server }: Props) {
|
||||
</Overline>
|
||||
{Object.keys(ChannelPermission).map((key) => {
|
||||
if (key === "ManageChannel") return;
|
||||
let value =
|
||||
const value =
|
||||
ChannelPermission[
|
||||
key as keyof typeof ChannelPermission
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user