Skip to content

Commit

Permalink
feat(): update projects schema (#1354)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarvinPerry authored Dec 8, 2023
1 parent 02bb6bf commit 8904324
Show file tree
Hide file tree
Showing 5 changed files with 126 additions and 3 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export const HubItemEntitySchema: IConfigurationSchema = {
default: HubEntityHero.map,
enum: Object.keys(HubEntityHero),
},
heroActions: { type: "array" },
},
},
},
Expand Down
7 changes: 6 additions & 1 deletion packages/common/src/core/traits/IWithViewSettings.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { HubEntityHero } from "../../types";
import { IHubTimeline, IMetricDisplayConfig } from "../types";
import { IHubTimeline, IMetricDisplayConfig, HubActionLink } from "../types";

/**
* Properties to be exclusively displayed on an entity's
Expand Down Expand Up @@ -44,4 +44,9 @@ export interface IWithViewSettings {
* what to show in the hero field, map/image
*/
hero?: HubEntityHero;

/**
* array of actions for action links
*/
heroActions?: HubActionLink[];
}
39 changes: 39 additions & 0 deletions packages/common/src/projects/_internal/ProjectUiSchemaEdit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,45 @@ export const buildUiSchema = async (
},
],
},
{
type: "Section",
labelKey: `${i18nScope}.sections.callToAction.label`,
options: {
helperText: {
labelKey: `${i18nScope}.sections.callToAction.helperText`,
},
},
elements: [
{
scope: "/properties/view/properties/heroActions",
type: "Control",
options: {
control: "hub-composite-input-action-links",
type: "button",
catalogs: getFeaturedContentCatalogs(context.currentUser), // for now we'll just re-use this util to get the catalogs
facets: [
{
label: `{{${i18nScope}.fields.callToAction.facets.type:translate}}`,
key: "type",
display: "multi-select",
field: "type",
options: [],
operation: "OR",
aggLimit: 100,
},
{
label: `{{${i18nScope}.fields.callToAction.facets.sharing:translate}}`,
key: "access",
display: "multi-select",
field: "access",
options: [],
operation: "OR",
},
],
},
},
],
},
],
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,45 @@ describe("buildUiSchema: project edit", () => {
},
],
},
{
type: "Section",
labelKey: "some.scope.sections.callToAction.label",
options: {
helperText: {
labelKey: "some.scope.sections.callToAction.helperText",
},
},
elements: [
{
scope: "/properties/view/properties/heroActions",
type: "Control",
options: {
control: "hub-composite-input-action-links",
type: "button",
catalogs: {},
facets: [
{
label: `{{some.scope.fields.callToAction.facets.type:translate}}`,
key: "type",
display: "multi-select",
field: "type",
options: [],
operation: "OR",
aggLimit: 100,
},
{
label: `{{some.scope.fields.callToAction.facets.sharing:translate}}`,
key: "access",
display: "multi-select",
field: "access",
options: [],
operation: "OR",
},
],
},
},
],
},
],
});
});
Expand Down Expand Up @@ -550,6 +589,45 @@ describe("buildUiSchema: project edit", () => {
},
],
},
{
type: "Section",
labelKey: "some.scope.sections.callToAction.label",
options: {
helperText: {
labelKey: "some.scope.sections.callToAction.helperText",
},
},
elements: [
{
scope: "/properties/view/properties/heroActions",
type: "Control",
options: {
control: "hub-composite-input-action-links",
type: "button",
catalogs: {},
facets: [
{
label: `{{some.scope.fields.callToAction.facets.type:translate}}`,
key: "type",
display: "multi-select",
field: "type",
options: [],
operation: "OR",
aggLimit: 100,
},
{
label: `{{some.scope.fields.callToAction.facets.sharing:translate}}`,
key: "access",
display: "multi-select",
field: "access",
options: [],
operation: "OR",
},
],
},
},
],
},
],
});
});
Expand Down

0 comments on commit 8904324

Please sign in to comment.