Skip to content

πŸ“¨ The ultimate agentic social media scheduling tool πŸ€–

feat(org-switcher): widen switcher label/menu and title the Developers screen with the org name

Gilad Resisi6c1c5dd64251
diff --git a/apps/frontend/src/components/layout/organization.selector.tsx b/apps/frontend/src/components/layout/organization.selector.tsx
index 4627ee216..209af5611 100644
--- a/apps/frontend/src/components/layout/organization.selector.tsx
+++ b/apps/frontend/src/components/layout/organization.selector.tsx
@@ -64,14 +64,14 @@ export const OrganizationSelector: FC<{ asOpenSelect?: boolean }> = ({
/>
</svg>
{!!current?.name && (
- <div className="max-w-[120px] truncate">{current.name}</div>
+ <div className="max-w-[240px] truncate">{current.name}</div>
)}
</div>
)}
{data?.length > 1 && (
<div
className={clsx(
- 'hidden py-[12px] px-[12px] group-hover:flex absolute top-[100%] end-0 bg-third border-tableBorder border gap-[12px] cursor-pointer flex-col',
+ 'hidden py-[12px] px-[12px] group-hover:flex absolute top-[100%] end-0 w-max max-w-[400px] bg-third border-tableBorder border gap-[12px] cursor-pointer flex-col',
asOpenSelect ? '!flex !relative max-w-[500px] mx-auto mb-[10px]' : '',
)}
>
@@ -81,7 +81,11 @@ export const OrganizationSelector: FC<{ asOpenSelect?: boolean }> = ({
id: string;
users: { role: 'SUPERADMIN' | 'ADMIN' | 'USER' }[];
}) => (
- <div key={org.id} onClick={changeOrg(org)}>
+ <div
+ key={org.id}
+ onClick={changeOrg(org)}
+ className="whitespace-nowrap truncate"
+ >
{org.name}
{!!org.users?.[0]?.role && (
<span className="text-customColor18">
diff --git a/apps/frontend/src/components/public-api/public.component.tsx b/apps/frontend/src/components/public-api/public.component.tsx
index 41cacdfca..a466df78c 100644
--- a/apps/frontend/src/components/public-api/public.component.tsx
+++ b/apps/frontend/src/components/public-api/public.component.tsx
@@ -1,7 +1,7 @@
'use client';
-import { useState, useCallback } from 'react';
-import { useSWRConfig } from 'swr';
+import { useState, useCallback, useMemo } from 'react';
+import useSWR, { useSWRConfig } from 'swr';
import { useUser } from '../layout/user.context';
import copy from 'copy-to-clipboard';
import { useToaster } from '@gitroom/react/toaster/toaster';
@@ -709,10 +709,29 @@ const PublicApiContent = () => {
export const PublicComponent = () => {
const t = useT();
+ const fetch = useFetch();
+ const user = useUser();
const [subTab, setSubTab] = useState<'api' | 'developer'>('api');
+ const loadOrganizations = useCallback(async () => {
+ return await (await fetch('/user/organizations')).json();
+ }, []);
+ const { data: organizations } = useSWR('organizations', loadOrganizations, {
+ revalidateIfStale: false,
+ revalidateOnFocus: false,
+ refreshWhenOffline: false,
+ refreshWhenHidden: false,
+ revalidateOnReconnect: false,
+ });
+ const currentOrg = useMemo(() => {
+ return organizations?.find((org: any) => org.id === user?.orgId);
+ }, [organizations, user?.orgId]);
return (
<div className="flex flex-col gap-[20px]">
+ <h3 className="text-[20px]">
+ {t('developers', 'Developers')}
+ {currentOrg?.name ? ` - ${currentOrg.name}` : ''}
+ </h3>
<div className="flex gap-[6px]">
{(['api', 'developer'] as const).map((tab) => (
<button