1
0
mirror of https://github.com/matrix-org/matrix-authentication-service.git synced 2025-11-20 12:02:22 +03:00

Make Profile page the default route (#1653)

* make profile the default route

* src/pages/Home.tsx -> src/pages/SessionsOverview.tsx

* UserHome -> UserSessionsOverview

* update snapshots, fix session overview button alignment
This commit is contained in:
Kerry
2023-08-31 11:27:39 +12:00
committed by GitHub
parent bea4d57124
commit da8a489748
19 changed files with 189 additions and 184 deletions

View File

@@ -25,8 +25,8 @@ type Location = {
searchParams?: URLSearchParams;
};
type HomeRoute = { type: "home" };
type ProfileRoute = { type: "profile" };
type SessionOverviewRoute = { type: "sessions-overview" };
type OAuth2ClientRoute = { type: "client"; id: string };
type OAuth2SessionList = { type: "oauth2-session-list" };
type BrowserSessionRoute = { type: "session"; id: string };
@@ -36,7 +36,7 @@ type VerifyEmailRoute = { type: "verify-email"; id: string };
type UnknownRoute = { type: "unknown"; segments: string[] };
export type Route =
| HomeRoute
| SessionOverviewRoute
| ProfileRoute
| OAuth2ClientRoute
| OAuth2SessionList
@@ -48,10 +48,10 @@ export type Route =
const routeToSegments = (route: Route): string[] => {
switch (route.type) {
case "home":
return [];
case "profile":
return ["profile"];
return [];
case "sessions-overview":
return ["sessions-overview"];
case "verify-email":
return ["emails", route.id, "verify"];
case "client":
@@ -97,11 +97,11 @@ export const segmentsToRoute = (segments: string[]): Route => {
// Special case for the home page
if (segments.length === 0 || (segments.length === 1 && segments[0] === "")) {
return { type: "home" };
return { type: "profile" };
}
if (matches("profile")) {
return { type: "profile" };
if (matches("sessions-overview")) {
return { type: "sessions-overview" };
}
if (matches("sessions")) {
@@ -169,7 +169,7 @@ export const routeAtom = atom(
},
);
const Home = lazy(() => import("./pages/Home"));
const SessionsOverview = lazy(() => import("./pages/SessionsOverview"));
const Profile = lazy(() => import("./pages/Profile"));
const OAuth2Client = lazy(() => import("./pages/OAuth2Client"));
const BrowserSession = lazy(() => import("./pages/BrowserSession"));
@@ -182,10 +182,10 @@ const InnerRouter: React.FC = () => {
const route = useAtomValue(routeAtom);
switch (route.type) {
case "home":
return <Home />;
case "profile":
return <Profile />;
case "sessions-overview":
return <SessionsOverview />;
case "oauth2-session-list":
return <OAuth2SessionList />;
case "browser-session-list":