Compare commits
4 commits
ee31c38f32
...
71bdb21602
Author | SHA1 | Date | |
---|---|---|---|
|
71bdb21602 | ||
|
771de51228 | ||
|
a7bca9bd67 | ||
|
3444068fd8 |
4 changed files with 42 additions and 17 deletions
27
src/accounts/SignIn.css
Normal file
27
src/accounts/SignIn.css
Normal file
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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 (
|
||||
<div class={cards.layoutCentered}>
|
||||
<main class="SignIn">
|
||||
<Show when={params.error || params.errorDescription}>
|
||||
<div class={cards.card} style={{ "margin-bottom": "20px" }}>
|
||||
<p>Authorization is failed.</p>
|
||||
<p>{params.errorDescription}</p>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
</div>
|
||||
</Show>
|
||||
<div
|
||||
class={/*once*/ cards.card}
|
||||
class={`${cards.card} key-content`}
|
||||
aria-busy={currentState() !== "inactive" ? "true" : "false"}
|
||||
aria-describedby={
|
||||
currentState() !== "inactive" ? progressId : undefined
|
||||
|
@ -169,7 +163,7 @@ const SignIn: Component = () => {
|
|||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
@ -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,7 +574,11 @@ const StackedRouter: Component<StackedRouterProps> = (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",
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue