diff --git a/src/components/common/messaging/MessageBase.tsx b/src/components/common/messaging/MessageBase.tsx index ad505c9e..c5e6ebb8 100644 --- a/src/components/common/messaging/MessageBase.tsx +++ b/src/components/common/messaging/MessageBase.tsx @@ -3,11 +3,12 @@ import { decodeTime } from "ulid"; import { Text } from "preact-i18n"; +import { useDictionary } from "../../../lib/i18n"; + +import { dayjs } from "../../../context/Locale"; import { MessageObject } from "../../../context/revoltjs/util"; import Tooltip from "../Tooltip"; -import { useDictionary } from "../../../lib/i18n"; -import { dayjs } from "../../../context/Locale"; export interface BaseMessageProps { head?: boolean; @@ -179,7 +180,9 @@ export function MessageDetail({ <> @@ -194,7 +197,9 @@ export function MessageDetail({ <> diff --git a/src/components/common/messaging/MessageBox.tsx b/src/components/common/messaging/MessageBox.tsx index 065203bc..228c2bff 100644 --- a/src/components/common/messaging/MessageBox.tsx +++ b/src/components/common/messaging/MessageBox.tsx @@ -1,4 +1,5 @@ import { Send, HappyAlt, ShieldX } from "@styled-icons/boxicons-solid"; +import { Styleshare } from "@styled-icons/simple-icons"; import Axios, { CancelTokenSource } from "axios"; import { Channel } from "revolt.js"; import { ChannelPermission } from "revolt.js/dist/api/permissions"; @@ -39,7 +40,6 @@ import AutoComplete, { useAutoComplete } from "../AutoComplete"; import { PermissionTooltip } from "../Tooltip"; import FilePreview from "./bars/FilePreview"; import ReplyBar from "./bars/ReplyBar"; -import { Styleshare } from "@styled-icons/simple-icons"; type Props = { channel: Channel; @@ -111,7 +111,7 @@ const Action = styled.div` export const CAN_UPLOAD_AT_ONCE = 4; export default function MessageBox({ channel }: Props) { - const [draft, setDraft] = useState(getState().drafts[channel._id] ?? ''); + const [draft, setDraft] = useState(getState().drafts[channel._id] ?? ""); const [uploadState, setUploadState] = useState({ type: "none", @@ -144,8 +144,8 @@ export default function MessageBox({ channel }: Props) { } function setMessage(content?: string) { - setDraft(content ?? ''); - + setDraft(content ?? ""); + if (content) { dispatch({ type: "SET_DRAFT", @@ -475,15 +475,15 @@ export default function MessageBox({ channel }: Props) { placeholder={ channel.channel_type === "DirectMessage" ? translate("app.main.channel.message_who", { - person: client.users.get( - client.channels.getRecipient(channel._id), - )?.username, - }) + person: client.users.get( + client.channels.getRecipient(channel._id), + )?.username, + }) : channel.channel_type === "SavedMessages" ? translate("app.main.channel.message_saved") : translate("app.main.channel.message_where", { - channel_name: channel.name, - }) + channel_name: channel.name, + }) } disabled={ uploadState.type === "uploading" || diff --git a/src/components/common/messaging/attachments/AttachmentActions.tsx b/src/components/common/messaging/attachments/AttachmentActions.tsx index 8ca55cfe..591494b4 100644 --- a/src/components/common/messaging/attachments/AttachmentActions.tsx +++ b/src/components/common/messaging/attachments/AttachmentActions.tsx @@ -100,14 +100,16 @@ export default function AttachmentActions({ attachment }: Props) { {filename} {filesize} - { metadata.type === 'Text' && - - - - } + {metadata.type === "Text" && ( + + + + + + )} 0 && ( )} - { message.author === SYSTEM_USER_ID ? - : + {message.author === SYSTEM_USER_ID ? ( + + ) : ( - } + )} ); } diff --git a/src/components/common/messaging/attachments/TextFile.tsx b/src/components/common/messaging/attachments/TextFile.tsx index d14bf75d..955825cb 100644 --- a/src/components/common/messaging/attachments/TextFile.tsx +++ b/src/components/common/messaging/attachments/TextFile.tsx @@ -31,7 +31,9 @@ export default function TextFile({ attachment }: Props) { if (loading) return; if (attachment.size > 20_000) { - setContent('This file is > 20 KB, for your sake I did not load it.\nSee tracking issue here for previews: https://gitlab.insrt.uk/revolt/revite/-/issues/2'); + setContent( + "This file is > 20 KB, for your sake I did not load it.\nSee tracking issue here for previews: https://gitlab.insrt.uk/revolt/revite/-/issues/2", + ); return; } diff --git a/src/components/common/messaging/bars/ReplyBar.tsx b/src/components/common/messaging/bars/ReplyBar.tsx index 7db07b98..adbe5060 100644 --- a/src/components/common/messaging/bars/ReplyBar.tsx +++ b/src/components/common/messaging/bars/ReplyBar.tsx @@ -4,6 +4,7 @@ import { File, XCircle, } from "@styled-icons/boxicons-regular"; +import { SYSTEM_USER_ID } from "revolt.js"; import styled from "styled-components"; import { Text } from "preact-i18n"; @@ -20,9 +21,8 @@ import IconButton from "../../../ui/IconButton"; import Markdown from "../../../markdown/Markdown"; import UserShort from "../../user/UserShort"; -import { ReplyBase } from "../attachments/MessageReply"; import { SystemMessage } from "../SystemMessage"; -import { SYSTEM_USER_ID } from "revolt.js"; +import { ReplyBase } from "../attachments/MessageReply"; interface Props { channel: string; @@ -102,13 +102,16 @@ export default function ReplyBar({ channel, replies, setReplies }: Props) { message.attachments.length > 0 && ( )} - { message.author === SYSTEM_USER_ID ? - : + {message.author === SYSTEM_USER_ID ? ( + + ) : ( - } + )} -
- {!members && } -
- { members && - —{" "} - {users.length} -
- } - /> } +
{!members && }
+ {members && ( + + —{" "} + {users.length} +
+ } + /> + )} {members && users.length === 0 && } {users.map( (user) => diff --git a/src/components/ui/Button.tsx b/src/components/ui/Button.tsx index 0dd41bc7..3fbad6cd 100644 --- a/src/components/ui/Button.tsx +++ b/src/components/ui/Button.tsx @@ -8,7 +8,8 @@ interface Props { readonly error?: boolean; } -export type ButtonProps = Props & Omit, 'as'>; +export type ButtonProps = Props & + Omit, "as">; export default styled.button` z-index: 1; @@ -18,7 +19,7 @@ export default styled.button` align-items: center; justify-content: center; padding: 2px 16px; - font-size: .875rem; + font-size: 0.875rem; font-family: inherit; font-weight: 500; @@ -69,7 +70,7 @@ export default styled.button` &:disabled { cursor: not-allowed; - opacity: .5; + opacity: 0.5; } &:active { diff --git a/src/components/ui/ColourSwatches.tsx b/src/components/ui/ColourSwatches.tsx index a081c566..a30b2424 100644 --- a/src/components/ui/ColourSwatches.tsx +++ b/src/components/ui/ColourSwatches.tsx @@ -2,8 +2,8 @@ import { Check } from "@styled-icons/boxicons-regular"; import { Palette } from "@styled-icons/boxicons-solid"; import styled, { css } from "styled-components"; -import { useRef } from "preact/hooks"; import { RefObject } from "preact"; +import { useRef } from "preact/hooks"; interface Props { value: string; diff --git a/src/components/ui/ComboBox.tsx b/src/components/ui/ComboBox.tsx index 5b794b49..44d100c2 100644 --- a/src/components/ui/ComboBox.tsx +++ b/src/components/ui/ComboBox.tsx @@ -10,7 +10,7 @@ export default styled.select` border: none; outline: 2px solid transparent; transition: outline-color 0.2s ease-in-out; - transition: box-shadow .2s ease-in-out; + transition: box-shadow 0.2s ease-in-out; cursor: pointer; width: 100%; diff --git a/src/components/ui/DateDivider.tsx b/src/components/ui/DateDivider.tsx index e2240925..14f41d7f 100644 --- a/src/components/ui/DateDivider.tsx +++ b/src/components/ui/DateDivider.tsx @@ -1,5 +1,5 @@ - import styled, { css } from "styled-components"; + import { dayjs } from "../../context/Locale"; const Base = styled.div<{ unread?: boolean }>` diff --git a/src/components/ui/IconButton.tsx b/src/components/ui/IconButton.tsx index 9c11b92c..547f1810 100644 --- a/src/components/ui/IconButton.tsx +++ b/src/components/ui/IconButton.tsx @@ -49,9 +49,11 @@ export default styled.div` } `} - ${(props) => props.rotate && css` - svg { - transform: rotateZ(${props.rotate}); - } - ` } + ${(props) => + props.rotate && + css` + svg { + transform: rotateZ(${props.rotate}); + } + `} `; diff --git a/src/components/ui/InputBox.tsx b/src/components/ui/InputBox.tsx index 70e9cd9a..56aef025 100644 --- a/src/components/ui/InputBox.tsx +++ b/src/components/ui/InputBox.tsx @@ -18,7 +18,7 @@ export default styled.input` border: none; outline: 2px solid transparent; transition: outline-color 0.2s ease-in-out; - transition: box-shadow .2s ease-in-out; + transition: box-shadow 0.2s ease-in-out; &:hover { background: var(--secondary-background); diff --git a/src/components/ui/Modal.tsx b/src/components/ui/Modal.tsx index df77a07a..67009c7c 100644 --- a/src/components/ui/Modal.tsx +++ b/src/components/ui/Modal.tsx @@ -99,10 +99,10 @@ const ModalActions = styled.div` background: var(--secondary-background); `; -export type Action = Omit & { +export type Action = Omit & { confirmation?: boolean; onClick: () => void; -} +}; interface Props { children?: Children; @@ -177,9 +177,9 @@ export default function Modal(props: Props) { {content} {props.actions && ( - {props.actions.map((x) => + {props.actions.map((x) => ( */} -

-
+

+ +

+
+ +
{/*
- +