> renders app navigation correctly 1`] = `
Profile
@@ -11,9 +12,8 @@ exports[`
> renders app navigation correctly 1`] = `
exports[`
> renders app navigation correctly 2`] = `
Sessions
diff --git a/frontend/src/gql/gql.ts b/frontend/src/gql/gql.ts
index 8591d7444..057458515 100644
--- a/frontend/src/gql/gql.ts
+++ b/frontend/src/gql/gql.ts
@@ -47,8 +47,6 @@ const documents = {
types.SetPrimaryEmailDocument,
"\n query UserGreeting($userId: ID!) {\n user(id: $userId) {\n id\n username\n matrix {\n mxid\n displayName\n }\n }\n viewer {\n __typename\n\n ... on User {\n id\n ...UnverifiedEmailAlert\n }\n }\n }\n":
types.UserGreetingDocument,
- "\n fragment UserHome_user on User {\n id\n\n primaryEmail {\n id\n ...UserEmail_email\n }\n\n confirmedEmails: emails(first: 0, state: CONFIRMED) {\n totalCount\n }\n\n browserSessions(first: 0, state: ACTIVE) {\n totalCount\n }\n\n oauth2Sessions(first: 0, state: ACTIVE) {\n totalCount\n }\n\n compatSessions(first: 0, state: ACTIVE) {\n totalCount\n }\n }\n":
- types.UserHome_UserFragmentDoc,
"\n mutation AddEmail($userId: ID!, $email: String!) {\n addEmail(input: { userId: $userId, email: $email }) {\n status\n violations\n email {\n id\n ...UserEmail_email\n }\n }\n }\n":
types.AddEmailDocument,
"\n query UserEmailListQuery(\n $userId: ID!\n $first: Int\n $after: String\n $last: Int\n $before: String\n ) {\n user(id: $userId) {\n id\n\n emails(first: $first, after: $after, last: $last, before: $before) {\n edges {\n cursor\n node {\n id\n ...UserEmail_email\n }\n }\n totalCount\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n }\n }\n }\n":
@@ -57,6 +55,8 @@ const documents = {
types.UserPrimaryEmailDocument,
"\n mutation SetDisplayName($userId: ID!, $displayName: String) {\n setDisplayName(input: { userId: $userId, displayName: $displayName }) {\n status\n user {\n id\n matrix {\n displayName\n }\n }\n }\n }\n":
types.SetDisplayNameDocument,
+ "\n fragment UserSessionsOverview_user on User {\n id\n\n primaryEmail {\n id\n ...UserEmail_email\n }\n\n confirmedEmails: emails(first: 0, state: CONFIRMED) {\n totalCount\n }\n\n browserSessions(first: 0, state: ACTIVE) {\n totalCount\n }\n\n oauth2Sessions(first: 0, state: ACTIVE) {\n totalCount\n }\n\n compatSessions(first: 0, state: ACTIVE) {\n totalCount\n }\n }\n":
+ types.UserSessionsOverview_UserFragmentDoc,
"\n fragment UserEmail_verifyEmail on UserEmail {\n id\n email\n }\n":
types.UserEmail_VerifyEmailFragmentDoc,
"\n mutation VerifyEmail($id: ID!, $code: String!) {\n verifyEmail(input: { userEmailId: $id, code: $code }) {\n status\n\n user {\n id\n primaryEmail {\n id\n }\n }\n\n email {\n id\n ...UserEmail_email\n }\n }\n }\n":
@@ -65,10 +65,10 @@ const documents = {
types.ResendVerificationEmailDocument,
"\n query BrowserSessionQuery($id: ID!) {\n browserSession(id: $id) {\n id\n createdAt\n lastAuthentication {\n id\n createdAt\n }\n user {\n id\n username\n }\n }\n }\n":
types.BrowserSessionQueryDocument,
- "\n query HomeQuery {\n viewer {\n __typename\n\n ... on User {\n id\n ...UserHome_user\n }\n }\n }\n":
- types.HomeQueryDocument,
"\n query OAuth2ClientQuery($id: ID!) {\n oauth2Client(id: $id) {\n id\n clientId\n clientName\n clientUri\n tosUri\n policyUri\n redirectUris\n }\n }\n":
types.OAuth2ClientQueryDocument,
+ "\n query SessionsOverviewQuery {\n viewer {\n __typename\n\n ... on User {\n id\n ...UserSessionsOverview_user\n }\n }\n }\n":
+ types.SessionsOverviewQueryDocument,
"\n query VerifyEmailQuery($id: ID!) {\n userEmail(id: $id) {\n ...UserEmail_verifyEmail\n }\n }\n":
types.VerifyEmailQueryDocument,
};
@@ -189,12 +189,6 @@ export function graphql(
export function graphql(
source: "\n query UserGreeting($userId: ID!) {\n user(id: $userId) {\n id\n username\n matrix {\n mxid\n displayName\n }\n }\n viewer {\n __typename\n\n ... on User {\n id\n ...UnverifiedEmailAlert\n }\n }\n }\n",
): (typeof documents)["\n query UserGreeting($userId: ID!) {\n user(id: $userId) {\n id\n username\n matrix {\n mxid\n displayName\n }\n }\n viewer {\n __typename\n\n ... on User {\n id\n ...UnverifiedEmailAlert\n }\n }\n }\n"];
-/**
- * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
- */
-export function graphql(
- source: "\n fragment UserHome_user on User {\n id\n\n primaryEmail {\n id\n ...UserEmail_email\n }\n\n confirmedEmails: emails(first: 0, state: CONFIRMED) {\n totalCount\n }\n\n browserSessions(first: 0, state: ACTIVE) {\n totalCount\n }\n\n oauth2Sessions(first: 0, state: ACTIVE) {\n totalCount\n }\n\n compatSessions(first: 0, state: ACTIVE) {\n totalCount\n }\n }\n",
-): (typeof documents)["\n fragment UserHome_user on User {\n id\n\n primaryEmail {\n id\n ...UserEmail_email\n }\n\n confirmedEmails: emails(first: 0, state: CONFIRMED) {\n totalCount\n }\n\n browserSessions(first: 0, state: ACTIVE) {\n totalCount\n }\n\n oauth2Sessions(first: 0, state: ACTIVE) {\n totalCount\n }\n\n compatSessions(first: 0, state: ACTIVE) {\n totalCount\n }\n }\n"];
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
@@ -219,6 +213,12 @@ export function graphql(
export function graphql(
source: "\n mutation SetDisplayName($userId: ID!, $displayName: String) {\n setDisplayName(input: { userId: $userId, displayName: $displayName }) {\n status\n user {\n id\n matrix {\n displayName\n }\n }\n }\n }\n",
): (typeof documents)["\n mutation SetDisplayName($userId: ID!, $displayName: String) {\n setDisplayName(input: { userId: $userId, displayName: $displayName }) {\n status\n user {\n id\n matrix {\n displayName\n }\n }\n }\n }\n"];
+/**
+ * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
+ */
+export function graphql(
+ source: "\n fragment UserSessionsOverview_user on User {\n id\n\n primaryEmail {\n id\n ...UserEmail_email\n }\n\n confirmedEmails: emails(first: 0, state: CONFIRMED) {\n totalCount\n }\n\n browserSessions(first: 0, state: ACTIVE) {\n totalCount\n }\n\n oauth2Sessions(first: 0, state: ACTIVE) {\n totalCount\n }\n\n compatSessions(first: 0, state: ACTIVE) {\n totalCount\n }\n }\n",
+): (typeof documents)["\n fragment UserSessionsOverview_user on User {\n id\n\n primaryEmail {\n id\n ...UserEmail_email\n }\n\n confirmedEmails: emails(first: 0, state: CONFIRMED) {\n totalCount\n }\n\n browserSessions(first: 0, state: ACTIVE) {\n totalCount\n }\n\n oauth2Sessions(first: 0, state: ACTIVE) {\n totalCount\n }\n\n compatSessions(first: 0, state: ACTIVE) {\n totalCount\n }\n }\n"];
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
@@ -247,14 +247,14 @@ export function graphql(
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
export function graphql(
- source: "\n query HomeQuery {\n viewer {\n __typename\n\n ... on User {\n id\n ...UserHome_user\n }\n }\n }\n",
-): (typeof documents)["\n query HomeQuery {\n viewer {\n __typename\n\n ... on User {\n id\n ...UserHome_user\n }\n }\n }\n"];
+ source: "\n query OAuth2ClientQuery($id: ID!) {\n oauth2Client(id: $id) {\n id\n clientId\n clientName\n clientUri\n tosUri\n policyUri\n redirectUris\n }\n }\n",
+): (typeof documents)["\n query OAuth2ClientQuery($id: ID!) {\n oauth2Client(id: $id) {\n id\n clientId\n clientName\n clientUri\n tosUri\n policyUri\n redirectUris\n }\n }\n"];
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
export function graphql(
- source: "\n query OAuth2ClientQuery($id: ID!) {\n oauth2Client(id: $id) {\n id\n clientId\n clientName\n clientUri\n tosUri\n policyUri\n redirectUris\n }\n }\n",
-): (typeof documents)["\n query OAuth2ClientQuery($id: ID!) {\n oauth2Client(id: $id) {\n id\n clientId\n clientName\n clientUri\n tosUri\n policyUri\n redirectUris\n }\n }\n"];
+ source: "\n query SessionsOverviewQuery {\n viewer {\n __typename\n\n ... on User {\n id\n ...UserSessionsOverview_user\n }\n }\n }\n",
+): (typeof documents)["\n query SessionsOverviewQuery {\n viewer {\n __typename\n\n ... on User {\n id\n ...UserSessionsOverview_user\n }\n }\n }\n"];
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
diff --git a/frontend/src/gql/graphql.ts b/frontend/src/gql/graphql.ts
index 1fa926957..b3142785d 100644
--- a/frontend/src/gql/graphql.ts
+++ b/frontend/src/gql/graphql.ts
@@ -1214,29 +1214,6 @@ export type UserGreetingQuery = {
});
};
-export type UserHome_UserFragment = {
- __typename?: "User";
- id: string;
- primaryEmail?:
- | ({ __typename?: "UserEmail"; id: string } & {
- " $fragmentRefs"?: { UserEmail_EmailFragment: UserEmail_EmailFragment };
- })
- | null;
- confirmedEmails: { __typename?: "UserEmailConnection"; totalCount: number };
- browserSessions: {
- __typename?: "BrowserSessionConnection";
- totalCount: number;
- };
- oauth2Sessions: {
- __typename?: "Oauth2SessionConnection";
- totalCount: number;
- };
- compatSessions: {
- __typename?: "CompatSessionConnection";
- totalCount: number;
- };
-} & { " $fragmentName"?: "UserHome_UserFragment" };
-
export type AddEmailMutationVariables = Exact<{
userId: Scalars["ID"]["input"];
email: Scalars["String"]["input"];
@@ -1325,6 +1302,29 @@ export type SetDisplayNameMutation = {
};
};
+export type UserSessionsOverview_UserFragment = {
+ __typename?: "User";
+ id: string;
+ primaryEmail?:
+ | ({ __typename?: "UserEmail"; id: string } & {
+ " $fragmentRefs"?: { UserEmail_EmailFragment: UserEmail_EmailFragment };
+ })
+ | null;
+ confirmedEmails: { __typename?: "UserEmailConnection"; totalCount: number };
+ browserSessions: {
+ __typename?: "BrowserSessionConnection";
+ totalCount: number;
+ };
+ oauth2Sessions: {
+ __typename?: "Oauth2SessionConnection";
+ totalCount: number;
+ };
+ compatSessions: {
+ __typename?: "CompatSessionConnection";
+ totalCount: number;
+ };
+} & { " $fragmentName"?: "UserSessionsOverview_UserFragment" };
+
export type UserEmail_VerifyEmailFragment = {
__typename?: "UserEmail";
id: string;
@@ -1395,17 +1395,6 @@ export type BrowserSessionQueryQuery = {
} | null;
};
-export type HomeQueryQueryVariables = Exact<{ [key: string]: never }>;
-
-export type HomeQueryQuery = {
- __typename?: "Query";
- viewer:
- | { __typename: "Anonymous" }
- | ({ __typename: "User"; id: string } & {
- " $fragmentRefs"?: { UserHome_UserFragment: UserHome_UserFragment };
- });
-};
-
export type OAuth2ClientQueryQueryVariables = Exact<{
id: Scalars["ID"]["input"];
}>;
@@ -1424,6 +1413,21 @@ export type OAuth2ClientQueryQuery = {
} | null;
};
+export type SessionsOverviewQueryQueryVariables = Exact<{
+ [key: string]: never;
+}>;
+
+export type SessionsOverviewQueryQuery = {
+ __typename?: "Query";
+ viewer:
+ | { __typename: "Anonymous" }
+ | ({ __typename: "User"; id: string } & {
+ " $fragmentRefs"?: {
+ UserSessionsOverview_UserFragment: UserSessionsOverview_UserFragment;
+ };
+ });
+};
+
export type VerifyEmailQueryQueryVariables = Exact<{
id: Scalars["ID"]["input"];
}>;
@@ -1640,12 +1644,12 @@ export const UserEmail_EmailFragmentDoc = {
},
],
} as unknown as DocumentNode
;
-export const UserHome_UserFragmentDoc = {
+export const UserSessionsOverview_UserFragmentDoc = {
kind: "Document",
definitions: [
{
kind: "FragmentDefinition",
- name: { kind: "Name", value: "UserHome_user" },
+ name: { kind: "Name", value: "UserSessionsOverview_user" },
typeCondition: {
kind: "NamedType",
name: { kind: "Name", value: "User" },
@@ -1777,7 +1781,7 @@ export const UserHome_UserFragmentDoc = {
},
},
],
-} as unknown as DocumentNode;
+} as unknown as DocumentNode;
export const UserEmail_VerifyEmailFragmentDoc = {
kind: "Document",
definitions: [
@@ -3942,13 +3946,70 @@ export const BrowserSessionQueryDocument = {
BrowserSessionQueryQuery,
BrowserSessionQueryQueryVariables
>;
-export const HomeQueryDocument = {
+export const OAuth2ClientQueryDocument = {
kind: "Document",
definitions: [
{
kind: "OperationDefinition",
operation: "query",
- name: { kind: "Name", value: "HomeQuery" },
+ name: { kind: "Name", value: "OAuth2ClientQuery" },
+ variableDefinitions: [
+ {
+ kind: "VariableDefinition",
+ variable: { kind: "Variable", name: { kind: "Name", value: "id" } },
+ type: {
+ kind: "NonNullType",
+ type: { kind: "NamedType", name: { kind: "Name", value: "ID" } },
+ },
+ },
+ ],
+ selectionSet: {
+ kind: "SelectionSet",
+ selections: [
+ {
+ kind: "Field",
+ name: { kind: "Name", value: "oauth2Client" },
+ arguments: [
+ {
+ kind: "Argument",
+ name: { kind: "Name", value: "id" },
+ value: {
+ kind: "Variable",
+ name: { kind: "Name", value: "id" },
+ },
+ },
+ ],
+ selectionSet: {
+ kind: "SelectionSet",
+ selections: [
+ { kind: "Field", name: { kind: "Name", value: "id" } },
+ { kind: "Field", name: { kind: "Name", value: "clientId" } },
+ { kind: "Field", name: { kind: "Name", value: "clientName" } },
+ { kind: "Field", name: { kind: "Name", value: "clientUri" } },
+ { kind: "Field", name: { kind: "Name", value: "tosUri" } },
+ { kind: "Field", name: { kind: "Name", value: "policyUri" } },
+ {
+ kind: "Field",
+ name: { kind: "Name", value: "redirectUris" },
+ },
+ ],
+ },
+ },
+ ],
+ },
+ },
+ ],
+} as unknown as DocumentNode<
+ OAuth2ClientQueryQuery,
+ OAuth2ClientQueryQueryVariables
+>;
+export const SessionsOverviewQueryDocument = {
+ kind: "Document",
+ definitions: [
+ {
+ kind: "OperationDefinition",
+ operation: "query",
+ name: { kind: "Name", value: "SessionsOverviewQuery" },
selectionSet: {
kind: "SelectionSet",
selections: [
@@ -3971,7 +4032,10 @@ export const HomeQueryDocument = {
{ kind: "Field", name: { kind: "Name", value: "id" } },
{
kind: "FragmentSpread",
- name: { kind: "Name", value: "UserHome_user" },
+ name: {
+ kind: "Name",
+ value: "UserSessionsOverview_user",
+ },
},
],
},
@@ -4000,7 +4064,7 @@ export const HomeQueryDocument = {
},
{
kind: "FragmentDefinition",
- name: { kind: "Name", value: "UserHome_user" },
+ name: { kind: "Name", value: "UserSessionsOverview_user" },
typeCondition: {
kind: "NamedType",
name: { kind: "Name", value: "User" },
@@ -4116,63 +4180,9 @@ export const HomeQueryDocument = {
},
},
],
-} as unknown as DocumentNode;
-export const OAuth2ClientQueryDocument = {
- kind: "Document",
- definitions: [
- {
- kind: "OperationDefinition",
- operation: "query",
- name: { kind: "Name", value: "OAuth2ClientQuery" },
- variableDefinitions: [
- {
- kind: "VariableDefinition",
- variable: { kind: "Variable", name: { kind: "Name", value: "id" } },
- type: {
- kind: "NonNullType",
- type: { kind: "NamedType", name: { kind: "Name", value: "ID" } },
- },
- },
- ],
- selectionSet: {
- kind: "SelectionSet",
- selections: [
- {
- kind: "Field",
- name: { kind: "Name", value: "oauth2Client" },
- arguments: [
- {
- kind: "Argument",
- name: { kind: "Name", value: "id" },
- value: {
- kind: "Variable",
- name: { kind: "Name", value: "id" },
- },
- },
- ],
- selectionSet: {
- kind: "SelectionSet",
- selections: [
- { kind: "Field", name: { kind: "Name", value: "id" } },
- { kind: "Field", name: { kind: "Name", value: "clientId" } },
- { kind: "Field", name: { kind: "Name", value: "clientName" } },
- { kind: "Field", name: { kind: "Name", value: "clientUri" } },
- { kind: "Field", name: { kind: "Name", value: "tosUri" } },
- { kind: "Field", name: { kind: "Name", value: "policyUri" } },
- {
- kind: "Field",
- name: { kind: "Name", value: "redirectUris" },
- },
- ],
- },
- },
- ],
- },
- },
- ],
} as unknown as DocumentNode<
- OAuth2ClientQueryQuery,
- OAuth2ClientQueryQueryVariables
+ SessionsOverviewQueryQuery,
+ SessionsOverviewQueryQueryVariables
>;
export const VerifyEmailQueryDocument = {
kind: "Document",
diff --git a/frontend/src/pages/Home.tsx b/frontend/src/pages/SessionsOverview.tsx
similarity index 74%
rename from frontend/src/pages/Home.tsx
rename to frontend/src/pages/SessionsOverview.tsx
index 745e7bf52..155848f20 100644
--- a/frontend/src/pages/Home.tsx
+++ b/frontend/src/pages/SessionsOverview.tsx
@@ -18,28 +18,28 @@ import { atomWithQuery } from "jotai-urql";
import { mapQueryAtom } from "../atoms";
import GraphQLError from "../components/GraphQLError";
import NotLoggedIn from "../components/NotLoggedIn";
-import UserHome from "../components/UserHome";
+import UserSessionsOverview from "../components/UserSessionsOverview";
import { graphql } from "../gql";
import { isErr, unwrapErr, unwrapOk } from "../result";
const QUERY = graphql(/* GraphQL */ `
- query HomeQuery {
+ query SessionsOverviewQuery {
viewer {
__typename
... on User {
id
- ...UserHome_user
+ ...UserSessionsOverview_user
}
}
}
`);
-const homeQueryAtom = atomWithQuery({
+const sessionsOverviewQueryAtom = atomWithQuery({
query: QUERY,
});
-const homeAtom = mapQueryAtom(homeQueryAtom, (data) => {
+const sessionsOverviewAtom = mapQueryAtom(sessionsOverviewQueryAtom, (data) => {
if (data.viewer?.__typename === "User") {
return data.viewer;
}
@@ -47,14 +47,14 @@ const homeAtom = mapQueryAtom(homeQueryAtom, (data) => {
return null;
});
-const Home: React.FC = () => {
- const result = useAtomValue(homeAtom);
+const SessionsOverview: React.FC = () => {
+ const result = useAtomValue(sessionsOverviewAtom);
if (isErr(result)) return ;
const data = unwrapOk(result);
if (data === null) return ;
- return ;
+ return ;
};
-export default Home;
+export default SessionsOverview;
diff --git a/frontend/src/test-utils/WithLocation.tsx b/frontend/src/test-utils/WithLocation.tsx
index 5f9aa4cae..9cd30eae7 100644
--- a/frontend/src/test-utils/WithLocation.tsx
+++ b/frontend/src/test-utils/WithLocation.tsx
@@ -37,7 +37,7 @@ const HydrateLocation: React.FC> = ({
* ```
* const component = create(
- Active
+ Active
,
);
* ```