Skip to content

Commit

Permalink
Hide reporting tab from create new agency flow
Browse files Browse the repository at this point in the history
  • Loading branch information
nasaownsky committed Feb 7, 2025
1 parent d120d86 commit 5418e26
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 12 deletions.
25 changes: 14 additions & 11 deletions common/components/TabbedBar/TabbedBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,20 @@ type TabbedBarProps = {
export function TabbedBar({ options, size }: TabbedBarProps) {
return (
<Styled.TabsContainer>
{options.map(({ key, label, onClick, selected, enabled, indicator }) => (
<Styled.Tab
key={key}
onClick={onClick}
selected={selected}
enabled={enabled}
size={size}
>
{label} {indicator}
</Styled.Tab>
))}
{options.map(
({ key, label, onClick, selected, enabled, indicator, hide }) =>
!hide ? (
<Styled.Tab
key={key}
onClick={onClick}
selected={selected}
enabled={enabled}
size={size}
>
{label} {indicator}
</Styled.Tab>
) : null
)}
</Styled.TabsContainer>
);
}
1 change: 1 addition & 0 deletions common/components/TabbedBar/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export type TabOption = {
selected: boolean;
enabled?: boolean;
indicator?: React.ReactNode;
hide?: boolean;
};

export type TabbedBarSize = "medium" | "large";
5 changes: 5 additions & 0 deletions publisher/src/components/AdminPanel/AdminPanel.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,7 @@ test("Clicking on an existing agency card opens the edit agency modal", async ()

await waitFor(() => {
adminPanelStore.teamMemberListLoading = false;
adminPanelStore.reportingAgencyMetadataLoading = false;
});

const editAgencyModalTitle = screen.getByText("Edit Agency Information");
Expand Down Expand Up @@ -770,6 +771,7 @@ test("Team members tab renders with add/remove buttons and users who are connect

await waitFor(() => {
adminPanelStore.teamMemberListLoading = false;
adminPanelStore.reportingAgencyMetadataLoading = false;
});

const teamMemberRolesTab = screen.getByText("Team Members & Roles");
Expand Down Expand Up @@ -806,6 +808,7 @@ test("Adding a user adds a card to the list of team members", async () => {

await waitFor(() => {
adminPanelStore.teamMemberListLoading = false;
adminPanelStore.reportingAgencyMetadataLoading = false;
});

const teamMemberRolesTab = screen.getByText("Team Members & Roles");
Expand Down Expand Up @@ -855,6 +858,7 @@ test("Deleting a user deletes a card to the list of team members", async () => {

await waitFor(() => {
adminPanelStore.teamMemberListLoading = false;
adminPanelStore.reportingAgencyMetadataLoading = false;
});

const teamMemberRolesTab = screen.getByText("Team Members & Roles");
Expand Down Expand Up @@ -911,6 +915,7 @@ test("Loading spinner works properly in Agency Provisioning", async () => {

await waitFor(() => {
adminPanelStore.teamMemberListLoading = false;
adminPanelStore.reportingAgencyMetadataLoading = false;
});

const teamMemberRolesTab = screen.getByText("Team Members & Roles");
Expand Down
2 changes: 2 additions & 0 deletions publisher/src/components/AdminPanel/AgencyProvisioning.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ export const AgencyProvisioning: React.FC<ProvisioningProps> = observer(
selected:
currentSettingType ===
AgencyProvisioningSettings.METRICS_REPORTING_AGENCY,
/** Hide metrics reporting agency tab when creating a new agency */
hide: !selectedIDToEdit,
},
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ export const AgencyProvisioningOverview = observer(() => {
onClick={() => {
// Fetch the team associations for the agency.
adminPanelStore.fetchAgencyTeam(String(agency.id));
// Fetch the metrics reporting agency metadata
adminPanelStore.fetchReportingAgency(String(agency.id));
editAgency(agency.id);
}}
Expand Down
4 changes: 3 additions & 1 deletion publisher/src/stores/AdminPanelStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class AdminPanelStore {
this.agencyProvisioningUpdates = initialEmptyAgencyProvisioningUpdates;
this.userAgenciesLoading = false;
this.teamMemberListLoading = false;
this.reportingAgencyMetadataLoading = true;
this.reportingAgencyMetadataLoading = false;
}

get users(): UserWithAgenciesByID[] {
Expand Down Expand Up @@ -381,6 +381,8 @@ class AdminPanelStore {

async fetchReportingAgency(agencyID: string) {
try {
this.reportingAgencyMetadataLoading = true;

const response = (await this.api.request({
path: `admin/agency/${agencyID}/reporting-agency`,
method: "GET",
Expand Down

0 comments on commit 5418e26

Please sign in to comment.