diff --git a/packages/common/src/search/Catalog.ts b/packages/common/src/search/Catalog.ts index 65940afed8a..92caa3bab8f 100644 --- a/packages/common/src/search/Catalog.ts +++ b/packages/common/src/search/Catalog.ts @@ -20,6 +20,7 @@ import { IQuery, IFilter, IHubCollection, + IGalleryDisplayConfig, } from "./types"; import { upgradeCatalogSchema } from "./upgradeCatalogSchema"; @@ -121,6 +122,13 @@ export class Catalog implements IHubCatalog { return Object.keys(this.scopes || {}) as unknown as EntityType[]; } + /** + * Return the display configuration for the Catalog + */ + get displayConfig(): IGalleryDisplayConfig { + return this._catalog.displayConfig; + } + /** * Get the scope's query for a particular entity type * @param type diff --git a/packages/common/src/search/Collection.ts b/packages/common/src/search/Collection.ts index 2c4872f86b8..137a6faf69f 100644 --- a/packages/common/src/search/Collection.ts +++ b/packages/common/src/search/Collection.ts @@ -1,6 +1,7 @@ import { IArcGISContext } from "../ArcGISContext"; import { EntityType, + IGalleryDisplayConfig, IHubCollection, IHubSearchOptions, IHubSearchResponse, @@ -68,6 +69,9 @@ export class Collection implements IHubCollection { public get targetEntity(): EntityType { return this._collection.targetEntity; } + public get displayConfig(): IGalleryDisplayConfig { + return this._collection.displayConfig; + } /** * Search the collection using a string or IQuery diff --git a/packages/common/src/search/types/IHubCatalog.ts b/packages/common/src/search/types/IHubCatalog.ts index 108ad4eb58e..29a28186c54 100644 --- a/packages/common/src/search/types/IHubCatalog.ts +++ b/packages/common/src/search/types/IHubCatalog.ts @@ -1,3 +1,4 @@ +import { CORNERS, DROP_SHADOWS } from "../../core/schemas/shared/enums"; import { WellKnownCollection } from "../wellKnownCatalog"; export interface IHubCatalog { @@ -31,10 +32,56 @@ export interface IHubCatalog { scopes: string; collections: string; }; + /** + * Optional entries to control a catalog's appearance in the UI + */ + displayConfig?: IGalleryDisplayConfig; } export interface ICatalogScope extends Partial> {} +/** + * Configuration for how to display a gallery. This can apply to any gallery's display, + * including a catalog, a collection, or a gallery card. + */ +export interface IGalleryDisplayConfig { + /** + * Optional override prop needed for things like collections; when true, the collection will utilize + * its own display configuration instead of the catalog's default display configuration + */ + override?: boolean; + + /** + * Whether or not the current item is hidden in the gallery display. i.e. + * if this is true on a collection's display config, that collection will not be displayed in the gallery. + */ + hidden?: boolean; + + /** + * List of IFacet keys that will be used to build IFacets and display facets in the gallery experience + */ + facets?: string[]; + + /** + * Determines the type of corners for the cards in the gallery + */ + corners?: CORNERS; + + /** + * Determines the type of drop shadow for the cards in the gallery + */ + dropShadow?: DROP_SHADOWS; + + /** + * Determines whether to display a thumbnail or an icon for the cards in the gallery + */ + image?: "thumbnail" | "icon"; + + /** + * Future display props can be added here (heading size, possible gallery layouts, etc.) + */ +} + export interface IHubCollection { /** * String to show in the UI. translated. @@ -65,6 +112,10 @@ export interface IHubCollection { * ensure we query the correct API */ targetEntity: EntityType; + /** + * Optional entries to control a collection's appearance in the UI + */ + displayConfig?: IGalleryDisplayConfig; } export type EntityType =