Skip to content

Commit

Permalink
feat(hub-common): add register button
Browse files Browse the repository at this point in the history
  • Loading branch information
juliannaeapicella committed May 24, 2024
1 parent db8646c commit 6119b3a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/common/src/core/types/ActionLinks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ interface IHubBaseActionLink {
description?: string;
/** action icon */
icon?: string;
/** whether or not to disable the button */
disabled?: string;
}

/**
Expand Down
13 changes: 13 additions & 0 deletions packages/common/src/events/HubEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,19 @@ export class HubEvent
*/
async fromEditor(editor: IHubEventEditor): Promise<IHubEvent> {
const entity = cloneObject(editor) as IHubEvent;
// map allowRegistration to heroActions
if (entity.allowRegistration) {
entity.view.heroActions = [
{
kind: "external",
label: "Register",
href: "",
disabled: "true",
},
];
} else {
entity.view.heroActions = [];
}
this.entity = entity;
await this.save();
return this.entity;
Expand Down
3 changes: 3 additions & 0 deletions packages/common/src/events/defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ export function buildDefaultEventEntity(): Partial<IHubEvent> {
readGroupIds: [],
editGroupIds: [],
...dates,
view: {
heroActions: [],
},
};
}

Expand Down

0 comments on commit 6119b3a

Please sign in to comment.