diff --git a/apps/console/src/pages/SettingsPage.tsx b/apps/console/src/pages/SettingsPage.tsx index f96a6abc6..18be6803f 100644 --- a/apps/console/src/pages/SettingsPage.tsx +++ b/apps/console/src/pages/SettingsPage.tsx @@ -4,8 +4,43 @@ import { Card, CardContent, CardHeader, CardTitle, CardDescription } from "@/com import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar" import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@/components/ui/dropdown-menu" import { Helmet } from "react-helmet-async" +import { Suspense, useEffect } from "react" +import { + graphql, + PreloadedQuery, + usePreloadedQuery, + useQueryLoader, +} from "react-relay" +import type { SettingsPageQuery as SettingsPageQueryType } from "./__generated__/SettingsPageQuery.graphql" + +const settingsPageQuery = graphql` + query SettingsPageQuery { + node(id: "AZSfP_xAcAC5IAAAAAAltA") { + id + ... on Organization { + name + logoUrl + } + } + } +` + +interface Member { + id: string; + fullName: string; + primaryEmailAddress: string; + role: string; +} + +function SettingsPageContent({ + queryRef, +}: { + queryRef: PreloadedQuery; +}) { + const data = usePreloadedQuery(settingsPageQuery, queryRef); + const organization = data.node; + const members: Member[] = []; -export default function SettingsPage() { return ( <> @@ -44,9 +79,13 @@ export default function SettingsPage() {
-
- -
+ {organization.logoUrl ? ( + Logo + ) : ( +
+ +
+ )} Upload a logo to be displayed at the top of your trust page @@ -63,7 +102,7 @@ export default function SettingsPage() { Set the name of the organization
- ACME + {organization.name} @@ -84,19 +123,15 @@ export default function SettingsPage() {
- {[ - { name: "Antoine Bouchardy", email: "antoine.bouchardy@hexa.com", role: "Admin" }, - { name: "Bryan Frimin", email: "bryan.frimin@hexa.com", role: "Admin" }, - ].map((member) => ( -
+ {members.map((member) => ( +
- - {member.name.charAt(0)} + {member.fullName.charAt(0)}
- {member.name} - {member.email} + {member.fullName} + {member.primaryEmailAddress}
@@ -122,4 +157,38 @@ export default function SettingsPage() {
) -} \ No newline at end of file +} + +function SettingsPageFallback() { + return ( +
+
+
+
+
+
+ {[1, 2].map((i) => ( +
+ ))} +
+
+ ); +} + +export default function SettingsPage() { + const [queryRef, loadQuery] = useQueryLoader(settingsPageQuery); + + useEffect(() => { + loadQuery({}); + }, [loadQuery]); + + if (!queryRef) { + return ; + } + + return ( + }> + + + ); +} \ No newline at end of file diff --git a/apps/console/src/pages/__generated__/SettingsPageQuery.graphql.ts b/apps/console/src/pages/__generated__/SettingsPageQuery.graphql.ts new file mode 100644 index 000000000..ee87c0ace --- /dev/null +++ b/apps/console/src/pages/__generated__/SettingsPageQuery.graphql.ts @@ -0,0 +1,126 @@ +/** + * @generated SignedSource<<1daa3e6f3ef43392ed73ce9ddb46aa47>> + * @lightSyntaxTransform + * @nogrep + */ + +/* tslint:disable */ +/* eslint-disable */ +// @ts-nocheck + +import { ConcreteRequest } from 'relay-runtime'; +export type SettingsPageQuery$variables = Record; +export type SettingsPageQuery$data = { + readonly node: { + readonly id: string; + readonly logoUrl?: string; + readonly name?: string; + }; +}; +export type SettingsPageQuery = { + response: SettingsPageQuery$data; + variables: SettingsPageQuery$variables; +}; + +const node: ConcreteRequest = (function(){ +var v0 = [ + { + "kind": "Literal", + "name": "id", + "value": "AZSfP_xAcAC5IAAAAAAltA" + } +], +v1 = { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "id", + "storageKey": null +}, +v2 = { + "kind": "InlineFragment", + "selections": [ + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "name", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "logoUrl", + "storageKey": null + } + ], + "type": "Organization", + "abstractKey": null +}; +return { + "fragment": { + "argumentDefinitions": [], + "kind": "Fragment", + "metadata": null, + "name": "SettingsPageQuery", + "selections": [ + { + "alias": null, + "args": (v0/*: any*/), + "concreteType": null, + "kind": "LinkedField", + "name": "node", + "plural": false, + "selections": [ + (v1/*: any*/), + (v2/*: any*/) + ], + "storageKey": "node(id:\"AZSfP_xAcAC5IAAAAAAltA\")" + } + ], + "type": "Query", + "abstractKey": null + }, + "kind": "Request", + "operation": { + "argumentDefinitions": [], + "kind": "Operation", + "name": "SettingsPageQuery", + "selections": [ + { + "alias": null, + "args": (v0/*: any*/), + "concreteType": null, + "kind": "LinkedField", + "name": "node", + "plural": false, + "selections": [ + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "__typename", + "storageKey": null + }, + (v1/*: any*/), + (v2/*: any*/) + ], + "storageKey": "node(id:\"AZSfP_xAcAC5IAAAAAAltA\")" + } + ] + }, + "params": { + "cacheID": "911c50f40d00159bd8201b7193fe6686", + "id": null, + "metadata": {}, + "name": "SettingsPageQuery", + "operationKind": "query", + "text": "query SettingsPageQuery {\n node(id: \"AZSfP_xAcAC5IAAAAAAltA\") {\n __typename\n id\n ... on Organization {\n name\n logoUrl\n }\n }\n}\n" + } +}; +})(); + +(node as any).hash = "fc0474b3b161e0a1e6c41f9898afa5b0"; + +export default node;