-
Notifications
You must be signed in to change notification settings - Fork 672
Expand file tree
/
Copy pathFormCommand.tsx
More file actions
39 lines (33 loc) · 1.08 KB
/
FormCommand.tsx
File metadata and controls
39 lines (33 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import React from "react";
import { Command, RegisterFeature, createFeature } from "webiny/admin";
import { SendMessageDetailView } from "./SendMessageDetailView.js";
interface SendMessageParams {
recipient: string;
message: string;
}
class SendMessageCommand implements Command.Interface {
name = "send-message";
label = "Send Message";
description = "Send a message to someone";
category = "Demo";
keywords = ["send", "message", "form"];
shortcut = "cmd+shift+m";
detailView = SendMessageDetailView;
execute(params?: unknown) {
const { recipient, message } = params as SendMessageParams;
alert(`Message sent to ${recipient}: "${message}"`);
}
}
const SendMessageCommandImpl = Command.createImplementation({
implementation: SendMessageCommand,
dependencies: []
});
const SendMessageCommandFeature = createFeature({
name: "SendMessageCommand",
register(container) {
container.register(SendMessageCommandImpl);
}
});
export default () => {
return <RegisterFeature feature={SendMessageCommandFeature} />;
};