@saasquatch/mint-components 1.3.2-1 → 1.3.2-5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/mint-components.cjs.js +1 -1
- package/dist/cjs/sqm-big-stat.cjs.entry.js +1 -1
- package/dist/cjs/{sqm-divided-layout_27.cjs.entry.js → sqm-divided-layout_28.cjs.entry.js} +976 -395
- package/dist/cjs/{useDemoBigStat-17e61803.js → useDemoBigStat-ade0e873.js} +90 -20
- package/dist/collection/components/sqm-big-stat/BigStat.stories.js +8 -1
- package/dist/collection/components/sqm-big-stat/sqm-big-stat.js +1 -1
- package/dist/collection/components/sqm-big-stat/useBigStat.js +89 -20
- package/dist/collection/components/sqm-big-stat/useDemoBigStat.js +1 -0
- package/dist/collection/components/sqm-reward-exchange-list/SVGs.js +5 -14
- package/dist/collection/components/sqm-reward-exchange-list/progressBar.js +27 -40
- package/dist/collection/components/sqm-reward-exchange-list/sqm-reward-exchange-list-view.js +68 -47
- package/dist/collection/components/sqm-reward-exchange-list/sqm-reward-exchange-list.js +2 -1
- package/dist/collection/components/sqm-reward-exchange-list/useRewardExchangeList.js +3 -1
- package/dist/collection/components/sqm-stencilbook/CucumberAddon.js +3 -1
- package/dist/collection/components/sqm-stencilbook/sqm-stencilbook.js +4 -0
- package/dist/collection/components/sqm-task-card/SVGs.js +0 -6
- package/dist/collection/components/sqm-task-card/TaskCard.stories.js +74 -243
- package/dist/collection/components/sqm-task-card/UseTaskCard.stories.js +41 -0
- package/dist/collection/components/sqm-task-card/progress-bar/SVGs.js +7 -0
- package/dist/collection/components/sqm-task-card/progress-bar/progress-bar-view.js +311 -0
- package/dist/collection/components/sqm-task-card/progress-bar/progress-bar.stories.js +53 -0
- package/dist/collection/components/sqm-task-card/sqm-task-card-view.js +15 -309
- package/dist/collection/components/sqm-task-card/sqm-task-card.js +108 -48
- package/dist/collection/stories/NewPortal.stories.js +15 -15
- package/dist/esm/loader.js +1 -1
- package/dist/esm/mint-components.js +1 -1
- package/dist/esm/sqm-big-stat.entry.js +1 -1
- package/dist/esm/{sqm-divided-layout_27.entry.js → sqm-divided-layout_28.entry.js} +940 -360
- package/dist/esm/{useDemoBigStat-b71fe122.js → useDemoBigStat-256c096f.js} +90 -20
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/mint-components.js +1 -1
- package/dist/esm-es5/sqm-big-stat.entry.js +1 -1
- package/dist/esm-es5/sqm-divided-layout_28.entry.js +1 -0
- package/dist/esm-es5/useDemoBigStat-256c096f.js +1 -0
- package/dist/mint-components/mint-components.esm.js +1 -1
- package/dist/mint-components/p-29523e7f.entry.js +288 -0
- package/dist/mint-components/{p-e22eed7b.entry.js → p-52f23baa.entry.js} +1 -1
- package/dist/mint-components/p-7766f602.system.js +1 -0
- package/dist/mint-components/p-7d486e02.system.entry.js +1 -0
- package/dist/mint-components/p-917488e5.js +227 -0
- package/dist/mint-components/p-91d39961.system.js +1 -1
- package/dist/mint-components/p-a6156ea3.system.entry.js +1 -0
- package/dist/types/components/sqm-big-stat/sqm-big-stat-view.d.ts +1 -0
- package/dist/types/components/sqm-big-stat/useBigStat.d.ts +4 -1
- package/dist/types/components/sqm-reward-exchange-list/SVGs.d.ts +1 -0
- package/dist/types/components/sqm-reward-exchange-list/progressBar.d.ts +3 -2
- package/dist/types/components/sqm-reward-exchange-list/sqm-reward-exchange-list-view.d.ts +1 -0
- package/dist/types/components/sqm-task-card/SVGs.d.ts +0 -1
- package/dist/types/components/sqm-task-card/TaskCard.stories.d.ts +3 -1
- package/dist/types/components/sqm-task-card/UseTaskCard.stories.d.ts +10 -0
- package/dist/types/components/sqm-task-card/progress-bar/SVGs.d.ts +1 -0
- package/dist/types/components/sqm-task-card/progress-bar/progress-bar-view.d.ts +9 -0
- package/dist/types/components/sqm-task-card/progress-bar/progress-bar.stories.d.ts +12 -0
- package/dist/types/components/sqm-task-card/sqm-task-card-view.d.ts +13 -22
- package/dist/types/components/sqm-task-card/sqm-task-card.d.ts +25 -13
- package/dist/types/components.d.ts +48 -34
- package/grapesjs/grapesjs.js +1 -1
- package/package.json +1 -1
- package/dist/cjs/sqm-task-card-view-57066e67.js +0 -476
- package/dist/cjs/sqm-task-card.cjs.entry.js +0 -56
- package/dist/esm/sqm-task-card-view-2ee495af.js +0 -474
- package/dist/esm/sqm-task-card.entry.js +0 -52
- package/dist/esm-es5/sqm-divided-layout_27.entry.js +0 -1
- package/dist/esm-es5/sqm-task-card-view-2ee495af.js +0 -1
- package/dist/esm-es5/sqm-task-card.entry.js +0 -1
- package/dist/esm-es5/useDemoBigStat-b71fe122.js +0 -1
- package/dist/mint-components/p-1e248afc.system.entry.js +0 -1
- package/dist/mint-components/p-353b4413.system.js +0 -1
- package/dist/mint-components/p-405a9253.js +0 -227
- package/dist/mint-components/p-684850a7.entry.js +0 -287
- package/dist/mint-components/p-81dbda90.system.entry.js +0 -1
- package/dist/mint-components/p-8f5e2af4.entry.js +0 -1
- package/dist/mint-components/p-c9c4f31b.system.entry.js +0 -1
- package/dist/mint-components/p-e78a5a91.js +0 -1
- package/dist/mint-components/p-f87d8f53.system.js +0 -1
|
@@ -3,9 +3,10 @@ import jss from "jss";
|
|
|
3
3
|
import preset from "jss-preset-default";
|
|
4
4
|
import { HostBlock } from "../../global/mixins";
|
|
5
5
|
import * as SVGs from "./SVGs";
|
|
6
|
-
|
|
7
|
-
export function TaskCardView(props
|
|
8
|
-
const { points
|
|
6
|
+
import { ProgressBarView, } from "./progress-bar/progress-bar-view";
|
|
7
|
+
export function TaskCardView(props) {
|
|
8
|
+
const { points, cardTitle, description, showProgressBar, progress = 0, goal, rewardUnit, repeatable, showExpire, dateExpires, buttonText, buttonLink, loading, } = props;
|
|
9
|
+
console.log({ props });
|
|
9
10
|
const checkmark_circle = SVGs.checkmark_circle();
|
|
10
11
|
const arrow_left_right = SVGs.arrow_left_right();
|
|
11
12
|
const style = {
|
|
@@ -48,6 +49,7 @@ export function TaskCardView(props, children) {
|
|
|
48
49
|
},
|
|
49
50
|
"& .text": {
|
|
50
51
|
alignSelf: "end",
|
|
52
|
+
textTransform: "uppercase",
|
|
51
53
|
color: "var(--sl-color-gray-600)",
|
|
52
54
|
fontSize: "var(--sl-font-size-x-small)",
|
|
53
55
|
lineHeight: "var(--sl-font-size-medium)",
|
|
@@ -60,11 +62,7 @@ export function TaskCardView(props, children) {
|
|
|
60
62
|
},
|
|
61
63
|
Footer: {
|
|
62
64
|
display: "flex",
|
|
63
|
-
"& span": {
|
|
64
|
-
verticalAlign: "text-bottom",
|
|
65
|
-
},
|
|
66
65
|
"& .icon": {
|
|
67
|
-
verticalAlign: "bottom",
|
|
68
66
|
fontSize: "var(--sl-font-size-xx-small)",
|
|
69
67
|
marginRight: "var(--sl-spacing-xx-small)",
|
|
70
68
|
},
|
|
@@ -88,19 +86,18 @@ export function TaskCardView(props, children) {
|
|
|
88
86
|
jss.setup(preset());
|
|
89
87
|
const sheet = jss.createStyleSheet(style);
|
|
90
88
|
const styleString = sheet.toString();
|
|
91
|
-
// if showProgressBar is false: progress >= goal
|
|
92
|
-
// if true
|
|
93
89
|
const showComplete = progress >= goal;
|
|
94
90
|
const repetitions = showProgressBar ? Math.floor(progress / goal) : progress;
|
|
91
|
+
console.log({ showProgressBar, loading });
|
|
95
92
|
return (h("div", { class: sheet.classes.TaskCard },
|
|
96
93
|
h("div", { class: showComplete ? "main complete" : "main" },
|
|
97
94
|
h("style", { type: "text/css" }, styleString),
|
|
98
95
|
h("div", { class: sheet.classes.Header },
|
|
99
|
-
showComplete &&
|
|
96
|
+
showComplete && h("span", { class: "icon" }, checkmark_circle),
|
|
100
97
|
h("span", { class: "value" }, points),
|
|
101
|
-
h("span", { class: "text" },
|
|
98
|
+
h("span", { class: "text" }, rewardUnit)),
|
|
102
99
|
h("div", { class: sheet.classes.Title }, cardTitle),
|
|
103
|
-
showProgressBar && h(
|
|
100
|
+
showProgressBar && loading ? (h("sl-skeleton", { style: { width: "98%", margin: "0 auto" } })) : (showProgressBar && h(ProgressBarView, Object.assign({}, props))),
|
|
104
101
|
h(Details, { description: description }),
|
|
105
102
|
h("div", { class: sheet.classes.Footer },
|
|
106
103
|
h("span", { class: "text" },
|
|
@@ -109,22 +106,17 @@ export function TaskCardView(props, children) {
|
|
|
109
106
|
h("span", null,
|
|
110
107
|
"Completed ",
|
|
111
108
|
repetitions,
|
|
112
|
-
" times"),
|
|
113
|
-
|
|
114
|
-
h("span", null,
|
|
115
|
-
"Earned ",
|
|
116
|
-
points * repetitions,
|
|
117
|
-
" SaaSquatch Points"))),
|
|
118
|
-
expire && (h("span", null,
|
|
119
|
-
h("br", null),
|
|
109
|
+
" times"))),
|
|
110
|
+
showExpire && (h("span", null,
|
|
120
111
|
"Ends ",
|
|
121
112
|
" ",
|
|
122
|
-
|
|
123
|
-
h("sl-button", { class: "action", size: "small", onClick: () => alert(buttonLink), disabled: showComplete }, showComplete
|
|
113
|
+
dateExpires))),
|
|
114
|
+
h("sl-button", { class: "action", size: "small", onClick: () => alert(buttonLink), disabled: showComplete && repeatable == false }, showComplete && repeatable == false
|
|
115
|
+
? "Task completed"
|
|
116
|
+
: buttonText)))));
|
|
124
117
|
}
|
|
125
118
|
function Details(props) {
|
|
126
119
|
const style = {
|
|
127
|
-
HostBlock: HostBlock,
|
|
128
120
|
Description: {
|
|
129
121
|
"& input[type=checkbox]": {
|
|
130
122
|
display: "none",
|
|
@@ -170,289 +162,3 @@ function Details(props) {
|
|
|
170
162
|
h("sl-icon", { name: "chevron-down" })),
|
|
171
163
|
h("span", { class: "summary" }, props.description))));
|
|
172
164
|
}
|
|
173
|
-
export function ProgressBar(props) {
|
|
174
|
-
const { goal, progress, steps, unit = "", repeatable } = props;
|
|
175
|
-
const gift1 = SVGs.gift();
|
|
176
|
-
const gift2 = SVGs.gift();
|
|
177
|
-
const gift3 = SVGs.gift();
|
|
178
|
-
// if progress and goal are not provided, there cannot be a progress bar
|
|
179
|
-
// if (!showProgressBar) return;
|
|
180
|
-
const items = [];
|
|
181
|
-
var columns = "";
|
|
182
|
-
var repetitions = Math.floor(progress / goal);
|
|
183
|
-
if (repeatable) {
|
|
184
|
-
if (steps) {
|
|
185
|
-
addStepsRepeatable();
|
|
186
|
-
}
|
|
187
|
-
else {
|
|
188
|
-
addLinearRepeatable();
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
// non repetable
|
|
192
|
-
else {
|
|
193
|
-
if (steps) {
|
|
194
|
-
addSteps();
|
|
195
|
-
}
|
|
196
|
-
else {
|
|
197
|
-
addLinear();
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
const style = {
|
|
201
|
-
HostBlock: HostBlock,
|
|
202
|
-
ProgressBar: {
|
|
203
|
-
"& .progress-bar": {
|
|
204
|
-
height: "20px",
|
|
205
|
-
marginTop: "var(--sl-spacing-large)",
|
|
206
|
-
marginRight: "var(--sl-spacing-x-small)",
|
|
207
|
-
marginBottom: "var(--sl-spacing-large)",
|
|
208
|
-
fontSize: "var(--sl-font-size-x-small)",
|
|
209
|
-
display: "grid",
|
|
210
|
-
gridTemplateColumns: columns,
|
|
211
|
-
lineHeight: "45px",
|
|
212
|
-
userSelect: "none",
|
|
213
|
-
},
|
|
214
|
-
"& .progress-bar.repeatable-steps": {
|
|
215
|
-
marginLeft: "var(--sl-spacing-x-small)",
|
|
216
|
-
},
|
|
217
|
-
"& .filled:after": {
|
|
218
|
-
content: '""',
|
|
219
|
-
display: "flex",
|
|
220
|
-
width: "100%",
|
|
221
|
-
height: "4px",
|
|
222
|
-
borderRadius: "4px",
|
|
223
|
-
backgroundColor: "var(--sl-color-primary-500)",
|
|
224
|
-
},
|
|
225
|
-
"& .progress": {
|
|
226
|
-
display: "block",
|
|
227
|
-
textAlign: "center",
|
|
228
|
-
marginLeft: "-100px",
|
|
229
|
-
marginRight: "-100px",
|
|
230
|
-
},
|
|
231
|
-
"& .progress::after": {
|
|
232
|
-
content: '""',
|
|
233
|
-
width: "12px",
|
|
234
|
-
height: "12px",
|
|
235
|
-
display: "flex",
|
|
236
|
-
backgroundColor: "var(--sl-color-primary-500)",
|
|
237
|
-
borderRadius: "50%",
|
|
238
|
-
position: "relative",
|
|
239
|
-
left: "47%",
|
|
240
|
-
top: "-85%",
|
|
241
|
-
},
|
|
242
|
-
"& .progress.bg:after": {
|
|
243
|
-
width: "0",
|
|
244
|
-
height: "0",
|
|
245
|
-
border: "none",
|
|
246
|
-
},
|
|
247
|
-
"& .empty": {
|
|
248
|
-
display: "block",
|
|
249
|
-
textAlign: "center",
|
|
250
|
-
marginLeft: "-100px",
|
|
251
|
-
marginRight: "-100px",
|
|
252
|
-
},
|
|
253
|
-
"& .empty::after": {
|
|
254
|
-
content: '""',
|
|
255
|
-
width: "12px",
|
|
256
|
-
height: "12px",
|
|
257
|
-
border: "2px solid #E0E0E0",
|
|
258
|
-
margin: "-2px",
|
|
259
|
-
display: "flex",
|
|
260
|
-
backgroundColor: "white",
|
|
261
|
-
borderRadius: "50%",
|
|
262
|
-
position: "relative",
|
|
263
|
-
left: "47%",
|
|
264
|
-
top: "-85%",
|
|
265
|
-
},
|
|
266
|
-
"& .empty.bg:after": {
|
|
267
|
-
width: "0",
|
|
268
|
-
height: "0",
|
|
269
|
-
border: "none",
|
|
270
|
-
},
|
|
271
|
-
"& .remain:after": {
|
|
272
|
-
content: '""',
|
|
273
|
-
display: "flex",
|
|
274
|
-
width: "100%",
|
|
275
|
-
height: "4px",
|
|
276
|
-
borderRadius: "4px",
|
|
277
|
-
backgroundColor: "#E0E0E0",
|
|
278
|
-
},
|
|
279
|
-
"& .end.bw": {
|
|
280
|
-
filter: "grayscale(100%)",
|
|
281
|
-
},
|
|
282
|
-
"& .end.start": {
|
|
283
|
-
transform: "scale(80%)",
|
|
284
|
-
top: "-20px",
|
|
285
|
-
},
|
|
286
|
-
"& .end": {
|
|
287
|
-
textAlign: "center",
|
|
288
|
-
marginLeft: "-100px",
|
|
289
|
-
marginRight: "-100px",
|
|
290
|
-
position: "relative",
|
|
291
|
-
top: "-18px",
|
|
292
|
-
filter: goal <= progress ? "" : "grayscale(100%)",
|
|
293
|
-
zIndex: "1",
|
|
294
|
-
},
|
|
295
|
-
},
|
|
296
|
-
};
|
|
297
|
-
jss.setup(preset());
|
|
298
|
-
const sheet = jss.createStyleSheet(style);
|
|
299
|
-
const styleString = sheet.toString();
|
|
300
|
-
return (h("div", { class: sheet.classes.ProgressBar },
|
|
301
|
-
h("style", { type: "text/css" }, styleString),
|
|
302
|
-
h("div", { class: repetitions > 1 ? "progress-bar repeatable-steps" : "progress-bar" }, items)));
|
|
303
|
-
function addLinear() {
|
|
304
|
-
columns =
|
|
305
|
-
Math.min(Math.max(progress / goal, 0), 1) +
|
|
306
|
-
"fr 0fr " +
|
|
307
|
-
Math.min(Math.max(1 - progress / goal, 0), 1) +
|
|
308
|
-
"fr 0fr";
|
|
309
|
-
items.push(h("div", { class: "filled" }));
|
|
310
|
-
items.push(h("div", { class: progress == goal ? "progress bg" : "progress" }, unit + progress));
|
|
311
|
-
items.push(h("div", { class: "remain" }));
|
|
312
|
-
items.push(h("div", { class: "end" }, gift1));
|
|
313
|
-
}
|
|
314
|
-
function addSteps() {
|
|
315
|
-
let step_math = steps / goal;
|
|
316
|
-
for (let i = 1; i < goal; i += steps) {
|
|
317
|
-
columns += step_math + "fr 0fr ";
|
|
318
|
-
if (i > progress) {
|
|
319
|
-
items.push(h("div", { class: "remain" }));
|
|
320
|
-
items.push(h("div", { class: "empty" }, unit + i));
|
|
321
|
-
}
|
|
322
|
-
else {
|
|
323
|
-
items.push(h("div", { class: "filled" }));
|
|
324
|
-
items.push(h("div", { class: "progress" }, unit + i));
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
columns += step_math + "fr 0fr ";
|
|
328
|
-
// reward success
|
|
329
|
-
if (goal <= progress) {
|
|
330
|
-
columns += "0fr ";
|
|
331
|
-
items.push(h("div", { class: "filled" }));
|
|
332
|
-
items.push(h("div", { class: "progress bg" }, unit + goal));
|
|
333
|
-
items.push(h("div", { class: "end" }, gift1));
|
|
334
|
-
}
|
|
335
|
-
// reward fail
|
|
336
|
-
else {
|
|
337
|
-
columns += "0fr ";
|
|
338
|
-
items.push(h("div", { class: "remain" }));
|
|
339
|
-
items.push(h("div", { class: "empty bg" }, unit + goal));
|
|
340
|
-
items.push(h("div", { class: "end" }, gift1));
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
function addLinearRepeatable() {
|
|
344
|
-
let position = progress % goal;
|
|
345
|
-
let remainder = (position / goal) * 0.5;
|
|
346
|
-
let repetitions = Math.floor(progress / goal);
|
|
347
|
-
// 0 repetition
|
|
348
|
-
if (repetitions == 0) {
|
|
349
|
-
columns = remainder + "fr 0fr " + (0.5 - remainder) + "fr 0fr 0.5fr 0fr";
|
|
350
|
-
items.push(h("div", { class: "filled" }));
|
|
351
|
-
items.push(h("div", { class: progress == goal ? "progress bg" : "progress" }, unit + progress));
|
|
352
|
-
items.push(h("div", { class: "remain" }));
|
|
353
|
-
items.push(h("div", { class: "end" }, gift1));
|
|
354
|
-
items.push(h("div", { class: "remain" }));
|
|
355
|
-
items.push(h("div", { class: "end bw" }, gift2));
|
|
356
|
-
}
|
|
357
|
-
// single repetition
|
|
358
|
-
else if (repetitions == 1) {
|
|
359
|
-
columns =
|
|
360
|
-
"0.5fr 0fr " + remainder + "fr 0fr " + (0.5 - remainder) + "fr 0fr";
|
|
361
|
-
items.push(h("div", { class: "filled" }));
|
|
362
|
-
items.push(h("div", { class: "end" }, gift1));
|
|
363
|
-
items.push(h("div", { class: "filled" }));
|
|
364
|
-
items.push(h("div", { class: progress == goal ? "progress bg" : "progress" }, unit + progress));
|
|
365
|
-
items.push(h("div", { class: "remain" }));
|
|
366
|
-
items.push(h("div", { class: "end bw" }, gift2));
|
|
367
|
-
}
|
|
368
|
-
// multiple repetitions
|
|
369
|
-
else {
|
|
370
|
-
columns =
|
|
371
|
-
"0fr 0.5fr 0fr " + remainder + "fr 0fr " + (0.5 - remainder) + "fr 0fr";
|
|
372
|
-
items.push(h("div", { class: "end start" }, gift1));
|
|
373
|
-
items.push(h("div", { class: "filled" }));
|
|
374
|
-
items.push(h("div", { class: "end" }, gift2));
|
|
375
|
-
items.push(h("div", { class: "filled" }));
|
|
376
|
-
items.push(h("div", { class: progress == goal * repetitions ? "progress bg" : "progress" }, unit + progress));
|
|
377
|
-
items.push(h("div", { class: "remain" }));
|
|
378
|
-
items.push(h("div", { class: "end bw" }, gift3));
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
|
-
function addStepsRepeatable() {
|
|
382
|
-
let repetitions = Math.floor(progress / goal);
|
|
383
|
-
// no or single repetition
|
|
384
|
-
if (repetitions < 2) {
|
|
385
|
-
let step_math = steps / goal;
|
|
386
|
-
for (let i = 1; i < goal * 2 + 1; i += steps) {
|
|
387
|
-
columns += step_math + "fr 0fr ";
|
|
388
|
-
if (i > progress) {
|
|
389
|
-
if (i == goal) {
|
|
390
|
-
columns += "0fr ";
|
|
391
|
-
items.push(h("div", { class: "remain" }));
|
|
392
|
-
items.push(h("div", { class: "empty bg" }, unit + goal));
|
|
393
|
-
items.push(h("div", { class: "end bw" }, gift1));
|
|
394
|
-
}
|
|
395
|
-
else if (i == goal * 2) {
|
|
396
|
-
columns += "0fr 0fr";
|
|
397
|
-
items.push(h("div", { class: "remain" }));
|
|
398
|
-
items.push(h("div", { class: "empty bg" }, unit + (goal * 2)));
|
|
399
|
-
items.push(h("div", { class: "end bw" }, gift2));
|
|
400
|
-
}
|
|
401
|
-
else {
|
|
402
|
-
items.push(h("div", { class: "remain" }));
|
|
403
|
-
items.push(h("div", { class: "empty" }, unit + i));
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
else if (i == goal) {
|
|
407
|
-
columns += "0fr ";
|
|
408
|
-
items.push(h("div", { class: "filled" }));
|
|
409
|
-
items.push(h("div", { class: "progress bg" }, unit + i));
|
|
410
|
-
items.push(h("div", { class: "end" }, gift3));
|
|
411
|
-
}
|
|
412
|
-
else {
|
|
413
|
-
items.push(h("div", { class: "filled" }));
|
|
414
|
-
items.push(h("div", { class: "progress" }, unit + i));
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
// case repetition many
|
|
419
|
-
else {
|
|
420
|
-
let position = (progress % goal) + goal;
|
|
421
|
-
let step_math = steps / goal;
|
|
422
|
-
columns += "0fr 0fr ";
|
|
423
|
-
items.push(h("div", { class: "progress bg" }, unit + goal * (repetitions - 1)));
|
|
424
|
-
items.push(h("div", { class: "end start" }, gift1));
|
|
425
|
-
for (let i = 1; i < goal * 2 + 1; i += steps) {
|
|
426
|
-
columns += step_math + "fr 0fr ";
|
|
427
|
-
if (i <= goal) {
|
|
428
|
-
if (i == goal) {
|
|
429
|
-
columns += "0fr ";
|
|
430
|
-
items.push(h("div", { class: "filled" }));
|
|
431
|
-
items.push(h("div", { class: "progress bg" }, unit + (i + goal * (repetitions - 1))));
|
|
432
|
-
items.push(h("div", { class: "end" }, gift2));
|
|
433
|
-
}
|
|
434
|
-
else {
|
|
435
|
-
items.push(h("div", { class: "filled" }));
|
|
436
|
-
items.push(h("div", { class: "progress" }, unit + (i + goal * (repetitions - 1))));
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
else if (i > position) {
|
|
440
|
-
if (i == goal * 2) {
|
|
441
|
-
columns += "0fr 0fr";
|
|
442
|
-
items.push(h("div", { class: "remain" }));
|
|
443
|
-
items.push(h("div", { class: "empty bg" }, unit + (i + goal * (repetitions - 1))));
|
|
444
|
-
items.push(h("div", { class: "end bw" }, gift3));
|
|
445
|
-
}
|
|
446
|
-
else {
|
|
447
|
-
items.push(h("div", { class: "remain" }));
|
|
448
|
-
items.push(h("div", { class: "empty" }, unit + (i + goal * (repetitions - 1))));
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
else {
|
|
452
|
-
items.push(h("div", { class: "filled" }));
|
|
453
|
-
items.push(h("div", { class: "progress" }, unit + (i + goal * (repetitions - 1))));
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import { isDemo } from "@saasquatch/component-boilerplate";
|
|
1
2
|
import { withHooks } from "@saasquatch/stencil-hooks";
|
|
2
3
|
import { Component, h, Prop, State } from "@stencil/core";
|
|
3
4
|
import { getProps } from "../../utils/utils";
|
|
5
|
+
import { useBigStat } from "../sqm-big-stat/useBigStat";
|
|
6
|
+
import { useDemoBigStat } from "../sqm-big-stat/useDemoBigStat";
|
|
4
7
|
import { TaskCardView } from "./sqm-task-card-view";
|
|
5
8
|
/**
|
|
6
9
|
* @uiName Task Card
|
|
@@ -9,9 +12,13 @@ export class TaskCard {
|
|
|
9
12
|
constructor() {
|
|
10
13
|
this.ignored = true;
|
|
11
14
|
/**
|
|
12
|
-
* @uiName Reward
|
|
15
|
+
* @uiName Reward Amount
|
|
13
16
|
*/
|
|
14
17
|
this.points = 0;
|
|
18
|
+
/**
|
|
19
|
+
* @uiName Reward Unit
|
|
20
|
+
*/
|
|
21
|
+
this.rewardUnit = "Points";
|
|
15
22
|
/**
|
|
16
23
|
* @uiName Title Text
|
|
17
24
|
*/
|
|
@@ -21,7 +28,7 @@ export class TaskCard {
|
|
|
21
28
|
*/
|
|
22
29
|
this.description = "Description Text";
|
|
23
30
|
/**
|
|
24
|
-
* @uiName
|
|
31
|
+
* @uiName Goal Repeatable
|
|
25
32
|
*/
|
|
26
33
|
this.repeatable = false;
|
|
27
34
|
/**
|
|
@@ -29,22 +36,45 @@ export class TaskCard {
|
|
|
29
36
|
*/
|
|
30
37
|
this.showProgressBar = false;
|
|
31
38
|
/**
|
|
32
|
-
* @uiName Progress
|
|
39
|
+
* @uiName Goal Progress Source
|
|
33
40
|
*/
|
|
34
|
-
this.
|
|
41
|
+
this.progressSource = "";
|
|
35
42
|
/**
|
|
36
|
-
* @uiName
|
|
43
|
+
* @uiName Goal Completion Number
|
|
37
44
|
*/
|
|
38
45
|
this.goal = 1;
|
|
39
46
|
/**
|
|
40
|
-
* @uiName
|
|
47
|
+
* @uiName Progress Bar Steps
|
|
48
|
+
*/
|
|
49
|
+
this.steps = false;
|
|
50
|
+
/**
|
|
51
|
+
* @uiName Show Goal Expiry
|
|
52
|
+
*/
|
|
53
|
+
this.showExpire = false;
|
|
54
|
+
/**
|
|
55
|
+
* @uiName CTA Button Text
|
|
56
|
+
*/
|
|
57
|
+
this.buttonText = "Complete Action";
|
|
58
|
+
/**
|
|
59
|
+
* @uiName CTA Button Link
|
|
60
|
+
*/
|
|
61
|
+
this.buttonLink = "https://example.com/";
|
|
62
|
+
/**
|
|
63
|
+
* Select what type of stat to display for the goal. Manual paths are also supported.
|
|
64
|
+
*
|
|
65
|
+
* @uiWidget StatTypeSelectWidget
|
|
66
|
+
* @uiName Stat Type
|
|
67
|
+
* @uiOptions {"version": 1.1}
|
|
41
68
|
*/
|
|
42
|
-
this.
|
|
69
|
+
this.statType = "/programGoals/count/Referral-Started%2Freferrals";
|
|
43
70
|
withHooks(this);
|
|
44
71
|
}
|
|
45
72
|
disconnectedCallback() { }
|
|
46
73
|
render() {
|
|
47
|
-
|
|
74
|
+
const { props } = isDemo() ? useDemoBigStat(this) : useBigStat(this);
|
|
75
|
+
const { value, statvalue } = props;
|
|
76
|
+
console.log(props, isDemo());
|
|
77
|
+
return (h(TaskCardView, Object.assign({}, getProps(this), { progress: value, loading: value === undefined })));
|
|
48
78
|
}
|
|
49
79
|
static get is() { return "sqm-task-card"; }
|
|
50
80
|
static get encapsulation() { return "shadow"; }
|
|
@@ -61,7 +91,7 @@ export class TaskCard {
|
|
|
61
91
|
"optional": false,
|
|
62
92
|
"docs": {
|
|
63
93
|
"tags": [{
|
|
64
|
-
"text": "Reward
|
|
94
|
+
"text": "Reward Amount",
|
|
65
95
|
"name": "uiName"
|
|
66
96
|
}],
|
|
67
97
|
"text": ""
|
|
@@ -70,6 +100,27 @@ export class TaskCard {
|
|
|
70
100
|
"reflect": false,
|
|
71
101
|
"defaultValue": "0"
|
|
72
102
|
},
|
|
103
|
+
"rewardUnit": {
|
|
104
|
+
"type": "string",
|
|
105
|
+
"mutable": false,
|
|
106
|
+
"complexType": {
|
|
107
|
+
"original": "string",
|
|
108
|
+
"resolved": "string",
|
|
109
|
+
"references": {}
|
|
110
|
+
},
|
|
111
|
+
"required": false,
|
|
112
|
+
"optional": false,
|
|
113
|
+
"docs": {
|
|
114
|
+
"tags": [{
|
|
115
|
+
"text": "Reward Unit",
|
|
116
|
+
"name": "uiName"
|
|
117
|
+
}],
|
|
118
|
+
"text": ""
|
|
119
|
+
},
|
|
120
|
+
"attribute": "reward-unit",
|
|
121
|
+
"reflect": false,
|
|
122
|
+
"defaultValue": "\"Points\""
|
|
123
|
+
},
|
|
73
124
|
"cardTitle": {
|
|
74
125
|
"type": "string",
|
|
75
126
|
"mutable": false,
|
|
@@ -124,7 +175,7 @@ export class TaskCard {
|
|
|
124
175
|
"optional": false,
|
|
125
176
|
"docs": {
|
|
126
177
|
"tags": [{
|
|
127
|
-
"text": "
|
|
178
|
+
"text": "Goal Repeatable",
|
|
128
179
|
"name": "uiName"
|
|
129
180
|
}],
|
|
130
181
|
"text": ""
|
|
@@ -154,27 +205,6 @@ export class TaskCard {
|
|
|
154
205
|
"reflect": false,
|
|
155
206
|
"defaultValue": "false"
|
|
156
207
|
},
|
|
157
|
-
"progress": {
|
|
158
|
-
"type": "number",
|
|
159
|
-
"mutable": false,
|
|
160
|
-
"complexType": {
|
|
161
|
-
"original": "number",
|
|
162
|
-
"resolved": "number",
|
|
163
|
-
"references": {}
|
|
164
|
-
},
|
|
165
|
-
"required": false,
|
|
166
|
-
"optional": false,
|
|
167
|
-
"docs": {
|
|
168
|
-
"tags": [{
|
|
169
|
-
"text": "Progress Bar Progress",
|
|
170
|
-
"name": "uiName"
|
|
171
|
-
}],
|
|
172
|
-
"text": ""
|
|
173
|
-
},
|
|
174
|
-
"attribute": "progress",
|
|
175
|
-
"reflect": false,
|
|
176
|
-
"defaultValue": "0"
|
|
177
|
-
},
|
|
178
208
|
"goal": {
|
|
179
209
|
"type": "number",
|
|
180
210
|
"mutable": false,
|
|
@@ -187,7 +217,7 @@ export class TaskCard {
|
|
|
187
217
|
"optional": false,
|
|
188
218
|
"docs": {
|
|
189
219
|
"tags": [{
|
|
190
|
-
"text": "
|
|
220
|
+
"text": "Goal Completion Number",
|
|
191
221
|
"name": "uiName"
|
|
192
222
|
}],
|
|
193
223
|
"text": ""
|
|
@@ -197,11 +227,11 @@ export class TaskCard {
|
|
|
197
227
|
"defaultValue": "1"
|
|
198
228
|
},
|
|
199
229
|
"steps": {
|
|
200
|
-
"type": "
|
|
230
|
+
"type": "boolean",
|
|
201
231
|
"mutable": false,
|
|
202
232
|
"complexType": {
|
|
203
|
-
"original": "
|
|
204
|
-
"resolved": "
|
|
233
|
+
"original": "boolean",
|
|
234
|
+
"resolved": "boolean",
|
|
205
235
|
"references": {}
|
|
206
236
|
},
|
|
207
237
|
"required": false,
|
|
@@ -214,9 +244,10 @@ export class TaskCard {
|
|
|
214
244
|
"text": ""
|
|
215
245
|
},
|
|
216
246
|
"attribute": "steps",
|
|
217
|
-
"reflect": false
|
|
247
|
+
"reflect": false,
|
|
248
|
+
"defaultValue": "false"
|
|
218
249
|
},
|
|
219
|
-
"
|
|
250
|
+
"progressBarUnit": {
|
|
220
251
|
"type": "string",
|
|
221
252
|
"mutable": false,
|
|
222
253
|
"complexType": {
|
|
@@ -233,10 +264,10 @@ export class TaskCard {
|
|
|
233
264
|
}],
|
|
234
265
|
"text": ""
|
|
235
266
|
},
|
|
236
|
-
"attribute": "unit",
|
|
267
|
+
"attribute": "progress-bar-unit",
|
|
237
268
|
"reflect": false
|
|
238
269
|
},
|
|
239
|
-
"
|
|
270
|
+
"showExpire": {
|
|
240
271
|
"type": "boolean",
|
|
241
272
|
"mutable": false,
|
|
242
273
|
"complexType": {
|
|
@@ -248,16 +279,16 @@ export class TaskCard {
|
|
|
248
279
|
"optional": false,
|
|
249
280
|
"docs": {
|
|
250
281
|
"tags": [{
|
|
251
|
-
"text": "Show Expiry",
|
|
282
|
+
"text": "Show Goal Expiry",
|
|
252
283
|
"name": "uiName"
|
|
253
284
|
}],
|
|
254
285
|
"text": ""
|
|
255
286
|
},
|
|
256
|
-
"attribute": "expire",
|
|
287
|
+
"attribute": "show-expire",
|
|
257
288
|
"reflect": false,
|
|
258
289
|
"defaultValue": "false"
|
|
259
290
|
},
|
|
260
|
-
"
|
|
291
|
+
"dateExpires": {
|
|
261
292
|
"type": "string",
|
|
262
293
|
"mutable": false,
|
|
263
294
|
"complexType": {
|
|
@@ -269,12 +300,12 @@ export class TaskCard {
|
|
|
269
300
|
"optional": true,
|
|
270
301
|
"docs": {
|
|
271
302
|
"tags": [{
|
|
272
|
-
"text": "
|
|
303
|
+
"text": "Date Goal Expires",
|
|
273
304
|
"name": "uiName"
|
|
274
305
|
}],
|
|
275
306
|
"text": ""
|
|
276
307
|
},
|
|
277
|
-
"attribute": "date-
|
|
308
|
+
"attribute": "date-expires",
|
|
278
309
|
"reflect": false
|
|
279
310
|
},
|
|
280
311
|
"buttonText": {
|
|
@@ -289,13 +320,14 @@ export class TaskCard {
|
|
|
289
320
|
"optional": false,
|
|
290
321
|
"docs": {
|
|
291
322
|
"tags": [{
|
|
292
|
-
"text": "Button Text",
|
|
323
|
+
"text": "CTA Button Text",
|
|
293
324
|
"name": "uiName"
|
|
294
325
|
}],
|
|
295
326
|
"text": ""
|
|
296
327
|
},
|
|
297
328
|
"attribute": "button-text",
|
|
298
|
-
"reflect": false
|
|
329
|
+
"reflect": false,
|
|
330
|
+
"defaultValue": "\"Complete Action\""
|
|
299
331
|
},
|
|
300
332
|
"buttonLink": {
|
|
301
333
|
"type": "string",
|
|
@@ -309,13 +341,41 @@ export class TaskCard {
|
|
|
309
341
|
"optional": false,
|
|
310
342
|
"docs": {
|
|
311
343
|
"tags": [{
|
|
312
|
-
"text": "Button Link",
|
|
344
|
+
"text": "CTA Button Link",
|
|
313
345
|
"name": "uiName"
|
|
314
346
|
}],
|
|
315
347
|
"text": ""
|
|
316
348
|
},
|
|
317
349
|
"attribute": "button-link",
|
|
318
|
-
"reflect": false
|
|
350
|
+
"reflect": false,
|
|
351
|
+
"defaultValue": "\"https://example.com/\""
|
|
352
|
+
},
|
|
353
|
+
"statType": {
|
|
354
|
+
"type": "string",
|
|
355
|
+
"mutable": false,
|
|
356
|
+
"complexType": {
|
|
357
|
+
"original": "string",
|
|
358
|
+
"resolved": "string",
|
|
359
|
+
"references": {}
|
|
360
|
+
},
|
|
361
|
+
"required": false,
|
|
362
|
+
"optional": false,
|
|
363
|
+
"docs": {
|
|
364
|
+
"tags": [{
|
|
365
|
+
"text": "StatTypeSelectWidget",
|
|
366
|
+
"name": "uiWidget"
|
|
367
|
+
}, {
|
|
368
|
+
"text": "Stat Type",
|
|
369
|
+
"name": "uiName"
|
|
370
|
+
}, {
|
|
371
|
+
"text": "{\"version\": 1.1}",
|
|
372
|
+
"name": "uiOptions"
|
|
373
|
+
}],
|
|
374
|
+
"text": "Select what type of stat to display for the goal. Manual paths are also supported."
|
|
375
|
+
},
|
|
376
|
+
"attribute": "stat-type",
|
|
377
|
+
"reflect": false,
|
|
378
|
+
"defaultValue": "\"/programGoals/count/Referral-Started%2Freferrals\""
|
|
319
379
|
}
|
|
320
380
|
}; }
|
|
321
381
|
static get states() { return {
|