-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.ts
53 lines (47 loc) · 1.78 KB
/
index.ts
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import ConfigSchema from "./configSchema.json";
import {
getDocumentProperty,
saveDocumentProperty,
} from "./lib/googleAppsScript";
import { emailProjectLeadsWithSlides } from "./scripts/email/emailProjectLeadsWithSlides";
import {
createSlidesFromLinear,
updateExistingProjectSlide,
} from "./scripts/slides/createSlidesFromLinearInitiatives";
// eslint-disable-next-line @typescript-eslint/no-unused-vars
function onOpen() {
const ui = SlidesApp.getUi();
ui.createAddonMenu()
.addItem("Email Project Leads with Slides", "emailProjectsToUserEmails")
.addItem("Create Linear Slides", "createSlidesFromLinear")
.addItem("Update Project Slide", "updateExistingProjectSlide")
.addItem("Show Configuration", "showConfigDialog")
.addToUi();
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
function onInstall() {
onOpen();
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const Scripts = {
emailProjectsToUserEmails: emailProjectLeadsWithSlides,
createSlidesFromLinear: createSlidesFromLinear,
updateExistingProjectSlide: updateExistingProjectSlide,
};
// eslint-disable-next-line @typescript-eslint/no-unused-vars
function showConfigDialog() {
const html = HtmlService.createTemplateFromFile("config");
const output = html.evaluate().setWidth(400).setHeight(300);
SlidesApp.getUi().showModalDialog(output, "Configuration Settings");
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
function getConfig() {
return {
configSchema: ConfigSchema,
configSettings: getDocumentProperty("configSettings"),
};
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
function saveConfig(settings: string) {
saveDocumentProperty("configSettings", settings);
}