Format and automatically fix linted code.

This commit is contained in:
Paul
2021-07-10 15:57:29 +01:00
parent 392cb23541
commit 7586b365fe
87 changed files with 789 additions and 563 deletions

View File

@@ -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>
.

View File

@@ -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

View File

@@ -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 && (

View File

@@ -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>

View File

@@ -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",

View File

@@ -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>