-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdaily.mjs
69 lines (55 loc) · 2.4 KB
/
daily.mjs
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
import { prepareDoc } from "./jspdf.factory.mjs";
import { drawTopSection } from "./drawTopSection.mjs";
import { drawBrainDump } from "./drawBrainDump.mjs";
import { drawDots } from "./drawDots.mjs";
import { startY, startX, sectionW, endY, endX, approximateLabelH } from "./constants.mjs";
import { drawDailyPlanner, drawDailyPlanner2 } from "./drawDailyPlanner.mjs";
export function getDailyDoc({
cellSize = 9.5,
startingHour = 8,
version = 1,
}) {
if (version === 1) {
return getDailyDocThicc({ cellSize, startingHour });
}
const doc = prepareDoc();
// Top priorities
const tpBottomY = drawTopSection(doc, startX, startY + cellSize, sectionW, cellSize)
// Brain dump
const bdY = tpBottomY + cellSize - approximateLabelH;
const bdH = endY - tpBottomY;
drawBrainDump(doc, startX, bdY, sectionW, bdH);
drawDots(doc, startX, bdY + approximateLabelH, sectionW, bdH, cellSize);
const pSectionX = startX + sectionW + cellSize;
doc.text(pSectionX - sectionW - cellSize, startY, "Date:");
const pLabelY = startY + approximateLabelH;
doc.line(startX + 10.5, pLabelY, startX + sectionW, pLabelY);
const pSectionY = pLabelY + cellSize;
const pSectionH = endY - pSectionY + cellSize;
// Draw daily planning section with 30 minutes split for 19 hours of the day starting with 08:00
drawDailyPlanner2(doc, pSectionX, pLabelY - 5, sectionW, pSectionH + cellSize + 5, 9, 17);
return doc;
}
function getDailyDocThicc({ cellSize = 9.5, startingHour = 8 }) {
const doc = prepareDoc();
// Top priorities
const tpBottomY = drawTopSection(doc, startX, startY, sectionW, cellSize)
// Brain dump
const bdY = tpBottomY + cellSize - approximateLabelH;
const bdH = endY - tpBottomY;
drawBrainDump(doc, startX, bdY, sectionW, bdH);
drawDots(doc, startX, bdY + approximateLabelH, sectionW, bdH, cellSize);
const pSectionX = startX + sectionW + cellSize;
doc.text(pSectionX, startY, "Date:");
const pLabelY = startY + approximateLabelH;
const pLabelX = pSectionX + 10.5;
doc.line(pLabelX, pLabelY, endX, pLabelY);
const pSectionY = pLabelY + cellSize;
const pSectionH = endY - pSectionY + cellSize;
// Half hour labels with approximate coordinates
doc.text(100, 21, ":00");
doc.text(124, 21, ":30");
// Draw daily planning section with 30 minutes split for 19 hours of the day starting with 08:00
drawDailyPlanner(doc, pSectionX, pSectionY, sectionW, pSectionH, 8, 19);
return doc;
}