From 3444068fd81a4ce541a6388f2c0e45a64c0a2fca Mon Sep 17 00:00:00 2001 From: thislight Date: Mon, 23 Dec 2024 18:16:52 +0800 Subject: [PATCH 1/4] Settings: jump to sign in after signed out --- src/settings/Settings.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/settings/Settings.tsx b/src/settings/Settings.tsx index 188a61d..f783e7a 100644 --- a/src/settings/Settings.tsx +++ b/src/settings/Settings.tsx @@ -163,7 +163,7 @@ const Settings: Component = () => { }>, () => import(`./i18n/generic.json`), ); - const { pop } = useNavigator(); + const { pop, push } = useNavigator(); const settings$ = useStore($settings); const { needRefresh } = useServiceWorker(); const dateFnLocale = useDateFnLocale(); @@ -172,6 +172,10 @@ const Settings: Component = () => { const doSignOut = (acct: Account) => { signOut((a) => a.site === acct.site && a.accessToken === acct.accessToken); + + if (profiles().length == 0) { + push("/accounts/sign-in", { replace: "all" }); + } }; css` From a7bca9bd676d68d5cdca72c7a6286f78cc9a2573 Mon Sep 17 00:00:00 2001 From: thislight Date: Mon, 23 Dec 2024 18:30:58 +0800 Subject: [PATCH 2/4] StackedRouter: initializing stack supports query --- src/platform/StackedRouter.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/platform/StackedRouter.tsx b/src/platform/StackedRouter.tsx index f79da9a..c8f0417 100644 --- a/src/platform/StackedRouter.tsx +++ b/src/platform/StackedRouter.tsx @@ -578,7 +578,11 @@ const StackedRouter: Component = (oprops) => { createRenderEffect(() => untrack(() => { if (stack.length === 0) { - pushFrame(window.location.pathname, { + const parts = [window.location.pathname] as string[] + if (window.location.search) { + parts.push("?", window.location.search) + } + pushFrame(parts.join(''), { replace: "all", }); } From 771de51228807e9f9ad479b3c4db30314e1fdd13 Mon Sep 17 00:00:00 2001 From: thislight Date: Mon, 23 Dec 2024 18:31:56 +0800 Subject: [PATCH 3/4] accounts/SignIn: various visual improvement --- src/accounts/SignIn.css | 27 +++++++++++++++++++++++++++ src/accounts/SignIn.tsx | 16 +++++----------- 2 files changed, 32 insertions(+), 11 deletions(-) create mode 100644 src/accounts/SignIn.css diff --git a/src/accounts/SignIn.css b/src/accounts/SignIn.css new file mode 100644 index 0000000..11f467a --- /dev/null +++ b/src/accounts/SignIn.css @@ -0,0 +1,27 @@ +.SignIn { + position: absolute; + left: 50%; + top: 50%; + transform: translate(-50%, -50%); + width: 448px; + + @media (max-width: 600px) { + & { + position: static; + height: 100vh; + width: 100%; + transform: none; + overflow: auto; + } + } + + >.key-content { + height: 100%; + + >form { + display: flex; + flex-flow: column; + gap: 16px; + } + } +} \ No newline at end of file diff --git a/src/accounts/SignIn.tsx b/src/accounts/SignIn.tsx index c8699d2..628e490 100644 --- a/src/accounts/SignIn.tsx +++ b/src/accounts/SignIn.tsx @@ -18,6 +18,7 @@ import { createRestAPIClient } from "masto"; import { getOrRegisterApp } from "./stores"; import { useSearchParams } from "@solidjs/router"; import { $settings } from "../settings/stores"; +import "./SignIn.css"; type ErrorParams = { error: string; @@ -36,13 +37,6 @@ const SignIn: Component = () => { const [targetSiteTitle, setTargetSiteTitle] = createSignal(""); useDocumentTitle("Sign In"); - css` - form { - display: flex; - flex-flow: column; - gap: 16px; - } - `; const serverUrl = () => { const url = rawServerUrl(); @@ -121,19 +115,19 @@ const SignIn: Component = () => { }; return ( -
+

Authorization is failed.

{params.errorDescription}

- Please try again later. If the problem persist, you can seek for + Please try again later. If the problem persists, you can ask for help from the server administrator.

{
- + ); }; From 71bdb216020af48436779d51bf8092cf8dc2d8c1 Mon Sep 17 00:00:00 2001 From: thislight Date: Mon, 23 Dec 2024 18:33:18 +0800 Subject: [PATCH 4/4] StackedRouter: fix duplicated '?' symbol --- src/platform/StackedRouter.tsx | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/platform/StackedRouter.tsx b/src/platform/StackedRouter.tsx index c8f0417..df3d522 100644 --- a/src/platform/StackedRouter.tsx +++ b/src/platform/StackedRouter.tsx @@ -1,5 +1,4 @@ import { - Router, type RouterProps, type StaticRouterProps, createRouter, @@ -16,9 +15,6 @@ import { useContext, onCleanup, type Accessor, - children, - createSignal, - createRoot, } from "solid-js"; import { createStore, unwrap } from "solid-js/store"; import "./StackedRouter.css"; @@ -578,11 +574,11 @@ const StackedRouter: Component = (oprops) => { createRenderEffect(() => untrack(() => { if (stack.length === 0) { - const parts = [window.location.pathname] as string[] + const parts = [window.location.pathname] as string[]; if (window.location.search) { - parts.push("?", window.location.search) + parts.push(window.location.search); } - pushFrame(parts.join(''), { + pushFrame(parts.join(""), { replace: "all", }); }