-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprint.js
70 lines (68 loc) · 1.67 KB
/
print.js
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
const c = require("chalk");
const {
CANDLE,
FLAME,
SHELF,
APPROVED_COLORS,
NOT_APPROVED_COLOR_MESSAGE,
addingMessage,
DIVIDER,
HELP_MESSAGE,
EMPTY_MESSAGE,
ALTAR_CALVIN,
FLOWER,
STEM,
} = require("./constants");
module.exports = Object.freeze({
printNotApprovedColor: () => {
console.log(NOT_APPROVED_COLOR_MESSAGE);
console.log(APPROVED_COLORS);
},
printAltarItems: (altarItems) => {
const topRow = [];
const bottomRow = [];
altarItems.forEach(({ color, isFlower }) => {
if (isFlower) {
topRow.push(`${c[color](FLOWER)}`);
bottomRow.push(`${c.green(STEM)}`);
} else {
topRow.push(`${c.yellow(FLAME)}`);
bottomRow.push(`${c[color](CANDLE)}`);
}
});
console.log(`${topRow.join("")}
${bottomRow.join("")}`);
},
printCandleIntentions: (altarItems) => {
altarItems.forEach((candleEntry) => {
const { color, intention } = candleEntry;
console.log(`${c[color](intention)}`);
});
},
printShelf: () => {
// TODO: add second shelf when need additional space
console.log(SHELF);
},
printAddingNewItem: (color, intention) => {
console.log(addingMessage(color, intention));
},
printWelcomeMessage: () => {
console.log(` ${DIVIDER}
⟄ welcome to ⟃
${ALTAR_CALVIN}
${DIVIDER}
${HELP_MESSAGE}
`);
},
printEmptyMessage: () => {
console.log(EMPTY_MESSAGE);
},
printRemoveItem: (itemNumber, removedItem) => {
const { color, intention } = removedItem[0];
console.log(`candle ${itemNumber} removed (${color}, ${intention})`);
},
printAltarTitle: (title) => {
// ⟄❂ ❂⟃
console.log(` ⟢ ${title} ⟣ `);
},
});