Skip to content

Commit

Permalink
New Components - mural (#14632)
Browse files Browse the repository at this point in the history
* init

* new components

* pnpm-lock.yaml

* fix description
  • Loading branch information
michelle0927 authored Nov 13, 2024
1 parent 420d660 commit b5d455e
Show file tree
Hide file tree
Showing 9 changed files with 655 additions and 8 deletions.
95 changes: 95 additions & 0 deletions components/mural/actions/create-mural/create-mural.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
import mural from "../../mural.app.mjs";

export default {
key: "mural-create-mural",
name: "Create Mural",
description: "Create a new mural within a specified workspace. [See the documentation](https://developers.mural.co/public/reference/createmural)",
version: "0.0.1",
type: "action",
props: {
mural,
workspaceId: {
propDefinition: [
mural,
"workspaceId",
],
},
roomId: {
propDefinition: [
mural,
"roomId",
(c) => ({
workspaceId: c.workspaceId,
}),
],
},
title: {
type: "string",
label: "Title",
description: "The title of the Mural.",
},
backgroundColor: {
type: "string",
label: "Background Color",
description: "The background color of the mural. Example: `#FAFAFAFF`",
optional: true,
},
height: {
type: "integer",
label: "Height",
description: "The height of the mural in px",
optional: true,
},
width: {
type: "integer",
label: "Width",
description: "The width of the mural in px",
optional: true,
},
infinite: {
type: "boolean",
label: "Infinite",
description: "When `true`, this indicates that the mural canvas is borderless and grows as you add widgets to it.",
optional: true,
},
timerSoundTheme: {
type: "string",
label: "Timer Sound Theme",
description: "The timer sound theme for the mural",
options: [
"airplane",
"cello",
"cuckoo",
],
optional: true,
},
visitorAvatarTheme: {
type: "string",
label: "Visitor Avatar Theme",
description: "The visitor avatar theme for the mural",
options: [
"animals",
"music",
"travel",
],
optional: true,
},
},
async run({ $ }) {
const response = await this.mural.createMural({
$,
data: {
roomId: this.roomId,
title: this.title,
backgroundColor: this.backgroundColor,
height: this.height,
width: this.width,
infinite: this.infinite,
timerSoundTheme: this.timerSoundTheme,
visitorAvatarTheme: this.visitorAvatarTheme,
},
});
$.export("$summary", `Successfully created mural "${this.title}"`);
return response;
},
};
117 changes: 117 additions & 0 deletions components/mural/actions/create-sticky/create-sticky.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
import mural from "../../mural.app.mjs";

export default {
key: "mural-create-sticky",
name: "Create Sticky",
description: "Create a new sticky note within a given mural. [See the documentation](https://developers.mural.co/public/reference/createstickynote)",
version: "0.0.1",
type: "action",
props: {
mural,
workspaceId: {
propDefinition: [
mural,
"workspaceId",
],
},
muralId: {
propDefinition: [
mural,
"muralId",
(c) => ({
workspaceId: c.workspaceId,
}),
],
},
shape: {
type: "string",
label: "Shape",
description: "The shape of the sticky note widget",
options: [
"circle",
"rectangle",
],
},
xPosition: {
type: "integer",
label: "X Position",
description: "The horizontal position of the widget in px. This is the distance from the left of the parent widget, such as an area. If the widget has no parent widget, this is the distance from the left of the mural.",
},
yPosition: {
type: "integer",
label: "Y Position",
description: "The vertical position of the widget in px. This is the distance from the top of the parent widget, such as an area. If the widget has no parent widget, this is the distance from the top of the mural.",
},
text: {
type: "string",
label: "Text",
description: "The text in the widget",
},
title: {
type: "string",
label: "Title",
description: "The title of the widget in the outline",
optional: true,
},
height: {
type: "integer",
label: "Height",
description: "The height of the widget in px",
optional: true,
},
width: {
type: "integer",
label: "Width",
description: "The width of the widget in px",
optional: true,
},
hidden: {
type: "boolean",
label: "Hidden",
description: "If `true`, the widget is hidden from non-facilitators. Applies only when the widget is in the outline",
optional: true,
},
tagIds: {
propDefinition: [
mural,
"tagIds",
(c) => ({
muralId: c.muralId,
}),
],
},
parentId: {
propDefinition: [
mural,
"widgetId",
(c) => ({
muralId: c.muralId,
type: "areas",
}),
],
label: "Parent ID",
description: "The ID of the area widget that contains the widget",
},
},
async run({ $ }) {
const response = await this.mural.createSticky({
$,
muralId: this.muralId,
data: [
{
shape: this.shape,
x: this.xPosition,
y: this.yPosition,
text: this.text,
title: this.title,
height: this.height,
width: this.width,
hidden: this.hidden,
parentId: this.parentId,
},
],
});
$.export("$summary", `Successfully created sticky note with ID: ${response.value[0].id}`);
return response;
},
};
Loading

0 comments on commit b5d455e

Please sign in to comment.