diff --git a/src/components/common/messaging/MessageBase.tsx b/src/components/common/messaging/MessageBase.tsx index ad505c9ef899a484003ac5fc1a102b194c27a329..c5e6ebb8b88e7063305cdf7a481cebf31c660882 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({ <> <time className="copyTime"> <i className="copyBracket">[</i> - {dayjs(decodeTime(message._id)).format(dict.dayjs.timeFormat)} + {dayjs(decodeTime(message._id)).format( + dict.dayjs.timeFormat, + )} <i className="copyBracket">]</i> </time> <span className="edited"> @@ -194,7 +197,9 @@ export function MessageDetail({ <> <time> <i className="copyBracket">[</i> - {dayjs(decodeTime(message._id)).format(dict.dayjs.timeFormat)} + {dayjs(decodeTime(message._id)).format( + dict.dayjs.timeFormat, + )} <i className="copyBracket">]</i> </time> </> diff --git a/src/components/common/messaging/MessageBox.tsx b/src/components/common/messaging/MessageBox.tsx index 065203bc4655e8322e25e83c43eff5f19962d278..228c2bffe7f4e143b2f79c0eec631f1021a6c516 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<UploadState>({ 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 8ca55cfe75d18c841cb433b232a4f1a0c66d9078..591494b49a345da9caab034e894a3c64552b0901 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) { <File size={24} className={styles.iconType} /> <span className={styles.filename}>{filename}</span> <span className={styles.filesize}>{filesize}</span> - { metadata.type === 'Text' && <a - href={open_url} - target="_blank" - className={styles.externalType}> - <IconButton> - <LinkExternal size={24} /> - </IconButton> - </a> } + {metadata.type === "Text" && ( + <a + href={open_url} + target="_blank" + className={styles.externalType}> + <IconButton> + <LinkExternal size={24} /> + </IconButton> + </a> + )} <a href={download_url} className={styles.downloadIcon} diff --git a/src/components/common/messaging/attachments/MessageReply.tsx b/src/components/common/messaging/attachments/MessageReply.tsx index cbfaf6743f33c411ad441f58dd919f893ed71af2..6fef2bf7429c44668fe9fe488255e392b54b8cc8 100644 --- a/src/components/common/messaging/attachments/MessageReply.tsx +++ b/src/components/common/messaging/attachments/MessageReply.tsx @@ -1,4 +1,5 @@ import { Reply, File } from "@styled-icons/boxicons-regular"; +import { SYSTEM_USER_ID } from "revolt.js"; import styled, { css } from "styled-components"; import { Text } from "preact-i18n"; @@ -9,7 +10,6 @@ import { useUser } from "../../../../context/revoltjs/hooks"; import Markdown from "../../../markdown/Markdown"; import UserShort from "../../user/UserShort"; -import { SYSTEM_USER_ID } from "revolt.js"; import { SystemMessage } from "../SystemMessage"; interface Props { @@ -86,13 +86,14 @@ export function MessageReply({ index, channel, id }: Props) { {message.attachments && message.attachments.length > 0 && ( <File size={16} /> )} - { message.author === SYSTEM_USER_ID ? - <SystemMessage message={message} /> : + {message.author === SYSTEM_USER_ID ? ( + <SystemMessage message={message} /> + ) : ( <Markdown disallowBigEmoji content={(message.content as string).replace(/\n/g, " ")} /> - } + )} </ReplyBase> ); } diff --git a/src/components/common/messaging/attachments/TextFile.tsx b/src/components/common/messaging/attachments/TextFile.tsx index d14bf75d1f75c466662545c5e07ad7344ac303c9..955825cb2dbcf4d8393676b0d97d51e082def1eb 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 7db07b98f2930324d1697c72eb8f17ebda23154a..adbe50609d1dfe2a6c6cabcb65aa09ec07c6a39c 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 && ( <File size={16} /> )} - { message.author === SYSTEM_USER_ID ? - <SystemMessage message={message} /> : + {message.author === SYSTEM_USER_ID ? ( + <SystemMessage message={message} /> + ) : ( <Markdown disallowBigEmoji - content={(message.content as string).replace(/\n/g, " ")} + content={( + message.content as string + ).replace(/\n/g, " ")} /> - } + )} </ReplyBase> <span class="actions"> <IconButton diff --git a/src/components/navigation/right/MemberSidebar.tsx b/src/components/navigation/right/MemberSidebar.tsx index 124dabe5845dd58cbd32c5f32ae492901702acb2..47a44ffafe32117a714ae4c225ebbb4947d52a09 100644 --- a/src/components/navigation/right/MemberSidebar.tsx +++ b/src/components/navigation/right/MemberSidebar.tsx @@ -233,18 +233,18 @@ export function ServerMemberSidebar({ <GenericSidebarBase> <GenericSidebarList> <ChannelDebugInfo id={channel._id} /> - <div> - {!members && <Preloader type="ring" />} - </div> - { members && <Category - variant="uniform" - text={ - <span> - <Text id="app.main.categories.members" /> —{" "} - {users.length} - </span> - } - /> } + <div>{!members && <Preloader type="ring" />}</div> + {members && ( + <Category + variant="uniform" + text={ + <span> + <Text id="app.main.categories.members" /> —{" "} + {users.length} + </span> + } + /> + )} {members && users.length === 0 && <img src={placeholderSVG} />} {users.map( (user) => diff --git a/src/components/ui/Button.tsx b/src/components/ui/Button.tsx index 0dd41bc771f67c0cbd9dd8391206e597f81b157b..3fbad6cd4f54ffffe7a465b9f982bfd5ed316e96 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<JSX.HTMLAttributes<HTMLButtonElement>, 'as'>; +export type ButtonProps = Props & + Omit<JSX.HTMLAttributes<HTMLButtonElement>, "as">; export default styled.button<Props>` z-index: 1; @@ -18,7 +19,7 @@ export default styled.button<Props>` 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<Props>` &: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 a081c5666b118c3d56fe00f60b42d0a75dd9b202..a30b242484d82cedd1e5d986d2c3dde577327ef9 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 5b794b49fe5f839991eaec0c662a23f20dfa7356..44d100c21d880fed79f4cd066a809548eeb22c9d 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 e22409251ade49bf6f615b4b0bdc1386b1003820..14f41d7f027ab5abd2513a4f5a74ad1d0a180b27 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 9c11b92c0ae4536f29500809f03ee683715804ce..547f18107ba8f2651e90f04ca2d42700ea59c890 100644 --- a/src/components/ui/IconButton.tsx +++ b/src/components/ui/IconButton.tsx @@ -49,9 +49,11 @@ export default styled.div<Props>` } `} - ${(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 70e9cd9a49b0f7b17e023bb236388be33946ce1c..56aef02578cb7b7739ae8689da3fb767ef4b891e 100644 --- a/src/components/ui/InputBox.tsx +++ b/src/components/ui/InputBox.tsx @@ -18,7 +18,7 @@ export default styled.input<Props>` 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 df77a07a11338db3af1b9e35ee52e4ac66e902e4..67009c7c19a6ed2fd240065ff65c25100de00e17 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<ButtonProps, 'onClick'> & { +export type Action = Omit<ButtonProps, "onClick"> & { confirmation?: boolean; onClick: () => void; -} +}; interface Props { children?: Children; @@ -177,9 +177,9 @@ export default function Modal(props: Props) { {content} {props.actions && ( <ModalActions> - {props.actions.map((x) => + {props.actions.map((x) => ( <Button {...x} disabled={props.disabled} /> - )} + ))} </ModalActions> )} </ModalContainer> diff --git a/src/components/ui/TextArea.tsx b/src/components/ui/TextArea.tsx index 1a2016bcbf7f0837e5a598f7e93c224788a8cb95..f26e8738ab23e83462999a36bf579334254bf705 100644 --- a/src/components/ui/TextArea.tsx +++ b/src/components/ui/TextArea.tsx @@ -17,8 +17,9 @@ export default styled.textarea<TextAreaProps>` display: block; color: var(--foreground); background: var(--secondary-background); - padding: ${(props) => (props.padding) ?? 'var(--textarea-padding)'}; - line-height: ${(props) => (props.lineHeight) ?? 'var(--textarea-line-height)'}; + padding: ${(props) => props.padding ?? "var(--textarea-padding)"}; + line-height: ${(props) => + props.lineHeight ?? "var(--textarea-line-height)"}; ${(props) => props.hideBorder && diff --git a/src/context/Locale.tsx b/src/context/Locale.tsx index d12fd9a009124d6663f8b4d3ff0ecc7c07a7642e..72337f24ed98fdfefe463bf6832b74aeddb36626 100644 --- a/src/context/Locale.tsx +++ b/src/context/Locale.tsx @@ -1,6 +1,4 @@ import dayJS from "dayjs"; -export const dayjs = dayJS; - import calendar from "dayjs/plugin/calendar"; import format from "dayjs/plugin/localizedFormat"; import update from "dayjs/plugin/updateLocale"; @@ -13,6 +11,8 @@ import { connectState } from "../redux/connector"; import definition from "../../external/lang/en.json"; +export const dayjs = dayJS; + dayjs.extend(calendar); dayjs.extend(format); dayjs.extend(update); @@ -163,7 +163,7 @@ function Locale({ children, locale }: Props) { dayjs["timeFormat"] = twelvehour ? "hh:mm A" : "HH:mm"; Object.keys(dayjs) - .filter((k) => typeof dayjs[k] === 'string') + .filter((k) => typeof dayjs[k] === "string") .forEach( (k) => (dayjs[k] = dayjs[k].replace( @@ -175,7 +175,9 @@ function Locale({ children, locale }: Props) { return obj; } - dayjs.updateLocale("en", { calendar: { ...definition.dayjs, sameDay: 'sussy baka' } }); + dayjs.updateLocale("en", { + calendar: { ...definition.dayjs, sameDay: "sussy baka" }, + }); useEffect(() => { if (locale === "en") { const defn = transformLanguage(definition); diff --git a/src/context/intermediate/modals/Input.tsx b/src/context/intermediate/modals/Input.tsx index 0af0163b865f07a1f0ed2a48002295ca7320ae1c..16eb0115a5d9e36cc799ce0a64139f99a9139c3d 100644 --- a/src/context/intermediate/modals/Input.tsx +++ b/src/context/intermediate/modals/Input.tsx @@ -155,7 +155,7 @@ export function SpecialInputModal(props: SpecialProps) { status: { ...client.user?.status, text: text.trim().length > 0 ? text : undefined, - } + }, }) } /> diff --git a/src/context/intermediate/modals/Prompt.tsx b/src/context/intermediate/modals/Prompt.tsx index de7adfd6bb508cc9dd8f61ca7d38ea5781a907bc..ec057c99df6830b0d07649a6774d300bd1b47217 100644 --- a/src/context/intermediate/modals/Prompt.tsx +++ b/src/context/intermediate/modals/Prompt.tsx @@ -256,7 +256,9 @@ export function SpecialPromptModal(props: SpecialProps) { question={<Text id={`app.context_menu.create_invite`} />} actions={[ { - children: <Text id="app.special.modals.actions.ok" />, + children: ( + <Text id="app.special.modals.actions.ok" /> + ), confirmation: true, onClick: onClose, }, @@ -292,7 +294,9 @@ export function SpecialPromptModal(props: SpecialProps) { question={<Text id={`app.context_menu.kick_member`} />} actions={[ { - children: <Text id="app.special.modals.actions.kick" />, + children: ( + <Text id="app.special.modals.actions.kick" /> + ), contrast: true, error: true, confirmation: true, @@ -342,7 +346,9 @@ export function SpecialPromptModal(props: SpecialProps) { question={<Text id={`app.context_menu.ban_member`} />} actions={[ { - children: <Text id="app.special.modals.actions.ban" />, + children: ( + <Text id="app.special.modals.actions.ban" /> + ), contrast: true, error: true, confirmation: true, diff --git a/src/context/intermediate/popovers/UserProfile.tsx b/src/context/intermediate/popovers/UserProfile.tsx index 191b963d9cb9fa1454af2c8ab66a783b3eaafee0..1c7b579de32e83df8f0c6d485cf8e120c0add30f 100644 --- a/src/context/intermediate/popovers/UserProfile.tsx +++ b/src/context/intermediate/popovers/UserProfile.tsx @@ -1,10 +1,5 @@ -import { - Envelope, - Edit, - UserPlus, - Shield -} from "@styled-icons/boxicons-solid"; import { Money } from "@styled-icons/boxicons-regular"; +import { Envelope, Edit, UserPlus, Shield } from "@styled-icons/boxicons-solid"; import { Link, useHistory } from "react-router-dom"; import { Users } from "revolt.js/dist/api/objects"; import { UserPermission } from "revolt.js/dist/api/permissions"; diff --git a/src/context/revoltjs/FileUploads.tsx b/src/context/revoltjs/FileUploads.tsx index 83cf8a4a4aa16a541964da5cf4ebd8250fe1723d..a95a9a3500e0b0a9cf92e285a92bfa2bd3b30d06 100644 --- a/src/context/revoltjs/FileUploads.tsx +++ b/src/context/revoltjs/FileUploads.tsx @@ -277,7 +277,7 @@ export function FileUploader(props: Props) { if (attached) return remove(); onClick(); }} - rotate={uploading || attached ? '45deg' : undefined}> + rotate={uploading || attached ? "45deg" : undefined}> <Plus size={size} /> </IconButton> ); diff --git a/src/lib/TextAreaAutoSize.tsx b/src/lib/TextAreaAutoSize.tsx index 1d3b0664fe42ab61c9fa3c3f1e702a9eccca7dd1..41848cc6cb3bbec385313082f59e710b8febac7b 100644 --- a/src/lib/TextAreaAutoSize.tsx +++ b/src/lib/TextAreaAutoSize.tsx @@ -1,12 +1,12 @@ import styled from "styled-components"; +import { RefObject } from "preact"; import { useEffect, useLayoutEffect, useRef } from "preact/hooks"; import TextArea, { TextAreaProps } from "../components/ui/TextArea"; import { internalSubscribe } from "./eventEmitter"; import { isTouchscreenDevice } from "./isTouchscreenDevice"; -import { RefObject } from "preact"; type TextAreaAutoSizeProps = Omit< JSX.HTMLAttributes<HTMLTextAreaElement>, @@ -30,7 +30,7 @@ const Container = styled.div` flex-direction: column; `; -const Ghost = styled.div<{ lineHeight: string, maxRows: number }>` +const Ghost = styled.div<{ lineHeight: string; maxRows: number }>` flex: 0; width: 100%; overflow: hidden; @@ -41,13 +41,15 @@ const Ghost = styled.div<{ lineHeight: string, maxRows: number }>` width: 100%; white-space: pre-wrap; word-break: break-all; - + top: 0; position: absolute; font-size: var(--text-size); line-height: ${(props) => props.lineHeight}; - max-height: calc(calc( ${(props) => props.lineHeight} * ${ (props) => props.maxRows } )); + max-height: calc( + calc(${(props) => props.lineHeight} * ${(props) => props.maxRows}) + ); } `; @@ -72,7 +74,7 @@ export default function TextAreaAutoSize(props: TextAreaAutoSizeProps) { useLayoutEffect(() => { if (ref.current && ghost.current) { - ref.current.style.height = ghost.current.clientHeight + 'px'; + ref.current.style.height = ghost.current.clientHeight + "px"; } }, [ghost, props.value]); @@ -139,7 +141,9 @@ export default function TextAreaAutoSize(props: TextAreaAutoSizeProps) { }} {...textAreaProps} /> - <Ghost lineHeight={lineHeight ?? 'var(--textarea-line-height)'} maxRows={maxRows ?? 5}> + <Ghost + lineHeight={lineHeight ?? "var(--textarea-line-height)"} + maxRows={maxRows ?? 5}> <div ref={ghost} style={{ padding }}> {props.value ? props.value diff --git a/src/lib/i18n.tsx b/src/lib/i18n.tsx index 9b99a2928a3d99948434d6ce548a39d23fb0d6f9..6bbcd01b86ea00fbcbe78a359075ee743fd50d6d 100644 --- a/src/lib/i18n.tsx +++ b/src/lib/i18n.tsx @@ -15,11 +15,11 @@ interface Props { export interface Dictionary { dayjs: { defaults: { - twelvehour: 'yes' | 'no'; + twelvehour: "yes" | "no"; separator: string; date: "traditional" | "simplified" | "ISO8601"; - }, - timeFormat: string + }; + timeFormat: string; }; [key: string]: Object | string; } diff --git a/src/pages/channels/messaging/MessageArea.tsx b/src/pages/channels/messaging/MessageArea.tsx index 06dfd8ddc6aca7fc50be6b2a4923051b43db1066..2cc14690bbc58b61533aaf81f5ad3ef48ea0194a 100644 --- a/src/pages/channels/messaging/MessageArea.tsx +++ b/src/pages/channels/messaging/MessageArea.tsx @@ -95,10 +95,11 @@ export function MessageArea({ id }: Props) { animateScroll.scrollTo( Math.max( 101, - ref.current ? (ref.current.scrollTop + - (ref.current.scrollHeight - - scrollState.current.previousHeight)) - : 101 + ref.current + ? ref.current.scrollTop + + (ref.current.scrollHeight - + scrollState.current.previousHeight) + : 101, ), { container: ref.current, @@ -128,7 +129,8 @@ export function MessageArea({ id }: Props) { ref.current?.clientHeight : true; - const atTop = (offset = 0) => ref.current ? ref.current.scrollTop <= offset : false; + const atTop = (offset = 0) => + ref.current ? ref.current.scrollTop <= offset : false; // ? Handle events from renderer. useEffect(() => { diff --git a/src/pages/friends/Friends.tsx b/src/pages/friends/Friends.tsx index 9c907ffe61f620ed3b3a2205106b51a5619798cd..7fb1506b5618687e08391786f04725c523f5c2b7 100644 --- a/src/pages/friends/Friends.tsx +++ b/src/pages/friends/Friends.tsx @@ -121,7 +121,10 @@ export default function Friends() { */} </div> </Header> - <div className={styles.list} data-empty={isEmpty} data-mobile={isTouchscreenDevice}> + <div + className={styles.list} + data-empty={isEmpty} + data-mobile={isTouchscreenDevice}> {isEmpty && ( <> <img src="https://img.insrt.uk/xexu7/XOPoBUTI47.png/raw" /> diff --git a/src/pages/settings/GenericSettings.tsx b/src/pages/settings/GenericSettings.tsx index 2024110be213a35f906d76f5d7dcc263e54cace1..9c8ca77a8627a9113d7423b5b53d92e3a1d5e5db 100644 --- a/src/pages/settings/GenericSettings.tsx +++ b/src/pages/settings/GenericSettings.tsx @@ -85,7 +85,10 @@ export function GenericSettings({ <> {showExitButton && ( <IconButton onClick={exitSettings}> - <X size={27} style={{marginInlineEnd: "8px"}} /> + <X + size={27} + style={{ marginInlineEnd: "8px" }} + /> </IconButton> )} <Text id="app.settings.title" /> @@ -93,7 +96,10 @@ export function GenericSettings({ ) : ( <> <IconButton onClick={() => switchPage()}> - <ArrowBack size={24} style={{marginInlineEnd: "10px"}} /> + <ArrowBack + size={24} + style={{ marginInlineEnd: "10px" }} + /> </IconButton> <Text id={`app.settings.${category}.${page}.title`} @@ -148,9 +154,9 @@ export function GenericSettings({ )} {!isTouchscreenDevice && ( <div className={styles.action}> - <div onClick={exitSettings} className={styles.closeButton}> - <X size={28} /> - </div> + <div onClick={exitSettings} className={styles.closeButton}> + <X size={28} /> + </div> </div> )} </div> diff --git a/src/pages/settings/panes/Account.tsx b/src/pages/settings/panes/Account.tsx index 8a8c049f2dde9564bbc1ddac7e6af141e309d2e7..dab610a175e5ff67568ed878c7016b9da93912c6 100644 --- a/src/pages/settings/panes/Account.tsx +++ b/src/pages/settings/panes/Account.tsx @@ -14,10 +14,10 @@ import { } from "../../../context/revoltjs/RevoltClient"; import { useForceUpdate, useSelf } from "../../../context/revoltjs/hooks"; +import Tooltip from "../../../components/common/Tooltip"; import UserIcon from "../../../components/common/user/UserIcon"; import Button from "../../../components/ui/Button"; import Overline from "../../../components/ui/Overline"; -import Tooltip from "../../../components/common/Tooltip"; import Tip from "../../../components/ui/Tip"; export function Account() { @@ -65,7 +65,10 @@ export function Account() { <div className={styles.userDetail}> <div className={styles.username}>@{user.username}</div> <div className={styles.userid}> - <Tooltip content={<Text id="app.settings.pages.account.unique_id" />}> + <Tooltip + content={ + <Text id="app.settings.pages.account.unique_id" /> + }> <HelpCircle size={16} /> </Tooltip> <Tooltip content={<Text id="app.special.copy" />}> @@ -90,13 +93,25 @@ export function Account() { <div className={styles.subtext}> <Text id={`login.${field}`} /> </div> - <p>{ - field === 'email' ? - (revealEmail ? value : - <>***********@{value.split('@').pop()} <a onClick={() => setRevealEmail(true)}> - <Text id="app.special.modals.actions.reveal" /></a></>) - : value - }</p> + <p> + {field === "email" ? ( + revealEmail ? ( + value + ) : ( + <> + ***********@{value.split("@").pop()}{" "} + <a + onClick={() => + setRevealEmail(true) + }> + <Text id="app.special.modals.actions.reveal" /> + </a> + </> + ) + ) : ( + value + )} + </p> </div> <div> <Button @@ -113,18 +128,36 @@ export function Account() { </div> ))} </div> - <h3><Text id="app.settings.pages.account.account_management.title" /></h3> - <h5><Text id="app.settings.pages.account.account_management.description" /></h5> + <h3> + <Text id="app.settings.pages.account.account_management.title" /> + </h3> + <h5> + <Text id="app.settings.pages.account.account_management.description" /> + </h5> - <h3><Text id="app.settings.pages.account.2fa.title" /></h3> - <h5>Currently work in progress, see <a href="https://gitlab.insrt.uk/insert/rauth/-/issues/2" target="_blank">tracking issue here</a>.</h5> + <h3> + <Text id="app.settings.pages.account.2fa.title" /> + </h3> + <h5> + Currently work in progress, see{" "} + <a + href="https://gitlab.insrt.uk/insert/rauth/-/issues/2" + target="_blank"> + tracking issue here + </a> + . + </h5> {/*<h5><Text id="app.settings.pages.account.two_factor_auth.description" /></h5> <Button accent compact> <Text id="app.settings.pages.account.two_factor_auth.add_auth" /> </Button>*/} - <h3><Text id="app.settings.pages.account.manage.title" /></h3> - <h5><Text id="app.settings.pages.account.manage.description" /></h5> + <h3> + <Text id="app.settings.pages.account.manage.title" /> + </h3> + <h5> + <Text id="app.settings.pages.account.manage.description" /> + </h5> <div className={styles.buttons}> {/* <Button contrast> <Text id="app.settings.pages.account.manage.disable" /> diff --git a/src/pages/settings/panes/Sessions.tsx b/src/pages/settings/panes/Sessions.tsx index 2ca26bb4c97073140de60974de7ef81c2fd25eb9..489dea95b3ae7d249a321ffc3fd4ef972c252ba5 100644 --- a/src/pages/settings/panes/Sessions.tsx +++ b/src/pages/settings/panes/Sessions.tsx @@ -10,7 +10,6 @@ import { Safari, Windows, } from "@styled-icons/simple-icons"; - import relativeTime from "dayjs/plugin/relativeTime"; import { useHistory } from "react-router-dom"; import { decodeTime } from "ulid"; @@ -19,12 +18,12 @@ import styles from "./Panes.module.scss"; import { Text } from "preact-i18n"; import { useContext, useEffect, useState } from "preact/hooks"; +import { dayjs } from "../../../context/Locale"; import { AppContext } from "../../../context/revoltjs/RevoltClient"; import Button from "../../../components/ui/Button"; import Preloader from "../../../components/ui/Preloader"; import Tip from "../../../components/ui/Tip"; -import { dayjs } from "../../../context/Locale"; dayjs.extend(relativeTime); @@ -134,7 +133,12 @@ export function Sessions() { <div>{getSystemIcon(session)}</div> </div> <div className={styles.info}> - <input type="text" className={styles.name} value={session.friendly_name} autocomplete="off" /> + <input + type="text" + className={styles.name} + value={session.friendly_name} + autocomplete="off" + /> <span className={styles.time}> <Text id="app.settings.pages.sessions.created"