From 33baf90d347a65d818bf4982f07ba1da41a5b73b Mon Sep 17 00:00:00 2001 From: Paul Date: Sun, 1 Aug 2021 20:29:36 +0100 Subject: [PATCH 1/7] Fix iOS touch. --- external/lang | 2 +- index.html | 109 +++++++++++++++++++++++++++++++++++--------------- 2 files changed, 78 insertions(+), 33 deletions(-) diff --git a/external/lang b/external/lang index e03c9f3a..8a9c21da 160000 --- a/external/lang +++ b/external/lang @@ -1 +1 @@ -Subproject commit e03c9f3a9ef39b6d93a5890a3ee1a64cfb1ffec4 +Subproject commit 8a9c21da8527b9609404ad64205f6b876c9f53d2 diff --git a/index.html b/index.html index 9bef75d3..70ebae87 100644 --- a/index.html +++ b/index.html @@ -1,37 +1,82 @@ - - - Revolt - + + + Revolt + - - - + + - - - + + + - - - - - - - - - - - - - -
- - - - \ No newline at end of file + + + + + + + + + + + + + +
+ + + + From 591d21c28bd367598b01401933c33898bc82dc05 Mon Sep 17 00:00:00 2001 From: Paul Date: Sun, 1 Aug 2021 17:56:38 +0100 Subject: [PATCH 2/7] Don't show tooltip / hover when no update. --- src/components/common/UpdateIndicator.tsx | 11 +++++++++-- src/components/native/Titlebar.tsx | 8 +------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/components/common/UpdateIndicator.tsx b/src/components/common/UpdateIndicator.tsx index 7cc752f1..9e015ce2 100644 --- a/src/components/common/UpdateIndicator.tsx +++ b/src/components/common/UpdateIndicator.tsx @@ -10,6 +10,7 @@ import { ThemeContext } from "../../context/Theme"; import IconButton from "../ui/IconButton"; import { updateSW } from "../../main"; +import Tooltip from "./Tooltip"; let pendingUpdate = false; internalSubscribe("PWA", "update", () => (pendingUpdate = true)); @@ -30,8 +31,14 @@ export default function UpdateIndicator({ style }: Props) { if (style === "titlebar") { return ( -
updateSW(true)}> - +
+ +
updateSW(true)}> + +
+
); } diff --git a/src/components/native/Titlebar.tsx b/src/components/native/Titlebar.tsx index 6e17ee42..3a8b680e 100644 --- a/src/components/native/Titlebar.tsx +++ b/src/components/native/Titlebar.tsx @@ -75,13 +75,7 @@ export function Titlebar() { {window.native.getConfig().build === "dev" && }
-
- - - -
+
From d6e32fe8dc060e4ce49b7b29e58e200d89722b87 Mon Sep 17 00:00:00 2001 From: Paul Date: Sun, 1 Aug 2021 18:11:18 +0100 Subject: [PATCH 3/7] Move titlebar. --- src/pages/RevoltApp.tsx | 4 ++ src/pages/app.tsx | 5 -- src/pages/developer/Developer.tsx | 1 - src/pages/login/Login.tsx | 96 ++++++++++++++++--------------- 4 files changed, 55 insertions(+), 51 deletions(-) diff --git a/src/pages/RevoltApp.tsx b/src/pages/RevoltApp.tsx index 5e564f6d..bc309c30 100644 --- a/src/pages/RevoltApp.tsx +++ b/src/pages/RevoltApp.tsx @@ -10,6 +10,7 @@ import Notifications from "../context/revoltjs/Notifications"; import StateMonitor from "../context/revoltjs/StateMonitor"; import SyncManager from "../context/revoltjs/SyncManager"; +import { Titlebar } from "../components/native/Titlebar"; import BottomNavigation from "../components/navigation/BottomNavigation"; import LeftSidebar from "../components/navigation/LeftSidebar"; import RightSidebar from "../components/navigation/RightSidebar"; @@ -43,6 +44,9 @@ export default function App() { return ( <> + {window.isNative && !window.native.getConfig().frame && ( + + )} import("./login/Login")); const RevoltApp = lazy(() => import("./RevoltApp")); @@ -17,9 +15,6 @@ export function App() { return ( - {window.isNative && !window.native.getConfig().frame && ( - - )} {/* // @ts-expect-error */} }> diff --git a/src/pages/developer/Developer.tsx b/src/pages/developer/Developer.tsx index fb073026..7784d3aa 100644 --- a/src/pages/developer/Developer.tsx +++ b/src/pages/developer/Developer.tsx @@ -1,5 +1,4 @@ import { Wrench } from "@styled-icons/boxicons-solid"; -import { observer } from "mobx-react-lite"; import { useContext } from "preact/hooks"; diff --git a/src/pages/login/Login.tsx b/src/pages/login/Login.tsx index 9e3d6f44..dcd252f0 100644 --- a/src/pages/login/Login.tsx +++ b/src/pages/login/Login.tsx @@ -11,6 +11,7 @@ import { AppContext } from "../../context/revoltjs/RevoltClient"; import LocaleSelector from "../../components/common/LocaleSelector"; +import { Titlebar } from "../../components/native/Titlebar"; import { APP_VERSION } from "../../version"; import background from "./background.jpg"; import { FormCreate } from "./forms/FormCreate"; @@ -23,52 +24,57 @@ export default function Login() { const client = useContext(AppContext); return ( -
- - - -
-
- - API:{" "} - {client.configuration?.revolt ?? "???"}{" "} - · revolt.js: {LIBRARY_VERSION}{" "} - · App: {APP_VERSION} - - - - -
-
- - - - - - - - - - - - - - - - - -
-
- - ‎@lorenzoherrera - ‏· unsplash.com - + <> + {window.isNative && !window.native.getConfig().frame && ( + + )} +
+ + + +
+
+ + API:{" "} + {client.configuration?.revolt ?? "???"}{" "} + · revolt.js: {LIBRARY_VERSION}{" "} + · App: {APP_VERSION} + + + + +
+
+ + + + + + + + + + + + + + + + + +
+
+ + ‎@lorenzoherrera + ‏· unsplash.com + +
+
-
-
+ ); } From 11c766511a7b823c0a422dbbbe563b69c50e9075 Mon Sep 17 00:00:00 2001 From: nizune <9-nizune@users.noreply.gitlab.insrt.uk> Date: Sun, 1 Aug 2021 19:29:27 +0200 Subject: [PATCH 4/7] Changed titlebar icons --- src/components/native/Titlebar.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/native/Titlebar.tsx b/src/components/native/Titlebar.tsx index 3a8b680e..cd764a1a 100644 --- a/src/components/native/Titlebar.tsx +++ b/src/components/native/Titlebar.tsx @@ -78,13 +78,13 @@ export function Titlebar() {
- +
- +
- +
From f1966b45602a3b85620755d61e68a43159396c4e Mon Sep 17 00:00:00 2001 From: nizune <9-nizune@users.noreply.gitlab.insrt.uk> Date: Sun, 1 Aug 2021 20:41:53 +0200 Subject: [PATCH 5/7] Cleaned up titlebar look --- src/components/native/Titlebar.tsx | 13 +++++++++---- src/pages/settings/Settings.module.scss | 5 ++++- src/pages/settings/panes/Native.tsx | 1 + 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/components/native/Titlebar.tsx b/src/components/native/Titlebar.tsx index cd764a1a..c3677c53 100644 --- a/src/components/native/Titlebar.tsx +++ b/src/components/native/Titlebar.tsx @@ -1,4 +1,3 @@ -import { X, Minus, Square } from "@styled-icons/boxicons-regular"; import { Wrench } from "@styled-icons/boxicons-solid"; import styled from "styled-components"; @@ -11,6 +10,7 @@ const TitlebarBase = styled.div` gap: 6px; user-select: none; align-items: center; + .title { flex-grow: 1; @@ -20,15 +20,20 @@ const TitlebarBase = styled.div` font-weight: 600; margin-inline-start: 10px; margin-top: 4px; - gap: 8px; + gap: 6px; display: flex; align-items: center; justify-content: flex-start; + z-index: 90000; + color: var(--titlebar-logo-color); svg { - height: calc(var(--titlebar-height) / 3); margin-bottom: 4px; } + + svg:first-child { + height: calc(var(--titlebar-height) / 3); + } } .actions { @@ -73,7 +78,7 @@ export function Titlebar() { stroke-width="1" /> - {window.native.getConfig().build === "dev" && } + {window.native.getConfig().build === "dev" && }
diff --git a/src/pages/settings/Settings.module.scss b/src/pages/settings/Settings.module.scss index 97fc2d72..b34ddd97 100644 --- a/src/pages/settings/Settings.module.scss +++ b/src/pages/settings/Settings.module.scss @@ -80,7 +80,7 @@ background: var(--primary-background); .sidebar { - flex: 2; + flex: 1 0 218px; display: flex; flex-shrink: 0; overflow-y: scroll; @@ -91,6 +91,9 @@ width: 218px; padding: 60px 8px; height: fit-content; + display: flex; + gap: 2px; + flex-direction: column; } .divider { diff --git a/src/pages/settings/panes/Native.tsx b/src/pages/settings/panes/Native.tsx index 2d3b3c56..cab36b8b 100644 --- a/src/pages/settings/panes/Native.tsx +++ b/src/pages/settings/panes/Native.tsx @@ -24,6 +24,7 @@ export function Native(props: Props) { return (
+

App Behavior

Date: Sun, 1 Aug 2021 21:08:42 +0100 Subject: [PATCH 6/7] Closing animation for settings. --- src/pages/settings/GenericSettings.tsx | 24 +++++++++++++++++------- src/pages/settings/Settings.module.scss | 4 ++++ 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/src/pages/settings/GenericSettings.tsx b/src/pages/settings/GenericSettings.tsx index b9c9f546..42dd9f97 100644 --- a/src/pages/settings/GenericSettings.tsx +++ b/src/pages/settings/GenericSettings.tsx @@ -3,8 +3,9 @@ import { Helmet } from "react-helmet"; import { Switch, useHistory, useParams } from "react-router-dom"; import styles from "./Settings.module.scss"; +import classNames from "classnames"; import { Text } from "preact-i18n"; -import { useContext, useEffect } from "preact/hooks"; +import { useContext, useEffect, useState } from "preact/hooks"; import { isTouchscreenDevice } from "../../lib/isTouchscreenDevice"; @@ -48,12 +49,17 @@ export function GenericSettings({ const theme = useContext(ThemeContext); const { page } = useParams<{ page: string }>(); + const [closing, setClosing] = useState(false); function exitSettings() { - if (history.length > 0) { - history.goBack(); - } else { - history.push("/"); - } + setClosing(true); + + setTimeout(() => { + if (history.length > 0) { + history.goBack(); + } else { + history.push("/"); + } + }, 100); } useEffect(() => { @@ -68,7 +74,11 @@ export function GenericSettings({ }, []); return ( -
+
Date: Sun, 1 Aug 2021 21:55:13 +0100 Subject: [PATCH 7/7] Add settings closing animation. --- src/pages/settings/GenericSettings.tsx | 62 ++++++++++++++------------ src/pages/settings/Settings.tsx | 9 ++-- 2 files changed, 37 insertions(+), 34 deletions(-) diff --git a/src/pages/settings/GenericSettings.tsx b/src/pages/settings/GenericSettings.tsx index 42dd9f97..c2b0dfee 100644 --- a/src/pages/settings/GenericSettings.tsx +++ b/src/pages/settings/GenericSettings.tsx @@ -26,6 +26,7 @@ interface Props { id: string; icon: Children; title: Children; + hidden?: boolean; hideTitle?: boolean; }[]; custom?: Children; @@ -51,15 +52,15 @@ export function GenericSettings({ const [closing, setClosing] = useState(false); function exitSettings() { - setClosing(true); + if (history.length > 1) { + setClosing(true); - setTimeout(() => { - if (history.length > 0) { + setTimeout(() => { history.goBack(); - } else { - history.push("/"); - } - }, 100); + }, 100); + } else { + history.push("/"); + } } useEffect(() => { @@ -77,6 +78,7 @@ export function GenericSettings({
@@ -121,28 +123,30 @@ export function GenericSettings({ {(!isTouchscreenDevice || typeof page === "undefined") && (
- {pages.map((entry, i) => ( - <> - {entry.category && ( - - )} - switchPage(entry.id)} - compact> - {entry.icon} {entry.title} - - {entry.divider && } - - ))} + {pages.map((entry, i) => + entry.hidden ? undefined : ( + <> + {entry.category && ( + + )} + switchPage(entry.id)} + compact> + {entry.icon} {entry.title} + + {entry.divider && } + + ), + )} {custom}
diff --git a/src/pages/settings/Settings.tsx b/src/pages/settings/Settings.tsx index c5911dd4..01c6e500 100644 --- a/src/pages/settings/Settings.tsx +++ b/src/pages/settings/Settings.tsx @@ -104,6 +104,7 @@ export default function Settings() { }, { id: "native", + hidden: !window.isNative, icon: , title: , }, @@ -140,11 +141,9 @@ export default function Settings() { , - window.isNative && ( - - - - ), + + + , ,