Skip to content
This repository was archived by the owner on Feb 6, 2024. It is now read-only.

Commit be241d5

Browse files
Merge pull request #1072 from deckgo/feat/publish-templates-to-api
feat: publish templates to api
2 parents 44c334a + 6b191f4 commit be241d5

File tree

14 files changed

+206
-74
lines changed

14 files changed

+206
-74
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
### Others
2020

2121
- cli: v2.1.1 ([CHANGELOG](https://github.com/deckgo/deckdeckgo/blob/master/cli/CHANGELOG.md))
22-
- cloud: v2.0.0 ([CHANGELOG](https://github.com/deckgo/deckdeckgo/blob/master/cloud/CHANGELOG.md))
22+
- cloud: v2.1.0 ([CHANGELOG](https://github.com/deckgo/deckdeckgo/blob/master/cloud/CHANGELOG.md))
2323
- deck-utils: v3.3.1 ([CHANGELOG](https://github.com/deckgo/deckdeckgo/blob/master/utils/deck/CHANGELOG.md))
2424
- kit: v2.0.3 ([CHANGELOG](https://github.com/deckgo/deckdeckgo/blob/master/kit/CHANGELOG.md))
2525
- starter kit: v7.1.4 ([CHANGELOG](https://github.com/deckgo/starter-kit/blob/master/CHANGELOG.md))

cloud/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
<a name="2.1.0"></a>
2+
3+
# 2.1.0 (2021-01-31)
4+
5+
- publish templates to API
6+
17
<a name="2.0.0"></a>
28

39
# 2.0.0 (2021-01-29)

cloud/functions/.gitignore

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
## Compiled JavaScript files
2-
**/*.js
3-
**/*.js.map
2+
lib/
43

54
# Typescript v1 declaration files
65
typings/
76

8-
node_modules/
7+
node_modules/

cloud/functions/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cloud/functions/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"name": "functions",
3-
"version": "2.0.0",
3+
"version": "2.1.0",
44
"scripts": {
5+
"prebuild": "node ./scripts/copy-templates.js",
56
"lint": "tslint --project tsconfig.json",
67
"build": "tsc",
78
"serve": "npm run build && firebase serve --only functions",
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env node
2+
3+
const fs = require('fs');
4+
5+
fs.copyFileSync('../../studio/src/assets/templates.json', './src/assets/templates.json');
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"community": [
3+
{
4+
"id": "db8abf75-5372-41be-8ee6-799b4884882c",
5+
"data": {
6+
"tag": "deckgo-slide-countdown",
7+
"author": {
8+
"name": "Gaurav Mahto",
9+
"url": "https://github.com/gauravmahto"
10+
},
11+
"cdn": "https://unpkg.com/@deckdeckgo/slide-countdown@latest/dist/deckdeckgo-slide-countdown/deckdeckgo-slide-countdown.esm.js",
12+
"props": [
13+
{
14+
"name": "days",
15+
"type": "number",
16+
"placeholder": "The amount of days before your presentations"
17+
},
18+
{
19+
"name": "hours",
20+
"type": "number",
21+
"placeholder": "The amount of hours before your presentations (max. 23)"
22+
},
23+
{
24+
"name": "minutes",
25+
"type": "number",
26+
"placeholder": "The amount of minutes before your presentations (max. 59)"
27+
},
28+
{
29+
"name": "until",
30+
"type": "string",
31+
"placeholder": "A specific date and time until when your presentation will start (format: 2021-08-27T23:25:59.000+02:00)"
32+
}
33+
],
34+
"slots": [
35+
{
36+
"name": "title",
37+
"placeholder": "Display the remaining time until your presentation",
38+
"types": ["h1", "h2", "h3", "section"]
39+
}
40+
]
41+
}
42+
}
43+
]
44+
}

cloud/functions/src/model/api/api.slide.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ import {SlideAttributes, SlideTemplate} from '../data/slide';
22

33
export interface ApiSlide {
44
content?: string;
5-
template: SlideTemplate;
5+
template: SlideTemplate | string;
66
attributes?: SlideAttributes;
77
}

cloud/functions/src/model/data/slide.ts

Lines changed: 8 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -14,52 +14,22 @@ export enum SlideTemplate {
1414
PLAYGROUND = 'playground',
1515
}
1616

17-
export enum SlideChartType {
18-
LINE = 'line',
19-
PIE = 'pie',
20-
BAR = 'bar',
21-
}
22-
23-
export enum SlideSplitType {
17+
export enum SlideScope {
2418
DEFAULT = 'default',
25-
DEMO = 'demo',
19+
COMMUNITY = 'community',
20+
USER = 'user',
2621
}
2722

28-
export type SlideAttributesYAxisDomain = 'max' | 'extent';
29-
3023
export interface SlideAttributes {
31-
style?: string;
32-
src?: string;
33-
customBackground?: string;
34-
imgSrc?: string;
35-
imgAlt?: string;
36-
37-
content?: string;
38-
customQRCode?: boolean;
39-
40-
type?: SlideChartType | SlideSplitType;
41-
innerRadius?: number;
42-
animation?: boolean;
43-
datePattern?: string;
44-
yAxisDomain?: SlideAttributesYAxisDomain;
45-
smooth?: boolean;
46-
area?: boolean;
47-
ticks?: number;
48-
grid?: boolean;
49-
separator?: string;
50-
51-
vertical?: boolean;
52-
53-
imgMode?: string;
54-
55-
customLoader?: boolean;
56-
57-
theme?: string;
24+
[key: string]: string | number | boolean;
5825
}
5926

6027
export interface SlideData {
6128
content?: string;
62-
template: SlideTemplate;
29+
30+
template: SlideTemplate | string;
31+
scope?: SlideScope;
32+
6333
attributes?: SlideAttributes;
6434

6535
api_id?: string;
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import {firestore} from 'firebase-admin';
2+
3+
export interface TemplateDataSlot {
4+
name: string;
5+
placeholder?: string;
6+
types?: string[];
7+
}
8+
9+
export interface TemplateDataProp {
10+
name: string;
11+
type: 'string' | 'number' | 'boolean';
12+
placeholder?: string;
13+
}
14+
15+
export interface TemplateDataAuthor {
16+
name: string;
17+
url?: string;
18+
}
19+
20+
export interface TemplateData {
21+
owner_id: string;
22+
23+
tag: string;
24+
cdn?: string;
25+
author?: TemplateDataAuthor;
26+
slots?: TemplateDataSlot[];
27+
props?: TemplateDataProp[];
28+
29+
created_at?: firestore.Timestamp;
30+
updated_at?: firestore.Timestamp;
31+
}
32+
33+
export interface Template {
34+
id: string;
35+
ref: firestore.DocumentReference;
36+
data: TemplateData;
37+
}

0 commit comments

Comments
 (0)