From a387d3c6aedab343a966018060d640364bb03f8e Mon Sep 17 00:00:00 2001 From: Paul Date: Fri, 3 Sep 2021 10:17:42 +0100 Subject: [PATCH 1/5] Use variables for scrollbar width. Update language definitions. --- external/lang | 2 +- .../common/messaging/bars/TypingIndicator.tsx | 2 +- src/styles/_elements.scss | 4 ++-- src/styles/_page.scss | 6 +++--- src/styles/_variables.scss | 15 ++------------- 5 files changed, 9 insertions(+), 20 deletions(-) diff --git a/external/lang b/external/lang index eb371618..3ff3cb0b 160000 --- a/external/lang +++ b/external/lang @@ -1 +1 @@ -Subproject commit eb3716182702af2747025e0ee171d6a1a4415fc7 +Subproject commit 3ff3cb0b3c0aa0060e3dd8e5efaca71fd828e530 diff --git a/src/components/common/messaging/bars/TypingIndicator.tsx b/src/components/common/messaging/bars/TypingIndicator.tsx index 5020e35c..31e9a10c 100644 --- a/src/components/common/messaging/bars/TypingIndicator.tsx +++ b/src/components/common/messaging/bars/TypingIndicator.tsx @@ -23,7 +23,7 @@ const Base = styled.div` user-select: none; align-items: center; flex-direction: row; - width: calc(100% - 3px); + width: calc(100% - var(--scrollbar-thickness)); color: var(--secondary-foreground); background: var(--secondary-background); } diff --git a/src/styles/_elements.scss b/src/styles/_elements.scss index d0f8e44a..3a18014c 100644 --- a/src/styles/_elements.scss +++ b/src/styles/_elements.scss @@ -4,8 +4,8 @@ } ::-webkit-scrollbar { - width: 3px; - height: 3px; + width: var(--scrollbar-thickness); + height: var(--scrollbar-thickness); } ::-webkit-scrollbar-track { diff --git a/src/styles/_page.scss b/src/styles/_page.scss index 26b8f349..268e9479 100644 --- a/src/styles/_page.scss +++ b/src/styles/_page.scss @@ -1,10 +1,10 @@ * { - text-rendering: optimizeLegibility !important; + text-rendering: optimizeLegibility !important; -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; + -moz-osx-font-smoothing: grayscale; - scrollbar-width: thin; box-sizing: border-box; + scrollbar-width: var(--scrollbar-thickness-ff); } html { diff --git a/src/styles/_variables.scss b/src/styles/_variables.scss index f1e9556d..f5ee7d64 100644 --- a/src/styles/_variables.scss +++ b/src/styles/_variables.scss @@ -21,6 +21,8 @@ --app-height: 100vh; --border-radius: 6px; --border-radius-half: 50%; + --scrollbar-thickness: 3px; + --scrollbar-thickness-ff: thin; --input-border-width: 2px; --textarea-padding: 16px; @@ -33,17 +35,4 @@ --attachment-max-text-width: 800px; --bottom-navigation-height: 50px; - - /** - * Experimental - */ - --background-rgb: ( - 25, - 25, - 25 - ); //THIS IS SO THAT WE CAN HAVE CUSTOM BACKGROUNDS FOR THE CLIENT, CONVERTS THE HEX TO AN RGB VALUE FROM --background - --background-rgba: rgba( - var(--background-rgb), - 0.8 - ); //make the opacity also customizable } From c302eade177eb349895b68c9ee37390d676baea3 Mon Sep 17 00:00:00 2001 From: Paul Date: Fri, 3 Sep 2021 10:30:27 +0100 Subject: [PATCH 2/5] Update source links from GitLab to GitHub. --- package.json | 2 +- src/components/common/messaging/attachments/TextFile.tsx | 4 ++-- src/pages/settings/Settings.tsx | 9 ++++----- src/pages/settings/panes/Account.tsx | 4 ++-- src/revision.ts | 3 +-- 5 files changed, 10 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index 5e2bc83e..9ed67f51 100644 --- a/package.json +++ b/package.json @@ -133,7 +133,7 @@ }, "name": "client", "main": "index.js", - "repository": "https://gitlab.insrt.uk/revolt/revite.git", + "repository": "https://github.com/revoltchat/revite.git", "author": "Paul ", "license": "MIT" } diff --git a/src/components/common/messaging/attachments/TextFile.tsx b/src/components/common/messaging/attachments/TextFile.tsx index 7477fe9d..1b78cd38 100644 --- a/src/components/common/messaging/attachments/TextFile.tsx +++ b/src/components/common/messaging/attachments/TextFile.tsx @@ -30,9 +30,9 @@ export default function TextFile({ attachment }: Props) { if (typeof content !== "undefined") return; if (loading) return; - if (attachment.size > 20_000) { + if (attachment.size > 100_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", + "This file is > 100 KB, for your sake I did not load it.\nSee tracking issue here for previews: https://github.com/revoltchat/revite/issues/35", ); return; } diff --git a/src/pages/settings/Settings.tsx b/src/pages/settings/Settings.tsx index c2754ed5..0b44170e 100644 --- a/src/pages/settings/Settings.tsx +++ b/src/pages/settings/Settings.tsx @@ -1,4 +1,4 @@ -import { Gitlab } from "@styled-icons/boxicons-logos"; +import { Github } from "@styled-icons/boxicons-logos"; import { Sync as SyncIcon, Globe, @@ -92,7 +92,6 @@ export default function Settings() { title: , }, { - id: "appearance", icon: , title: , @@ -184,11 +183,11 @@ export default function Settings() { custom={ <> - + @@ -221,7 +220,7 @@ export default function Settings() { { Two-factor authentication is currently work-in-progress, see{" "} {` `} - tracking issue here + v1 milestone here . diff --git a/src/revision.ts b/src/revision.ts index 11bcb374..e956dfd9 100644 --- a/src/revision.ts +++ b/src/revision.ts @@ -1,7 +1,6 @@ /* eslint-disable */ // Strings needs to be explictly stated here as they can cause type issues elsewhere. -export const REPO_URL: string = - "https://gitlab.insrt.uk/revolt/revite/-/commit"; +export const REPO_URL: string = "https://github.com/revoltchat/revite/commit"; export const GIT_REVISION: string = "__GIT_REVISION__"; export const GIT_BRANCH: string = "__GIT_BRANCH__"; From a08ad7aa0b09e10216bf24df15e7b3d5fa3bf05d Mon Sep 17 00:00:00 2001 From: Ryan Alexander <38785445+ryanalexander@users.noreply.github.com> Date: Fri, 3 Sep 2021 19:35:02 +1000 Subject: [PATCH 3/5] Rename "ios" & "fxios" to "Safari" and "Firefox" for browser name (#119) --- src/pages/login/forms/FormLogin.tsx | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/pages/login/forms/FormLogin.tsx b/src/pages/login/forms/FormLogin.tsx index b7d47fd2..dda21f87 100644 --- a/src/pages/login/forms/FormLogin.tsx +++ b/src/pages/login/forms/FormLogin.tsx @@ -1,11 +1,7 @@ -import { detect } from "detect-browser"; -import { useHistory } from "react-router-dom"; - -import { useContext } from "preact/hooks"; - -import { OperationsContext } from "../../../context/revoltjs/RevoltClient"; - import { Form } from "./Form"; +import { detect } from "detect-browser"; +import { useContext } from "preact/hooks"; +import { OperationsContext } from "../../../context/revoltjs/RevoltClient"; export function FormLogin() { const { login } = useContext(OperationsContext); @@ -14,15 +10,21 @@ export function FormLogin() { return (
{ + callback={async data => { const browser = detect(); let device_name; if (browser) { - const { name, os } = browser; + let { name } = browser; + const { os } = browser; if (window.isNative) { device_name = `Revolt Desktop on ${os}`; } else { - device_name = `${name} on ${os}`; + if(name === "ios") { + name = "safari"; + }else if(name === "fxios") { + name = "firefox"; + } + device_name = `${name} on ${os}`; } } else { device_name = "Unknown Device"; From a1cb72046cc8004f1be20a908edbd764d1399cf3 Mon Sep 17 00:00:00 2001 From: Paul Date: Fri, 3 Sep 2021 10:43:48 +0100 Subject: [PATCH 4/5] Fix and prettier incoming changes from PR #119. Cherry pick PR #130: don't show add friend button on banned / deleted accounts. Also account for this in context menu. --- .../intermediate/popovers/UserProfile.tsx | 19 +++++++++++++----- src/lib/ContextMenus.tsx | 9 ++++++++- src/pages/login/forms/FormLogin.tsx | 20 +++++++++++-------- 3 files changed, 34 insertions(+), 14 deletions(-) diff --git a/src/context/intermediate/popovers/UserProfile.tsx b/src/context/intermediate/popovers/UserProfile.tsx index be74782d..b20b66d8 100644 --- a/src/context/intermediate/popovers/UserProfile.tsx +++ b/src/context/intermediate/popovers/UserProfile.tsx @@ -196,6 +196,8 @@ export const UserProfile = observer( )} {!user.bot && + flags != 2 && + flags != 4 && (user.relationship === RelationshipStatus.Incoming || user.relationship === @@ -315,10 +317,14 @@ export const UserProfile = observer( content={ }> - { - window.open("https://weblate.insrt.uk/projects/revolt/web-app/", "_blank") - }} + { + window.open( + "https://weblate.insrt.uk/projects/revolt/web-app/", + "_blank", + ); + }} /> ) : ( @@ -343,7 +349,10 @@ export const UserProfile = observer( size={32} color="#efab44" onClick={() => { - window.open("https://insrt.uk/donate", "_blank") + window.open( + "https://insrt.uk/donate", + "_blank", + ); }} /> diff --git a/src/lib/ContextMenus.tsx b/src/lib/ContextMenus.tsx index 610cd6cd..f8feeeee 100644 --- a/src/lib/ContextMenus.tsx +++ b/src/lib/ContextMenus.tsx @@ -619,7 +619,14 @@ function ContextMenus(props: Props) { break; case RelationshipStatus.None: default: - actions = ["add_friend", "block_user"]; + if ( + (user.flags && 2) || + (user.flags && 4) + ) { + actions = ["block_user"]; + } else { + actions = ["add_friend", "block_user"]; + } } if (userPermissions & UserPermission.ViewProfile) { diff --git a/src/pages/login/forms/FormLogin.tsx b/src/pages/login/forms/FormLogin.tsx index dda21f87..ea7df0a7 100644 --- a/src/pages/login/forms/FormLogin.tsx +++ b/src/pages/login/forms/FormLogin.tsx @@ -1,8 +1,12 @@ -import { Form } from "./Form"; import { detect } from "detect-browser"; +import { useHistory } from "react-router-dom"; + import { useContext } from "preact/hooks"; + import { OperationsContext } from "../../../context/revoltjs/RevoltClient"; +import { Form } from "./Form"; + export function FormLogin() { const { login } = useContext(OperationsContext); const history = useHistory(); @@ -10,7 +14,7 @@ export function FormLogin() { return ( { + callback={async (data) => { const browser = detect(); let device_name; if (browser) { @@ -19,12 +23,12 @@ export function FormLogin() { if (window.isNative) { device_name = `Revolt Desktop on ${os}`; } else { - if(name === "ios") { - name = "safari"; - }else if(name === "fxios") { - name = "firefox"; - } - device_name = `${name} on ${os}`; + if (name === "ios") { + name = "safari"; + } else if (name === "fxios") { + name = "firefox"; + } + device_name = `${name} on ${os}`; } } else { device_name = "Unknown Device"; From bde8b58095ff858a51d87aede61190279f433144 Mon Sep 17 00:00:00 2001 From: Paul Date: Fri, 3 Sep 2021 10:46:52 +0100 Subject: [PATCH 5/5] Fix pointer style for badges. --- src/context/intermediate/popovers/UserProfile.module.scss | 1 - src/context/intermediate/popovers/UserProfile.tsx | 6 ++++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/context/intermediate/popovers/UserProfile.module.scss b/src/context/intermediate/popovers/UserProfile.module.scss index f3fb5ce7..2341364b 100644 --- a/src/context/intermediate/popovers/UserProfile.module.scss +++ b/src/context/intermediate/popovers/UserProfile.module.scss @@ -124,7 +124,6 @@ img { width: 32px; height: 32px; - cursor: pointer; } } diff --git a/src/context/intermediate/popovers/UserProfile.tsx b/src/context/intermediate/popovers/UserProfile.tsx index b20b66d8..2c20d3d6 100644 --- a/src/context/intermediate/popovers/UserProfile.tsx +++ b/src/context/intermediate/popovers/UserProfile.tsx @@ -319,6 +319,9 @@ export const UserProfile = observer( }> { window.open( "https://weblate.insrt.uk/projects/revolt/web-app/", @@ -348,6 +351,9 @@ export const UserProfile = observer( { window.open( "https://insrt.uk/donate",