-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(): adds entity discussion settings (#1221)
* feat(hub-common): adds discussion settings support for entities affects: @esri/hub-common * refactor(): returns buildUiSchema * feat(): control site disableDiscussions setting on entity * test(hub-common): update tests for discussions schema affects: @esri/hub-common * feat(hub-common): add discussion settings for isDiscussable affects: @esri/hub-common * refactor(hub-common): remove optional chaining affects: @esri/hub-common
- Loading branch information
Showing
35 changed files
with
450 additions
and
85 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
packages/common/src/content/_internal/ContentUiSchemaDiscussions.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { IHubEditableContent } from "../../core/types"; | ||
import { IArcGISContext } from "../../ArcGISContext"; | ||
import { IUiSchema } from "../../core/schemas/types"; | ||
|
||
/** | ||
* @private | ||
* settings uiSchema for Hub Discussions - this | ||
* defines how the schema properties should be | ||
* rendered in the Discussions settings experience | ||
*/ | ||
export const buildUiSchema = async ( | ||
i18nScope: string, | ||
entity: IHubEditableContent, | ||
context: IArcGISContext | ||
): Promise<IUiSchema> => { | ||
return { | ||
type: "Layout", | ||
elements: [ | ||
{ | ||
type: "Section", | ||
labelKey: `${i18nScope}.sections.discussions.label`, | ||
elements: [ | ||
{ | ||
labelKey: `${i18nScope}.fields.discussable.label`, | ||
scope: "/properties/isDiscussable", | ||
type: "Control", | ||
options: { | ||
control: "hub-field-input-radio", | ||
labels: [ | ||
`{{${i18nScope}.fields.discussable.enabled.label:translate}}`, | ||
`{{${i18nScope}.fields.discussable.disabled.label:translate}}`, | ||
], | ||
descriptions: [ | ||
`{{${i18nScope}.fields.discussable.enabled.description:translate}}`, | ||
`{{${i18nScope}.fields.discussable.disabled.description:translate}}`, | ||
], | ||
icons: ["speech-bubbles", "circle-disallowed"], | ||
}, | ||
}, | ||
], | ||
}, | ||
], | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
packages/common/src/discussions/_internal/DiscussionUiSchemaSettings.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { IHubDiscussion } from "../../core/types"; | ||
import { IArcGISContext } from "../../ArcGISContext"; | ||
import { IUiSchema } from "../../core/schemas/types"; | ||
|
||
/** | ||
* @private | ||
* settings uiSchema for Hub Discussions - this | ||
* defines how the schema properties should be | ||
* rendered in the Discussions settings experience | ||
*/ | ||
export const buildUiSchema = async ( | ||
i18nScope: string, | ||
entity: IHubDiscussion, | ||
context: IArcGISContext | ||
): Promise<IUiSchema> => { | ||
return { | ||
type: "Layout", | ||
elements: [ | ||
{ | ||
type: "Section", | ||
labelKey: `${i18nScope}.sections.settings.label`, | ||
elements: [ | ||
{ | ||
labelKey: `${i18nScope}.fields.discussable.label`, | ||
scope: "/properties/isDiscussable", | ||
type: "Control", | ||
options: { | ||
control: "hub-field-input-radio", | ||
labels: [ | ||
`{{${i18nScope}.fields.discussable.enabled.label:translate}}`, | ||
`{{${i18nScope}.fields.discussable.disabled.label:translate}}`, | ||
], | ||
descriptions: [ | ||
`{{${i18nScope}.fields.discussable.enabled.description:translate}}`, | ||
`{{${i18nScope}.fields.discussable.disabled.description:translate}}`, | ||
], | ||
icons: ["speech-bubbles", "circle-disallowed"], | ||
}, | ||
}, | ||
], | ||
}, | ||
], | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.