mirror of
https://github.com/revoltchat/revite.git
synced 2024-11-13 18:59:22 -05:00
Format code.
This commit is contained in:
parent
1fcf4df1ed
commit
67d3fb35a4
27 changed files with 188 additions and 116 deletions
|
@ -3,11 +3,12 @@ import { decodeTime } from "ulid";
|
||||||
|
|
||||||
import { Text } from "preact-i18n";
|
import { Text } from "preact-i18n";
|
||||||
|
|
||||||
|
import { useDictionary } from "../../../lib/i18n";
|
||||||
|
|
||||||
|
import { dayjs } from "../../../context/Locale";
|
||||||
import { MessageObject } from "../../../context/revoltjs/util";
|
import { MessageObject } from "../../../context/revoltjs/util";
|
||||||
|
|
||||||
import Tooltip from "../Tooltip";
|
import Tooltip from "../Tooltip";
|
||||||
import { useDictionary } from "../../../lib/i18n";
|
|
||||||
import { dayjs } from "../../../context/Locale";
|
|
||||||
|
|
||||||
export interface BaseMessageProps {
|
export interface BaseMessageProps {
|
||||||
head?: boolean;
|
head?: boolean;
|
||||||
|
@ -179,7 +180,9 @@ export function MessageDetail({
|
||||||
<>
|
<>
|
||||||
<time className="copyTime">
|
<time className="copyTime">
|
||||||
<i className="copyBracket">[</i>
|
<i className="copyBracket">[</i>
|
||||||
{dayjs(decodeTime(message._id)).format(dict.dayjs.timeFormat)}
|
{dayjs(decodeTime(message._id)).format(
|
||||||
|
dict.dayjs.timeFormat,
|
||||||
|
)}
|
||||||
<i className="copyBracket">]</i>
|
<i className="copyBracket">]</i>
|
||||||
</time>
|
</time>
|
||||||
<span className="edited">
|
<span className="edited">
|
||||||
|
@ -194,7 +197,9 @@ export function MessageDetail({
|
||||||
<>
|
<>
|
||||||
<time>
|
<time>
|
||||||
<i className="copyBracket">[</i>
|
<i className="copyBracket">[</i>
|
||||||
{dayjs(decodeTime(message._id)).format(dict.dayjs.timeFormat)}
|
{dayjs(decodeTime(message._id)).format(
|
||||||
|
dict.dayjs.timeFormat,
|
||||||
|
)}
|
||||||
<i className="copyBracket">]</i>
|
<i className="copyBracket">]</i>
|
||||||
</time>
|
</time>
|
||||||
</>
|
</>
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { Send, HappyAlt, ShieldX } from "@styled-icons/boxicons-solid";
|
import { Send, HappyAlt, ShieldX } from "@styled-icons/boxicons-solid";
|
||||||
|
import { Styleshare } from "@styled-icons/simple-icons";
|
||||||
import Axios, { CancelTokenSource } from "axios";
|
import Axios, { CancelTokenSource } from "axios";
|
||||||
import { Channel } from "revolt.js";
|
import { Channel } from "revolt.js";
|
||||||
import { ChannelPermission } from "revolt.js/dist/api/permissions";
|
import { ChannelPermission } from "revolt.js/dist/api/permissions";
|
||||||
|
@ -39,7 +40,6 @@ import AutoComplete, { useAutoComplete } from "../AutoComplete";
|
||||||
import { PermissionTooltip } from "../Tooltip";
|
import { PermissionTooltip } from "../Tooltip";
|
||||||
import FilePreview from "./bars/FilePreview";
|
import FilePreview from "./bars/FilePreview";
|
||||||
import ReplyBar from "./bars/ReplyBar";
|
import ReplyBar from "./bars/ReplyBar";
|
||||||
import { Styleshare } from "@styled-icons/simple-icons";
|
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
channel: Channel;
|
channel: Channel;
|
||||||
|
@ -111,7 +111,7 @@ const Action = styled.div`
|
||||||
export const CAN_UPLOAD_AT_ONCE = 4;
|
export const CAN_UPLOAD_AT_ONCE = 4;
|
||||||
|
|
||||||
export default function MessageBox({ channel }: Props) {
|
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>({
|
const [uploadState, setUploadState] = useState<UploadState>({
|
||||||
type: "none",
|
type: "none",
|
||||||
|
@ -144,7 +144,7 @@ export default function MessageBox({ channel }: Props) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function setMessage(content?: string) {
|
function setMessage(content?: string) {
|
||||||
setDraft(content ?? '');
|
setDraft(content ?? "");
|
||||||
|
|
||||||
if (content) {
|
if (content) {
|
||||||
dispatch({
|
dispatch({
|
||||||
|
|
|
@ -100,14 +100,16 @@ export default function AttachmentActions({ attachment }: Props) {
|
||||||
<File size={24} className={styles.iconType} />
|
<File size={24} className={styles.iconType} />
|
||||||
<span className={styles.filename}>{filename}</span>
|
<span className={styles.filename}>{filename}</span>
|
||||||
<span className={styles.filesize}>{filesize}</span>
|
<span className={styles.filesize}>{filesize}</span>
|
||||||
{ metadata.type === 'Text' && <a
|
{metadata.type === "Text" && (
|
||||||
|
<a
|
||||||
href={open_url}
|
href={open_url}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
className={styles.externalType}>
|
className={styles.externalType}>
|
||||||
<IconButton>
|
<IconButton>
|
||||||
<LinkExternal size={24} />
|
<LinkExternal size={24} />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</a> }
|
</a>
|
||||||
|
)}
|
||||||
<a
|
<a
|
||||||
href={download_url}
|
href={download_url}
|
||||||
className={styles.downloadIcon}
|
className={styles.downloadIcon}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { Reply, File } from "@styled-icons/boxicons-regular";
|
import { Reply, File } from "@styled-icons/boxicons-regular";
|
||||||
|
import { SYSTEM_USER_ID } from "revolt.js";
|
||||||
import styled, { css } from "styled-components";
|
import styled, { css } from "styled-components";
|
||||||
|
|
||||||
import { Text } from "preact-i18n";
|
import { Text } from "preact-i18n";
|
||||||
|
@ -9,7 +10,6 @@ import { useUser } from "../../../../context/revoltjs/hooks";
|
||||||
|
|
||||||
import Markdown from "../../../markdown/Markdown";
|
import Markdown from "../../../markdown/Markdown";
|
||||||
import UserShort from "../../user/UserShort";
|
import UserShort from "../../user/UserShort";
|
||||||
import { SYSTEM_USER_ID } from "revolt.js";
|
|
||||||
import { SystemMessage } from "../SystemMessage";
|
import { SystemMessage } from "../SystemMessage";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
|
@ -86,13 +86,14 @@ export function MessageReply({ index, channel, id }: Props) {
|
||||||
{message.attachments && message.attachments.length > 0 && (
|
{message.attachments && message.attachments.length > 0 && (
|
||||||
<File size={16} />
|
<File size={16} />
|
||||||
)}
|
)}
|
||||||
{ message.author === SYSTEM_USER_ID ?
|
{message.author === SYSTEM_USER_ID ? (
|
||||||
<SystemMessage message={message} /> :
|
<SystemMessage message={message} />
|
||||||
|
) : (
|
||||||
<Markdown
|
<Markdown
|
||||||
disallowBigEmoji
|
disallowBigEmoji
|
||||||
content={(message.content as string).replace(/\n/g, " ")}
|
content={(message.content as string).replace(/\n/g, " ")}
|
||||||
/>
|
/>
|
||||||
}
|
)}
|
||||||
</ReplyBase>
|
</ReplyBase>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,9 @@ export default function TextFile({ attachment }: Props) {
|
||||||
if (loading) return;
|
if (loading) return;
|
||||||
|
|
||||||
if (attachment.size > 20_000) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ import {
|
||||||
File,
|
File,
|
||||||
XCircle,
|
XCircle,
|
||||||
} from "@styled-icons/boxicons-regular";
|
} from "@styled-icons/boxicons-regular";
|
||||||
|
import { SYSTEM_USER_ID } from "revolt.js";
|
||||||
import styled from "styled-components";
|
import styled from "styled-components";
|
||||||
|
|
||||||
import { Text } from "preact-i18n";
|
import { Text } from "preact-i18n";
|
||||||
|
@ -20,9 +21,8 @@ import IconButton from "../../../ui/IconButton";
|
||||||
|
|
||||||
import Markdown from "../../../markdown/Markdown";
|
import Markdown from "../../../markdown/Markdown";
|
||||||
import UserShort from "../../user/UserShort";
|
import UserShort from "../../user/UserShort";
|
||||||
import { ReplyBase } from "../attachments/MessageReply";
|
|
||||||
import { SystemMessage } from "../SystemMessage";
|
import { SystemMessage } from "../SystemMessage";
|
||||||
import { SYSTEM_USER_ID } from "revolt.js";
|
import { ReplyBase } from "../attachments/MessageReply";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
channel: string;
|
channel: string;
|
||||||
|
@ -102,13 +102,16 @@ export default function ReplyBar({ channel, replies, setReplies }: Props) {
|
||||||
message.attachments.length > 0 && (
|
message.attachments.length > 0 && (
|
||||||
<File size={16} />
|
<File size={16} />
|
||||||
)}
|
)}
|
||||||
{ message.author === SYSTEM_USER_ID ?
|
{message.author === SYSTEM_USER_ID ? (
|
||||||
<SystemMessage message={message} /> :
|
<SystemMessage message={message} />
|
||||||
|
) : (
|
||||||
<Markdown
|
<Markdown
|
||||||
disallowBigEmoji
|
disallowBigEmoji
|
||||||
content={(message.content as string).replace(/\n/g, " ")}
|
content={(
|
||||||
|
message.content as string
|
||||||
|
).replace(/\n/g, " ")}
|
||||||
/>
|
/>
|
||||||
}
|
)}
|
||||||
</ReplyBase>
|
</ReplyBase>
|
||||||
<span class="actions">
|
<span class="actions">
|
||||||
<IconButton
|
<IconButton
|
||||||
|
|
|
@ -233,10 +233,9 @@ export function ServerMemberSidebar({
|
||||||
<GenericSidebarBase>
|
<GenericSidebarBase>
|
||||||
<GenericSidebarList>
|
<GenericSidebarList>
|
||||||
<ChannelDebugInfo id={channel._id} />
|
<ChannelDebugInfo id={channel._id} />
|
||||||
<div>
|
<div>{!members && <Preloader type="ring" />}</div>
|
||||||
{!members && <Preloader type="ring" />}
|
{members && (
|
||||||
</div>
|
<Category
|
||||||
{ members && <Category
|
|
||||||
variant="uniform"
|
variant="uniform"
|
||||||
text={
|
text={
|
||||||
<span>
|
<span>
|
||||||
|
@ -244,7 +243,8 @@ export function ServerMemberSidebar({
|
||||||
{users.length}
|
{users.length}
|
||||||
</span>
|
</span>
|
||||||
}
|
}
|
||||||
/> }
|
/>
|
||||||
|
)}
|
||||||
{members && users.length === 0 && <img src={placeholderSVG} />}
|
{members && users.length === 0 && <img src={placeholderSVG} />}
|
||||||
{users.map(
|
{users.map(
|
||||||
(user) =>
|
(user) =>
|
||||||
|
|
|
@ -8,7 +8,8 @@ interface Props {
|
||||||
readonly error?: boolean;
|
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>`
|
export default styled.button<Props>`
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
|
@ -18,7 +19,7 @@ export default styled.button<Props>`
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
padding: 2px 16px;
|
padding: 2px 16px;
|
||||||
font-size: .875rem;
|
font-size: 0.875rem;
|
||||||
font-family: inherit;
|
font-family: inherit;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
|
|
||||||
|
@ -69,7 +70,7 @@ export default styled.button<Props>`
|
||||||
|
|
||||||
&:disabled {
|
&:disabled {
|
||||||
cursor: not-allowed;
|
cursor: not-allowed;
|
||||||
opacity: .5;
|
opacity: 0.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
&:active {
|
&:active {
|
||||||
|
|
|
@ -2,8 +2,8 @@ import { Check } from "@styled-icons/boxicons-regular";
|
||||||
import { Palette } from "@styled-icons/boxicons-solid";
|
import { Palette } from "@styled-icons/boxicons-solid";
|
||||||
import styled, { css } from "styled-components";
|
import styled, { css } from "styled-components";
|
||||||
|
|
||||||
import { useRef } from "preact/hooks";
|
|
||||||
import { RefObject } from "preact";
|
import { RefObject } from "preact";
|
||||||
|
import { useRef } from "preact/hooks";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
value: string;
|
value: string;
|
||||||
|
|
|
@ -10,7 +10,7 @@ export default styled.select`
|
||||||
border: none;
|
border: none;
|
||||||
outline: 2px solid transparent;
|
outline: 2px solid transparent;
|
||||||
transition: outline-color 0.2s ease-in-out;
|
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;
|
cursor: pointer;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
import styled, { css } from "styled-components";
|
import styled, { css } from "styled-components";
|
||||||
|
|
||||||
import { dayjs } from "../../context/Locale";
|
import { dayjs } from "../../context/Locale";
|
||||||
|
|
||||||
const Base = styled.div<{ unread?: boolean }>`
|
const Base = styled.div<{ unread?: boolean }>`
|
||||||
|
|
|
@ -49,7 +49,9 @@ export default styled.div<Props>`
|
||||||
}
|
}
|
||||||
`}
|
`}
|
||||||
|
|
||||||
${(props) => props.rotate && css`
|
${(props) =>
|
||||||
|
props.rotate &&
|
||||||
|
css`
|
||||||
svg {
|
svg {
|
||||||
transform: rotateZ(${props.rotate});
|
transform: rotateZ(${props.rotate});
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ export default styled.input<Props>`
|
||||||
border: none;
|
border: none;
|
||||||
outline: 2px solid transparent;
|
outline: 2px solid transparent;
|
||||||
transition: outline-color 0.2s ease-in-out;
|
transition: outline-color 0.2s ease-in-out;
|
||||||
transition: box-shadow .2s ease-in-out;
|
transition: box-shadow 0.2s ease-in-out;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background: var(--secondary-background);
|
background: var(--secondary-background);
|
||||||
|
|
|
@ -99,10 +99,10 @@ const ModalActions = styled.div`
|
||||||
background: var(--secondary-background);
|
background: var(--secondary-background);
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export type Action = Omit<ButtonProps, 'onClick'> & {
|
export type Action = Omit<ButtonProps, "onClick"> & {
|
||||||
confirmation?: boolean;
|
confirmation?: boolean;
|
||||||
onClick: () => void;
|
onClick: () => void;
|
||||||
}
|
};
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
children?: Children;
|
children?: Children;
|
||||||
|
@ -177,9 +177,9 @@ export default function Modal(props: Props) {
|
||||||
{content}
|
{content}
|
||||||
{props.actions && (
|
{props.actions && (
|
||||||
<ModalActions>
|
<ModalActions>
|
||||||
{props.actions.map((x) =>
|
{props.actions.map((x) => (
|
||||||
<Button {...x} disabled={props.disabled} />
|
<Button {...x} disabled={props.disabled} />
|
||||||
)}
|
))}
|
||||||
</ModalActions>
|
</ModalActions>
|
||||||
)}
|
)}
|
||||||
</ModalContainer>
|
</ModalContainer>
|
||||||
|
|
|
@ -17,8 +17,9 @@ export default styled.textarea<TextAreaProps>`
|
||||||
display: block;
|
display: block;
|
||||||
color: var(--foreground);
|
color: var(--foreground);
|
||||||
background: var(--secondary-background);
|
background: var(--secondary-background);
|
||||||
padding: ${(props) => (props.padding) ?? 'var(--textarea-padding)'};
|
padding: ${(props) => props.padding ?? "var(--textarea-padding)"};
|
||||||
line-height: ${(props) => (props.lineHeight) ?? 'var(--textarea-line-height)'};
|
line-height: ${(props) =>
|
||||||
|
props.lineHeight ?? "var(--textarea-line-height)"};
|
||||||
|
|
||||||
${(props) =>
|
${(props) =>
|
||||||
props.hideBorder &&
|
props.hideBorder &&
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
import dayJS from "dayjs";
|
import dayJS from "dayjs";
|
||||||
export const dayjs = dayJS;
|
|
||||||
|
|
||||||
import calendar from "dayjs/plugin/calendar";
|
import calendar from "dayjs/plugin/calendar";
|
||||||
import format from "dayjs/plugin/localizedFormat";
|
import format from "dayjs/plugin/localizedFormat";
|
||||||
import update from "dayjs/plugin/updateLocale";
|
import update from "dayjs/plugin/updateLocale";
|
||||||
|
@ -13,6 +11,8 @@ import { connectState } from "../redux/connector";
|
||||||
|
|
||||||
import definition from "../../external/lang/en.json";
|
import definition from "../../external/lang/en.json";
|
||||||
|
|
||||||
|
export const dayjs = dayJS;
|
||||||
|
|
||||||
dayjs.extend(calendar);
|
dayjs.extend(calendar);
|
||||||
dayjs.extend(format);
|
dayjs.extend(format);
|
||||||
dayjs.extend(update);
|
dayjs.extend(update);
|
||||||
|
@ -163,7 +163,7 @@ function Locale({ children, locale }: Props) {
|
||||||
dayjs["timeFormat"] = twelvehour ? "hh:mm A" : "HH:mm";
|
dayjs["timeFormat"] = twelvehour ? "hh:mm A" : "HH:mm";
|
||||||
|
|
||||||
Object.keys(dayjs)
|
Object.keys(dayjs)
|
||||||
.filter((k) => typeof dayjs[k] === 'string')
|
.filter((k) => typeof dayjs[k] === "string")
|
||||||
.forEach(
|
.forEach(
|
||||||
(k) =>
|
(k) =>
|
||||||
(dayjs[k] = dayjs[k].replace(
|
(dayjs[k] = dayjs[k].replace(
|
||||||
|
@ -175,7 +175,9 @@ function Locale({ children, locale }: Props) {
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
dayjs.updateLocale("en", { calendar: { ...definition.dayjs, sameDay: 'sussy baka' } });
|
dayjs.updateLocale("en", {
|
||||||
|
calendar: { ...definition.dayjs, sameDay: "sussy baka" },
|
||||||
|
});
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (locale === "en") {
|
if (locale === "en") {
|
||||||
const defn = transformLanguage(definition);
|
const defn = transformLanguage(definition);
|
||||||
|
|
|
@ -155,7 +155,7 @@ export function SpecialInputModal(props: SpecialProps) {
|
||||||
status: {
|
status: {
|
||||||
...client.user?.status,
|
...client.user?.status,
|
||||||
text: text.trim().length > 0 ? text : undefined,
|
text: text.trim().length > 0 ? text : undefined,
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -256,7 +256,9 @@ export function SpecialPromptModal(props: SpecialProps) {
|
||||||
question={<Text id={`app.context_menu.create_invite`} />}
|
question={<Text id={`app.context_menu.create_invite`} />}
|
||||||
actions={[
|
actions={[
|
||||||
{
|
{
|
||||||
children: <Text id="app.special.modals.actions.ok" />,
|
children: (
|
||||||
|
<Text id="app.special.modals.actions.ok" />
|
||||||
|
),
|
||||||
confirmation: true,
|
confirmation: true,
|
||||||
onClick: onClose,
|
onClick: onClose,
|
||||||
},
|
},
|
||||||
|
@ -292,7 +294,9 @@ export function SpecialPromptModal(props: SpecialProps) {
|
||||||
question={<Text id={`app.context_menu.kick_member`} />}
|
question={<Text id={`app.context_menu.kick_member`} />}
|
||||||
actions={[
|
actions={[
|
||||||
{
|
{
|
||||||
children: <Text id="app.special.modals.actions.kick" />,
|
children: (
|
||||||
|
<Text id="app.special.modals.actions.kick" />
|
||||||
|
),
|
||||||
contrast: true,
|
contrast: true,
|
||||||
error: true,
|
error: true,
|
||||||
confirmation: true,
|
confirmation: true,
|
||||||
|
@ -342,7 +346,9 @@ export function SpecialPromptModal(props: SpecialProps) {
|
||||||
question={<Text id={`app.context_menu.ban_member`} />}
|
question={<Text id={`app.context_menu.ban_member`} />}
|
||||||
actions={[
|
actions={[
|
||||||
{
|
{
|
||||||
children: <Text id="app.special.modals.actions.ban" />,
|
children: (
|
||||||
|
<Text id="app.special.modals.actions.ban" />
|
||||||
|
),
|
||||||
contrast: true,
|
contrast: true,
|
||||||
error: true,
|
error: true,
|
||||||
confirmation: true,
|
confirmation: true,
|
||||||
|
|
|
@ -1,10 +1,5 @@
|
||||||
import {
|
|
||||||
Envelope,
|
|
||||||
Edit,
|
|
||||||
UserPlus,
|
|
||||||
Shield
|
|
||||||
} from "@styled-icons/boxicons-solid";
|
|
||||||
import { Money } from "@styled-icons/boxicons-regular";
|
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 { Link, useHistory } from "react-router-dom";
|
||||||
import { Users } from "revolt.js/dist/api/objects";
|
import { Users } from "revolt.js/dist/api/objects";
|
||||||
import { UserPermission } from "revolt.js/dist/api/permissions";
|
import { UserPermission } from "revolt.js/dist/api/permissions";
|
||||||
|
|
|
@ -277,7 +277,7 @@ export function FileUploader(props: Props) {
|
||||||
if (attached) return remove();
|
if (attached) return remove();
|
||||||
onClick();
|
onClick();
|
||||||
}}
|
}}
|
||||||
rotate={uploading || attached ? '45deg' : undefined}>
|
rotate={uploading || attached ? "45deg" : undefined}>
|
||||||
<Plus size={size} />
|
<Plus size={size} />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
import styled from "styled-components";
|
import styled from "styled-components";
|
||||||
|
|
||||||
|
import { RefObject } from "preact";
|
||||||
import { useEffect, useLayoutEffect, useRef } from "preact/hooks";
|
import { useEffect, useLayoutEffect, useRef } from "preact/hooks";
|
||||||
|
|
||||||
import TextArea, { TextAreaProps } from "../components/ui/TextArea";
|
import TextArea, { TextAreaProps } from "../components/ui/TextArea";
|
||||||
|
|
||||||
import { internalSubscribe } from "./eventEmitter";
|
import { internalSubscribe } from "./eventEmitter";
|
||||||
import { isTouchscreenDevice } from "./isTouchscreenDevice";
|
import { isTouchscreenDevice } from "./isTouchscreenDevice";
|
||||||
import { RefObject } from "preact";
|
|
||||||
|
|
||||||
type TextAreaAutoSizeProps = Omit<
|
type TextAreaAutoSizeProps = Omit<
|
||||||
JSX.HTMLAttributes<HTMLTextAreaElement>,
|
JSX.HTMLAttributes<HTMLTextAreaElement>,
|
||||||
|
@ -30,7 +30,7 @@ const Container = styled.div`
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const Ghost = styled.div<{ lineHeight: string, maxRows: number }>`
|
const Ghost = styled.div<{ lineHeight: string; maxRows: number }>`
|
||||||
flex: 0;
|
flex: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
@ -47,7 +47,9 @@ const Ghost = styled.div<{ lineHeight: string, maxRows: number }>`
|
||||||
font-size: var(--text-size);
|
font-size: var(--text-size);
|
||||||
line-height: ${(props) => props.lineHeight};
|
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(() => {
|
useLayoutEffect(() => {
|
||||||
if (ref.current && ghost.current) {
|
if (ref.current && ghost.current) {
|
||||||
ref.current.style.height = ghost.current.clientHeight + 'px';
|
ref.current.style.height = ghost.current.clientHeight + "px";
|
||||||
}
|
}
|
||||||
}, [ghost, props.value]);
|
}, [ghost, props.value]);
|
||||||
|
|
||||||
|
@ -139,7 +141,9 @@ export default function TextAreaAutoSize(props: TextAreaAutoSizeProps) {
|
||||||
}}
|
}}
|
||||||
{...textAreaProps}
|
{...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 }}>
|
<div ref={ghost} style={{ padding }}>
|
||||||
{props.value
|
{props.value
|
||||||
? props.value
|
? props.value
|
||||||
|
|
|
@ -15,11 +15,11 @@ interface Props {
|
||||||
export interface Dictionary {
|
export interface Dictionary {
|
||||||
dayjs: {
|
dayjs: {
|
||||||
defaults: {
|
defaults: {
|
||||||
twelvehour: 'yes' | 'no';
|
twelvehour: "yes" | "no";
|
||||||
separator: string;
|
separator: string;
|
||||||
date: "traditional" | "simplified" | "ISO8601";
|
date: "traditional" | "simplified" | "ISO8601";
|
||||||
},
|
};
|
||||||
timeFormat: string
|
timeFormat: string;
|
||||||
};
|
};
|
||||||
[key: string]: Object | string;
|
[key: string]: Object | string;
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,10 +95,11 @@ export function MessageArea({ id }: Props) {
|
||||||
animateScroll.scrollTo(
|
animateScroll.scrollTo(
|
||||||
Math.max(
|
Math.max(
|
||||||
101,
|
101,
|
||||||
ref.current ? (ref.current.scrollTop +
|
ref.current
|
||||||
|
? ref.current.scrollTop +
|
||||||
(ref.current.scrollHeight -
|
(ref.current.scrollHeight -
|
||||||
scrollState.current.previousHeight))
|
scrollState.current.previousHeight)
|
||||||
: 101
|
: 101,
|
||||||
),
|
),
|
||||||
{
|
{
|
||||||
container: ref.current,
|
container: ref.current,
|
||||||
|
@ -128,7 +129,8 @@ export function MessageArea({ id }: Props) {
|
||||||
ref.current?.clientHeight
|
ref.current?.clientHeight
|
||||||
: true;
|
: 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.
|
// ? Handle events from renderer.
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
|
@ -121,7 +121,10 @@ export default function Friends() {
|
||||||
*/}
|
*/}
|
||||||
</div>
|
</div>
|
||||||
</Header>
|
</Header>
|
||||||
<div className={styles.list} data-empty={isEmpty} data-mobile={isTouchscreenDevice}>
|
<div
|
||||||
|
className={styles.list}
|
||||||
|
data-empty={isEmpty}
|
||||||
|
data-mobile={isTouchscreenDevice}>
|
||||||
{isEmpty && (
|
{isEmpty && (
|
||||||
<>
|
<>
|
||||||
<img src="https://img.insrt.uk/xexu7/XOPoBUTI47.png/raw" />
|
<img src="https://img.insrt.uk/xexu7/XOPoBUTI47.png/raw" />
|
||||||
|
|
|
@ -85,7 +85,10 @@ export function GenericSettings({
|
||||||
<>
|
<>
|
||||||
{showExitButton && (
|
{showExitButton && (
|
||||||
<IconButton onClick={exitSettings}>
|
<IconButton onClick={exitSettings}>
|
||||||
<X size={27} style={{marginInlineEnd: "8px"}} />
|
<X
|
||||||
|
size={27}
|
||||||
|
style={{ marginInlineEnd: "8px" }}
|
||||||
|
/>
|
||||||
</IconButton>
|
</IconButton>
|
||||||
)}
|
)}
|
||||||
<Text id="app.settings.title" />
|
<Text id="app.settings.title" />
|
||||||
|
@ -93,7 +96,10 @@ export function GenericSettings({
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<IconButton onClick={() => switchPage()}>
|
<IconButton onClick={() => switchPage()}>
|
||||||
<ArrowBack size={24} style={{marginInlineEnd: "10px"}} />
|
<ArrowBack
|
||||||
|
size={24}
|
||||||
|
style={{ marginInlineEnd: "10px" }}
|
||||||
|
/>
|
||||||
</IconButton>
|
</IconButton>
|
||||||
<Text
|
<Text
|
||||||
id={`app.settings.${category}.${page}.title`}
|
id={`app.settings.${category}.${page}.title`}
|
||||||
|
|
|
@ -14,10 +14,10 @@ import {
|
||||||
} from "../../../context/revoltjs/RevoltClient";
|
} from "../../../context/revoltjs/RevoltClient";
|
||||||
import { useForceUpdate, useSelf } from "../../../context/revoltjs/hooks";
|
import { useForceUpdate, useSelf } from "../../../context/revoltjs/hooks";
|
||||||
|
|
||||||
|
import Tooltip from "../../../components/common/Tooltip";
|
||||||
import UserIcon from "../../../components/common/user/UserIcon";
|
import UserIcon from "../../../components/common/user/UserIcon";
|
||||||
import Button from "../../../components/ui/Button";
|
import Button from "../../../components/ui/Button";
|
||||||
import Overline from "../../../components/ui/Overline";
|
import Overline from "../../../components/ui/Overline";
|
||||||
import Tooltip from "../../../components/common/Tooltip";
|
|
||||||
import Tip from "../../../components/ui/Tip";
|
import Tip from "../../../components/ui/Tip";
|
||||||
|
|
||||||
export function Account() {
|
export function Account() {
|
||||||
|
@ -65,7 +65,10 @@ export function Account() {
|
||||||
<div className={styles.userDetail}>
|
<div className={styles.userDetail}>
|
||||||
<div className={styles.username}>@{user.username}</div>
|
<div className={styles.username}>@{user.username}</div>
|
||||||
<div className={styles.userid}>
|
<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} />
|
<HelpCircle size={16} />
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
<Tooltip content={<Text id="app.special.copy" />}>
|
<Tooltip content={<Text id="app.special.copy" />}>
|
||||||
|
@ -90,13 +93,25 @@ export function Account() {
|
||||||
<div className={styles.subtext}>
|
<div className={styles.subtext}>
|
||||||
<Text id={`login.${field}`} />
|
<Text id={`login.${field}`} />
|
||||||
</div>
|
</div>
|
||||||
<p>{
|
<p>
|
||||||
field === 'email' ?
|
{field === "email" ? (
|
||||||
(revealEmail ? value :
|
revealEmail ? (
|
||||||
<>***********@{value.split('@').pop()} <a onClick={() => setRevealEmail(true)}>
|
value
|
||||||
<Text id="app.special.modals.actions.reveal" /></a></>)
|
) : (
|
||||||
: value
|
<>
|
||||||
}</p>
|
***********@{value.split("@").pop()}{" "}
|
||||||
|
<a
|
||||||
|
onClick={() =>
|
||||||
|
setRevealEmail(true)
|
||||||
|
}>
|
||||||
|
<Text id="app.special.modals.actions.reveal" />
|
||||||
|
</a>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
) : (
|
||||||
|
value
|
||||||
|
)}
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<Button
|
<Button
|
||||||
|
@ -113,18 +128,36 @@ export function Account() {
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
<h3><Text id="app.settings.pages.account.account_management.title" /></h3>
|
<h3>
|
||||||
<h5><Text id="app.settings.pages.account.account_management.description" /></h5>
|
<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>
|
<h3>
|
||||||
<h5>Currently work in progress, see <a href="https://gitlab.insrt.uk/insert/rauth/-/issues/2" target="_blank">tracking issue here</a>.</h5>
|
<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>
|
{/*<h5><Text id="app.settings.pages.account.two_factor_auth.description" /></h5>
|
||||||
<Button accent compact>
|
<Button accent compact>
|
||||||
<Text id="app.settings.pages.account.two_factor_auth.add_auth" />
|
<Text id="app.settings.pages.account.two_factor_auth.add_auth" />
|
||||||
</Button>*/}
|
</Button>*/}
|
||||||
|
|
||||||
<h3><Text id="app.settings.pages.account.manage.title" /></h3>
|
<h3>
|
||||||
<h5><Text id="app.settings.pages.account.manage.description" /></h5>
|
<Text id="app.settings.pages.account.manage.title" />
|
||||||
|
</h3>
|
||||||
|
<h5>
|
||||||
|
<Text id="app.settings.pages.account.manage.description" />
|
||||||
|
</h5>
|
||||||
<div className={styles.buttons}>
|
<div className={styles.buttons}>
|
||||||
{/* <Button contrast>
|
{/* <Button contrast>
|
||||||
<Text id="app.settings.pages.account.manage.disable" />
|
<Text id="app.settings.pages.account.manage.disable" />
|
||||||
|
|
|
@ -10,7 +10,6 @@ import {
|
||||||
Safari,
|
Safari,
|
||||||
Windows,
|
Windows,
|
||||||
} from "@styled-icons/simple-icons";
|
} from "@styled-icons/simple-icons";
|
||||||
|
|
||||||
import relativeTime from "dayjs/plugin/relativeTime";
|
import relativeTime from "dayjs/plugin/relativeTime";
|
||||||
import { useHistory } from "react-router-dom";
|
import { useHistory } from "react-router-dom";
|
||||||
import { decodeTime } from "ulid";
|
import { decodeTime } from "ulid";
|
||||||
|
@ -19,12 +18,12 @@ import styles from "./Panes.module.scss";
|
||||||
import { Text } from "preact-i18n";
|
import { Text } from "preact-i18n";
|
||||||
import { useContext, useEffect, useState } from "preact/hooks";
|
import { useContext, useEffect, useState } from "preact/hooks";
|
||||||
|
|
||||||
|
import { dayjs } from "../../../context/Locale";
|
||||||
import { AppContext } from "../../../context/revoltjs/RevoltClient";
|
import { AppContext } from "../../../context/revoltjs/RevoltClient";
|
||||||
|
|
||||||
import Button from "../../../components/ui/Button";
|
import Button from "../../../components/ui/Button";
|
||||||
import Preloader from "../../../components/ui/Preloader";
|
import Preloader from "../../../components/ui/Preloader";
|
||||||
import Tip from "../../../components/ui/Tip";
|
import Tip from "../../../components/ui/Tip";
|
||||||
import { dayjs } from "../../../context/Locale";
|
|
||||||
|
|
||||||
dayjs.extend(relativeTime);
|
dayjs.extend(relativeTime);
|
||||||
|
|
||||||
|
@ -134,7 +133,12 @@ export function Sessions() {
|
||||||
<div>{getSystemIcon(session)}</div>
|
<div>{getSystemIcon(session)}</div>
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.info}>
|
<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}>
|
<span className={styles.time}>
|
||||||
<Text
|
<Text
|
||||||
id="app.settings.pages.sessions.created"
|
id="app.settings.pages.sessions.created"
|
||||||
|
|
Loading…
Reference in a new issue