From 04c2b73bce1faa07e6ad72b19dcb2c432b5c127b Mon Sep 17 00:00:00 2001 From: gearnode Date: Wed, 26 Feb 2025 14:55:19 +0100 Subject: [PATCH] Rename TeamSwitcher comp Signed-off-by: gearnode --- apps/console/src/components/AppSidebar.tsx | 6 ++--- ...mSwitcher.tsx => OrganizationSwitcher.tsx} | 23 ++++++++++--------- .../__generated__/AppSidebarQuery.graphql.ts | 14 +++++------ ...nizationSwitcher_organizations.graphql.ts} | 18 +++++++-------- .../src/pages/CreateOrganizationPage.tsx | 6 ++--- 5 files changed, 34 insertions(+), 33 deletions(-) rename apps/console/src/components/{TeamSwitcher.tsx => OrganizationSwitcher.tsx} (89%) rename apps/console/src/components/__generated__/{TeamSwitcher_organizations.graphql.ts => OrganizationSwitcher_organizations.graphql.ts} (86%) diff --git a/apps/console/src/components/AppSidebar.tsx b/apps/console/src/components/AppSidebar.tsx index 7d766af09..971a1ba92 100644 --- a/apps/console/src/components/AppSidebar.tsx +++ b/apps/console/src/components/AppSidebar.tsx @@ -30,7 +30,7 @@ import { SidebarMenuItem, } from "@/components/ui/sidebar"; import type { AppSidebarQuery as AppSidebarQueryType } from "./__generated__/AppSidebarQuery.graphql"; -import { TeamSwitcher } from "@/components/TeamSwitcher"; +import { OrganizationSwitcher } from "@/components/OrganizationSwitcher"; function getNavItems(organizationId?: string) { // Always return the same structure, but with or without URLs depending on whether an organization is selected @@ -91,7 +91,7 @@ const AppSidebarQuery = graphql` query AppSidebarQuery { viewer { id - ...TeamSwitcher_organizations + ...OrganizationSwitcher_organizations ...NavUser_viewer } } @@ -110,7 +110,7 @@ function AppSidebarContent({ return ( - + diff --git a/apps/console/src/components/TeamSwitcher.tsx b/apps/console/src/components/OrganizationSwitcher.tsx similarity index 89% rename from apps/console/src/components/TeamSwitcher.tsx rename to apps/console/src/components/OrganizationSwitcher.tsx index 34cca4a43..45263fc6a 100644 --- a/apps/console/src/components/TeamSwitcher.tsx +++ b/apps/console/src/components/OrganizationSwitcher.tsx @@ -21,13 +21,14 @@ import { useSidebar, } from "@/components/ui/sidebar"; import { - TeamSwitcher_organizations$key, - TeamSwitcher_organizations$data, -} from "./__generated__/TeamSwitcher_organizations.graphql"; + OrganizationSwitcher_organizations$key, + OrganizationSwitcher_organizations$data, +} from "./__generated__/OrganizationSwitcher_organizations.graphql"; -export const teamSwitcherFragment = graphql` - fragment TeamSwitcher_organizations on User { - organizations(first: 25) @connection(key: "TeamSwitcher_organizations") { +export const organizationSwitcherFragment = graphql` + fragment OrganizationSwitcher_organizations on User { + organizations(first: 25) + @connection(key: "OrganizationSwitcher_organizations") { __id edges { node { @@ -41,7 +42,7 @@ export const teamSwitcherFragment = graphql` `; type Organization = - TeamSwitcher_organizations$data["organizations"]["edges"][0]["node"]; + OrganizationSwitcher_organizations$data["organizations"]["edges"][0]["node"]; const LogoComponent = ({ org, @@ -56,13 +57,13 @@ const LogoComponent = ({ return null; }; -export function TeamSwitcher({ +export function OrganizationSwitcher({ organizations, }: { - organizations: TeamSwitcher_organizations$key; + organizations: OrganizationSwitcher_organizations$key; }) { const { isMobile } = useSidebar(); - const data = useFragment(teamSwitcherFragment, organizations); + const data = useFragment(organizationSwitcherFragment, organizations); const navigate = useNavigate(); const { organizationId } = useParams(); const [currentOrganization, setCurrentOrganization] = @@ -73,7 +74,7 @@ export function TeamSwitcher({ useEffect(() => { if (hasOrganizations) { const org = data.organizations.edges.find( - (edge) => edge.node.id === organizationId, + (edge) => edge.node.id === organizationId ); if (org) { setCurrentOrganization(org.node); diff --git a/apps/console/src/components/__generated__/AppSidebarQuery.graphql.ts b/apps/console/src/components/__generated__/AppSidebarQuery.graphql.ts index 4ce2037ad..d0ed8e932 100644 --- a/apps/console/src/components/__generated__/AppSidebarQuery.graphql.ts +++ b/apps/console/src/components/__generated__/AppSidebarQuery.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<> + * @generated SignedSource<> * @lightSyntaxTransform * @nogrep */ @@ -14,7 +14,7 @@ export type AppSidebarQuery$variables = Record; export type AppSidebarQuery$data = { readonly viewer: { readonly id: string; - readonly " $fragmentSpreads": FragmentRefs<"NavUser_viewer" | "TeamSwitcher_organizations">; + readonly " $fragmentSpreads": FragmentRefs<"NavUser_viewer" | "OrganizationSwitcher_organizations">; }; }; export type AppSidebarQuery = { @@ -56,7 +56,7 @@ return { { "args": null, "kind": "FragmentSpread", - "name": "TeamSwitcher_organizations" + "name": "OrganizationSwitcher_organizations" }, { "args": null, @@ -189,7 +189,7 @@ return { "args": (v1/*: any*/), "filters": null, "handle": "connection", - "key": "TeamSwitcher_organizations", + "key": "OrganizationSwitcher_organizations", "kind": "LinkedHandle", "name": "organizations" }, @@ -213,16 +213,16 @@ return { ] }, "params": { - "cacheID": "52b7d912665a4da10a79b82987a7e58a", + "cacheID": "d92e5e742128d82b461ab1b6d52cd2a6", "id": null, "metadata": {}, "name": "AppSidebarQuery", "operationKind": "query", - "text": "query AppSidebarQuery {\n viewer {\n id\n ...TeamSwitcher_organizations\n ...NavUser_viewer\n }\n}\n\nfragment NavUser_viewer on User {\n id\n fullName\n email\n}\n\nfragment TeamSwitcher_organizations on User {\n organizations(first: 25) {\n edges {\n node {\n id\n name\n logoUrl\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n}\n" + "text": "query AppSidebarQuery {\n viewer {\n id\n ...OrganizationSwitcher_organizations\n ...NavUser_viewer\n }\n}\n\nfragment NavUser_viewer on User {\n id\n fullName\n email\n}\n\nfragment OrganizationSwitcher_organizations on User {\n organizations(first: 25) {\n edges {\n node {\n id\n name\n logoUrl\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n}\n" } }; })(); -(node as any).hash = "d5e28d934b5913169dd822042f4eca07"; +(node as any).hash = "ebe1f481a1454380e017fb976b8bb8a5"; export default node; diff --git a/apps/console/src/components/__generated__/TeamSwitcher_organizations.graphql.ts b/apps/console/src/components/__generated__/OrganizationSwitcher_organizations.graphql.ts similarity index 86% rename from apps/console/src/components/__generated__/TeamSwitcher_organizations.graphql.ts rename to apps/console/src/components/__generated__/OrganizationSwitcher_organizations.graphql.ts index 05996a42b..0952497a2 100644 --- a/apps/console/src/components/__generated__/TeamSwitcher_organizations.graphql.ts +++ b/apps/console/src/components/__generated__/OrganizationSwitcher_organizations.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<> + * @generated SignedSource<> * @lightSyntaxTransform * @nogrep */ @@ -10,7 +10,7 @@ import { ReaderFragment } from 'relay-runtime'; import { FragmentRefs } from "relay-runtime"; -export type TeamSwitcher_organizations$data = { +export type OrganizationSwitcher_organizations$data = { readonly organizations: { readonly __id: string; readonly edges: ReadonlyArray<{ @@ -21,11 +21,11 @@ export type TeamSwitcher_organizations$data = { }; }>; }; - readonly " $fragmentType": "TeamSwitcher_organizations"; + readonly " $fragmentType": "OrganizationSwitcher_organizations"; }; -export type TeamSwitcher_organizations$key = { - readonly " $data"?: TeamSwitcher_organizations$data; - readonly " $fragmentSpreads": FragmentRefs<"TeamSwitcher_organizations">; +export type OrganizationSwitcher_organizations$key = { + readonly " $data"?: OrganizationSwitcher_organizations$data; + readonly " $fragmentSpreads": FragmentRefs<"OrganizationSwitcher_organizations">; }; const node: ReaderFragment = { @@ -43,14 +43,14 @@ const node: ReaderFragment = { } ] }, - "name": "TeamSwitcher_organizations", + "name": "OrganizationSwitcher_organizations", "selections": [ { "alias": "organizations", "args": null, "concreteType": "OrganizationConnection", "kind": "LinkedField", - "name": "__TeamSwitcher_organizations_connection", + "name": "__OrganizationSwitcher_organizations_connection", "plural": false, "selections": [ { @@ -155,6 +155,6 @@ const node: ReaderFragment = { "abstractKey": null }; -(node as any).hash = "22731866cafda226a19f8c64fda51ba5"; +(node as any).hash = "8150704a009e88c096c6f6aa13cada52"; export default node; diff --git a/apps/console/src/pages/CreateOrganizationPage.tsx b/apps/console/src/pages/CreateOrganizationPage.tsx index ce87122bf..16ec07dd9 100644 --- a/apps/console/src/pages/CreateOrganizationPage.tsx +++ b/apps/console/src/pages/CreateOrganizationPage.tsx @@ -86,11 +86,11 @@ export default function CreateOrganizationPage() { const { toast } = useToast(); const data = useLazyLoadQuery( viewerQuery, - {}, + {} ); const [createOrganization] = useMutation( - createOrganizationMutation, + createOrganizationMutation ); const [formData, setFormData] = useState({ name: "", @@ -114,7 +114,7 @@ export default function CreateOrganizationPage() { connections: [ ConnectionHandler.getConnectionID( data.viewer.id, - "TeamSwitcher_organizations", + "OrganizationSwitcher_organizations" ), ], },