@@ -43,6 +43,19 @@ export const teamSwitcherFragment = graphql`
|
|||||||
type Organization =
|
type Organization =
|
||||||
TeamSwitcher_organizations$data["organizations"]["edges"][0]["node"];
|
TeamSwitcher_organizations$data["organizations"]["edges"][0]["node"];
|
||||||
|
|
||||||
|
const LogoComponent = ({
|
||||||
|
org,
|
||||||
|
className,
|
||||||
|
}: {
|
||||||
|
org: Organization;
|
||||||
|
className?: string;
|
||||||
|
}) => {
|
||||||
|
if (org.logoUrl) {
|
||||||
|
return <img src={org.logoUrl} alt={org.name} className={className} />;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
|
||||||
export function TeamSwitcher({
|
export function TeamSwitcher({
|
||||||
organizations,
|
organizations,
|
||||||
}: {
|
}: {
|
||||||
@@ -58,7 +71,7 @@ export function TeamSwitcher({
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (data.organizations && data.organizations.edges.length > 0) {
|
if (data.organizations && data.organizations.edges.length > 0) {
|
||||||
const org = data.organizations.edges.find(
|
const org = data.organizations.edges.find(
|
||||||
(edge) => edge.node.id === organizationId,
|
(edge) => edge.node.id === organizationId
|
||||||
);
|
);
|
||||||
if (org) {
|
if (org) {
|
||||||
setCurrentOrganization(org.node);
|
setCurrentOrganization(org.node);
|
||||||
@@ -70,19 +83,6 @@ export function TeamSwitcher({
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const LogoComponent = ({
|
|
||||||
org,
|
|
||||||
className,
|
|
||||||
}: {
|
|
||||||
org: Organization;
|
|
||||||
className?: string;
|
|
||||||
}) => {
|
|
||||||
if (org.logoUrl) {
|
|
||||||
return <img src={org.logoUrl} alt={org.name} className={className} />;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleOrganizationSwitch = (org: Organization) => {
|
const handleOrganizationSwitch = (org: Organization) => {
|
||||||
navigate(`/organizations/${org.id}`);
|
navigate(`/organizations/${org.id}`);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user