Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(): add display config property to interfaces #1643

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions packages/common/src/search/Catalog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
IQuery,
IFilter,
IHubCollection,
IGalleryDisplayConfig,
} from "./types";
import { upgradeCatalogSchema } from "./upgradeCatalogSchema";

Expand Down Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions packages/common/src/search/Collection.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { IArcGISContext } from "../ArcGISContext";
import {
EntityType,
IGalleryDisplayConfig,
IHubCollection,
IHubSearchOptions,
IHubSearchResponse,
Expand Down Expand Up @@ -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
Expand Down
51 changes: 51 additions & 0 deletions packages/common/src/search/types/IHubCatalog.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { CORNERS, DROP_SHADOWS } from "../../core/schemas/shared/enums";
import { WellKnownCollection } from "../wellKnownCatalog";

export interface IHubCatalog {
Expand Down Expand Up @@ -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<Record<EntityType, IQuery>> {}

/**
* 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.
Expand Down Expand Up @@ -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 =
Expand Down
Loading