-
e.currentTarget.parentElement?.parentElement?.querySelector('input')?.click()}>
+
+ e.currentTarget.parentElement?.parentElement
+ ?.querySelector("input")
+ ?.click()
+ }>
- { EXPERIMENTS[key].title }
+ description={EXPERIMENTS[key].description}>
+ {EXPERIMENTS[key].title}
))}
{AVAILABLE_EXPERIMENTS.length === 0 && (
diff --git a/src/pages/settings/panes/Languages.tsx b/src/pages/settings/panes/Languages.tsx
index 559ccc0e..0d6a4de8 100644
--- a/src/pages/settings/panes/Languages.tsx
+++ b/src/pages/settings/panes/Languages.tsx
@@ -76,7 +76,8 @@ export function Component(props: Props) {
{" "}
+ target="_blank"
+ rel="noreferrer">
diff --git a/src/pages/settings/panes/Notifications.tsx b/src/pages/settings/panes/Notifications.tsx
index a7a032d9..2790f122 100644
--- a/src/pages/settings/panes/Notifications.tsx
+++ b/src/pages/settings/panes/Notifications.tsx
@@ -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) {
{SOUNDS_ARRAY.map((key) => (
dispatch({
type: "SETTINGS_SET_NOTIFICATION_OPTIONS",
diff --git a/src/pages/settings/panes/Sessions.tsx b/src/pages/settings/panes/Sessions.tsx
index 2a67c337..03aea2fb 100644
--- a/src/pages/settings/panes/Sessions.tsx
+++ b/src/pages/settings/panes/Sessions.tsx
@@ -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() {
-1}>
+ data-deleting={
+ attemptingDelete.indexOf(session.id) > -1
+ }>
{deviceId === session.id && (
{" "}
@@ -122,18 +130,25 @@ export function Sessions() {
)}
-
- {deviceId !== session.id && (
+ {deviceId !== session.id && (
)}
- )
+ );
})}
-
diff --git a/src/pages/settings/server/Invites.tsx b/src/pages/settings/server/Invites.tsx
index dfef7772..fa69fbe8 100644
--- a/src/pages/settings/server/Invites.tsx
+++ b/src/pages/settings/server/Invites.tsx
@@ -46,8 +46,8 @@ export function Invites({ server }: Props) {
{typeof invites === "undefined" &&
}
{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 (
> = {};
if (name !== server.name) changes.name = name;
diff --git a/src/pages/settings/server/Roles.tsx b/src/pages/settings/server/Roles.tsx
index 2a84bc5b..489adbf8 100644
--- a/src/pages/settings/server/Roles.tsx
+++ b/src/pages/settings/server/Roles.tsx
@@ -88,15 +88,14 @@ export function Roles({ server }: Props) {
);
- } else {
- return (
- setRole(id)}>
- {roles[id].name}
-
- );
}
+ return (
+ setRole(id)}>
+ {roles[id].name}
+
+ );
})}
@@ -118,7 +117,7 @@ export function Roles({ server }: Props) {
{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) {
{Object.keys(ChannelPermission).map((key) => {
if (key === "ManageChannel") return;
- let value =
+ const value =
ChannelPermission[
key as keyof typeof ChannelPermission
];
diff --git a/src/redux/connector.tsx b/src/redux/connector.tsx
index f4953f0e..699238d6 100644
--- a/src/redux/connector.tsx
+++ b/src/redux/connector.tsx
@@ -11,6 +11,6 @@ export function connectState(
mapKeys: (state: State, props: T) => any,
memoize?: boolean,
): ConnectedComponent<(props: any) => h.JSX.Element | null, T> {
- let c = connect(mapKeys)(component);
+ const c = connect(mapKeys)(component);
return memoize ? memo(c) : c;
}
diff --git a/src/redux/reducers/experiments.ts b/src/redux/reducers/experiments.ts
index 2eeb0d26..39ee5c1a 100644
--- a/src/redux/reducers/experiments.ts
+++ b/src/redux/reducers/experiments.ts
@@ -1,10 +1,12 @@
-export type Experiments = 'search';
-export const AVAILABLE_EXPERIMENTS: Experiments[] = [ 'search' ];
-export const EXPERIMENTS: { [key in Experiments]: { title: string, description: string } } = {
- 'search': {
- title: 'Search',
- description: 'Allows you to search for messages in channels.'
- }
+export type Experiments = "search";
+export const AVAILABLE_EXPERIMENTS: Experiments[] = ["search"];
+export const EXPERIMENTS: {
+ [key in Experiments]: { title: string; description: string };
+} = {
+ search: {
+ title: "Search",
+ description: "Allows you to search for messages in channels.",
+ },
};
export interface ExperimentOptions {
diff --git a/src/revision.ts b/src/revision.ts
index 6cb9d248..b9bf0d03 100644
--- a/src/revision.ts
+++ b/src/revision.ts
@@ -1,3 +1,3 @@
export const REPO_URL = "https://gitlab.insrt.uk/revolt/revite/-/commit";
export const GIT_REVISION = "__GIT_REVISION__";
-export const GIT_BRANCH: string = "__GIT_BRANCH__";
+export const GIT_BRANCH = "__GIT_BRANCH__";
diff --git a/src/sw.ts b/src/sw.ts
index b22850ab..370ea849 100644
--- a/src/sw.ts
+++ b/src/sw.ts
@@ -26,13 +26,13 @@ const ENCODING_LEN = ENCODING.length;
const TIME_LEN = 10;
function decodeTime(id: string) {
- var time = id
+ const time = id
.substr(0, TIME_LEN)
.split("")
.reverse()
- .reduce(function (carry, char, index) {
- var encodingIndex = ENCODING.indexOf(char);
- if (encodingIndex === -1) throw "invalid character found: " + char;
+ .reduce((carry, char, index) => {
+ const encodingIndex = ENCODING.indexOf(char);
+ if (encodingIndex === -1) throw `invalid character found: ${char}`;
return (carry += encodingIndex * Math.pow(ENCODING_LEN, index));
}, 0);
@@ -43,9 +43,9 @@ function decodeTime(id: string) {
self.addEventListener("push", (event) => {
async function process() {
if (event.data === null) return;
- let data: Message = event.data.json();
+ const data: Message = event.data.json();
- let item = await localStorage.getItem("state");
+ const item = await localStorage.getItem("state");
if (!item) return;
const state: State = JSON.parse(item);
@@ -57,7 +57,7 @@ self.addEventListener("push", (event) => {
// Match RevoltClient.tsx#L55
db = await openDB("state", 3, {
upgrade(db) {
- for (let store of [
+ for (const store of [
"channels",
"servers",
"users",
@@ -87,8 +87,8 @@ self.addEventListener("push", (event) => {
}
}
- let channel = await get("channels", data.channel);
- let user = await get("users", data.author);
+ const channel = await get("channels", data.channel);
+ const user = await get("users", data.author);
if (channel) {
const notifs = getNotificationState(state.notifications, channel);
@@ -96,10 +96,10 @@ self.addEventListener("push", (event) => {
}
let title = `@${data.author}`;
- let username = user?.username ?? data.author;
+ const username = user?.username ?? data.author;
let image;
if (data.attachments) {
- let attachment = data.attachments[0];
+ const attachment = data.attachments[0];
if (attachment.metadata.type === "Image") {
image = `${autumn_url}/${attachment.tag}/${attachment._id}`;
}
@@ -120,7 +120,7 @@ self.addEventListener("push", (event) => {
break;
case "TextChannel":
{
- let server = await get("servers", channel.server);
+ const server = await get("servers", channel.server);
title = `@${user?.username} (#${channel.name}, ${server?.name})`;
}
break;
@@ -150,16 +150,16 @@ self.addEventListener("push", (event) => {
// ? Open the app on notification click.
// https://stackoverflow.com/a/39457287
-self.addEventListener("notificationclick", function (event) {
- let url = event.notification.data;
+self.addEventListener("notificationclick", (event) => {
+ const url = event.notification.data;
event.notification.close();
event.waitUntil(
self.clients
.matchAll({ includeUncontrolled: true, type: "window" })
.then((windowClients) => {
// Check if there is already a window/tab open with the target URL
- for (var i = 0; i < windowClients.length; i++) {
- var client = windowClients[i];
+ for (let i = 0; i < windowClients.length; i++) {
+ const client = windowClients[i];
// If so, just focus it.
if (client.url === url && "focus" in client) {
return client.focus();