Skip to content

Commit

Permalink
feat: added alert to download manifest (#4093)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fran McDade authored and Fran McDade committed Aug 5, 2024
1 parent ec034a2 commit 79bcecc
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -764,6 +764,29 @@ export const buildManifestDownloadEntity = (
};
};

/**
* Build props for entity related download manifest warning FluidAlert component.
* @param _ - Unused.
* @param viewContext - View context.
* @returns model to be used as props for the FluidAlert component.
*/
export const buildManifestDownloadEntityWarning = (
_: DatasetsResponse,
viewContext: ViewContext
): React.ComponentProps<typeof C.FluidAlert> => {
const {
authState: { isAuthenticated },
} = viewContext;
const title = isAuthenticated
? "To download this dataset manifest, please request access."
: "To download this dataset manifest, please sign in and, if necessary, request access.";
return {
severity: "warning",
title,
variant: "banner",
};
};

/**
* Build props for organism type cell component from the given donors response.
* @param response - Response model return from index/donors API endpoint.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const mainColumn: ComponentConfig[] = [
children: [
{
component: C.FluidAlert,
viewBuilder: V.buildExportEntityWarning, // TODO: Implement warning?
viewBuilder: V.buildManifestDownloadEntityWarning,
} as ComponentConfig<typeof C.FluidAlert, DatasetsResponse>,
],
component: C.BackPageContentSingleColumn,
Expand Down

0 comments on commit 79bcecc

Please sign in to comment.