From f2cceee6f7fbb8720b924c88ec50b6c2111659b5 Mon Sep 17 00:00:00 2001 From: Arpit Jain Date: Sun, 2 Jan 2022 00:25:20 +0530 Subject: [PATCH] vertically reduce --- dist/index.bd513a2f.js | 208 ++++++++++++++++++++++++++------------ dist/index.cc8dc349.css | 6 +- src-tauri/Cargo.lock | 2 +- src-tauri/Cargo.toml | 2 +- src-tauri/tauri.conf.json | 2 +- src/src/js/main.ts | 37 +++---- src/src/js/week.ts | 81 ++++++++------- src/src/style.css | 2 +- 8 files changed, 214 insertions(+), 126 deletions(-) diff --git a/dist/index.bd513a2f.js b/dist/index.bd513a2f.js index 156a622..70267e4 100644 --- a/dist/index.bd513a2f.js +++ b/dist/index.bd513a2f.js @@ -2080,36 +2080,38 @@ function $850e48264ea38c74$export$b93cec6dd11b1714(week) { `); }); let programmables = []; - let _programmable = week.programmable; - let programmableData = []; - programmableData.push({ - title: 'Practice', - done: _programmable.practice.total - _programmable.practice.left, - total: _programmable.practice.total - }); - programmableData.push({ - title: 'Graded', - done: _programmable.graded.total - _programmable.graded.left, - total: _programmable.graded.total - }); - programmableData.forEach((data)=>{ - if (data.total == 0) return; - const btnUpValid = data.total > data.done; - const btnDownValid = data.done > 0; - const inProgress = { - 'in-progress': btnUpValid, - 'done': !btnUpValid && btnDownValid - }; - programmables.push($a51c7802bfe1890e$export$c0bb0b647f701bb5` -
-

${data.title} :
${data.done}/${data.total}

-
- - + if (week.hasProgrammable) { + let _programmable = week.programmable; + let programmableData = []; + programmableData.push({ + title: 'Practice', + done: _programmable.practice.total - _programmable.practice.left, + total: _programmable.practice.total + }); + programmableData.push({ + title: 'Graded', + done: _programmable.graded.total - _programmable.graded.left, + total: _programmable.graded.total + }); + programmableData.forEach((data)=>{ + if (data.total == 0) return; + const btnUpValid = data.total > data.done; + const btnDownValid = data.done > 0; + const inProgress = { + 'in-progress': btnUpValid, + 'done': !btnUpValid && btnDownValid + }; + programmables.push($a51c7802bfe1890e$export$c0bb0b647f701bb5` +
+

${data.title} :
${data.done}/${data.total}

+
+ + +
-
- `); - }); + `); + }); + } // consider max 12 videos overall if (videos.length > max_in_row) // divide into two videos.splice(Math.ceil(videos.length / 2), 0, $a51c7802bfe1890e$export$c0bb0b647f701bb5`
`); @@ -2119,17 +2121,22 @@ function $850e48264ea38c74$export$b93cec6dd11b1714(week) { const animatedBorderClassMap = { 'gradient-border': Math.floor(_percentage / 10) == 10 }; + let solvableHeading = "Solvable"; + if (solvables.length > 0 && solvables.length < 3 && programmables.length > 0 && programmables.length < 3) { + solvableHeading = "Solvable + Programming"; + solvables.push(programmables.shift(), programmables.shift()); + } let videosContainerClass = { 'pb-3': videos.length > 0, 'pb-0': videos.length == 0 }; let solvableContainerBorderBottom = { - 'border-b-2': week.hasProgrammable && programmables.length > 0, - 'border-gray-600': week.hasProgrammable && programmables.length > 0 + 'border-b-2': programmables.length > 0, + 'border-gray-600': programmables.length > 0 }; return $a51c7802bfe1890e$export$c0bb0b647f701bb5`
-
+
@@ -2190,19 +2197,22 @@ function $850e48264ea38c74$export$b93cec6dd11b1714(week) {
-
+

- Solvable + ${solvableHeading}

-
+
0, + "pb-4": programmables.length == 0 + })}"> ${solvables}
-
+

Programming @@ -3764,25 +3774,25 @@ class $b437cb7ddfb16b51$var$Main { ww.id = "4"; ww.name = "4"; ww.hidden = false; - let w5 = new $850e48264ea38c74$export$fca4f8121099df57(ww); - this.wm.registerWeek(w5); - let trial = { - "id": "101", - "name": "1", + // let w5 = new Week(ww); + // this.wm.registerWeek(w5); + let trial2 = { + "id": "102", + "name": "102", "factor": 0.7, "solvableTime": 45, "solvable": { "activities": { - "total": 1, + "total": 0, "left": 0 }, "tutorials": { - "total": 1, + "total": 0, "left": 0 }, "assignments": { "total": 2, - "left": 1 + "left": 2 } }, "hasProgrammable": true, @@ -3797,14 +3807,30 @@ class $b437cb7ddfb16b51$var$Main { "left": 0 } }, - "videos": [], + "videos": [ + { + "m": 33, + "s": 3, + "seen": true + }, + { + "m": 3, + "s": 23, + "seen": true + }, + { + "m": 33, + "s": 23, + "seen": true + }, + ], "lastChangeTime": 1634845763686 }; - let w6 = new $850e48264ea38c74$export$fca4f8121099df57(trial); - this.wm.registerWeek(w6); - let trial2 = { - "id": "102", - "name": "1", + let w7 = new $850e48264ea38c74$export$fca4f8121099df57(trial2); + this.wm.registerWeek(w7); + let trial = { + "id": "101", + "name": "101", "factor": 0.7, "solvableTime": 45, "solvable": { @@ -3814,11 +3840,11 @@ class $b437cb7ddfb16b51$var$Main { }, "tutorials": { "total": 0, - "left": 0 + "left": 1 }, "assignments": { - "total": 0, - "left": 0 + "total": 2, + "left": 1 } }, "hasProgrammable": true, @@ -3833,23 +3859,59 @@ class $b437cb7ddfb16b51$var$Main { "left": 0 } }, - "videos": [], + "videos": [ + { + "m": 33, + "s": 3, + "seen": true + }, + { + "m": 3, + "s": 23, + "seen": true + }, + { + "m": 33, + "s": 23, + "seen": true + }, + { + "m": 33, + "s": 23, + "seen": true + }, + { + "m": 33, + "s": 23, + "seen": true + }, + { + "m": 33, + "s": 23, + "seen": true + }, + { + "m": 12, + "s": 12, + "seen": true + } + ], "lastChangeTime": 1634845763686 }; - let w7 = new $850e48264ea38c74$export$fca4f8121099df57(trial2); - this.wm.registerWeek(w7); + let w6 = new $850e48264ea38c74$export$fca4f8121099df57(trial); + this.wm.registerWeek(w6); let trial3 = { "id": "103", - "name": "1", + "name": "103", "factor": 0.7, "solvableTime": 45, "solvable": { "activities": { - "total": 1, + "total": 0, "left": 0 }, "tutorials": { - "total": 1, + "total": 0, "left": 0 }, "assignments": { @@ -3857,19 +3919,35 @@ class $b437cb7ddfb16b51$var$Main { "left": 1 } }, - "hasProgrammable": false, + "hasProgrammable": true, "programmableTime": 20, programmable: { "practice": { - "total": 0, - "left": 0 + "total": 2, + "left": 2 }, "graded": { - "total": 0, - "left": 0 + "total": 2, + "left": 2 } }, - "videos": [], + "videos": [ + { + "m": 33, + "s": 3, + "seen": true + }, + { + "m": 3, + "s": 23, + "seen": true + }, + { + "m": 33, + "s": 23, + "seen": true + }, + ], "lastChangeTime": 1634845763686 }; let w8 = new $850e48264ea38c74$export$fca4f8121099df57(trial3); diff --git a/dist/index.cc8dc349.css b/dist/index.cc8dc349.css index 26ee0fc..166b2d0 100644 --- a/dist/index.cc8dc349.css +++ b/dist/index.cc8dc349.css @@ -726,8 +726,8 @@ Ensure the default browser behavior of the `hidden` attribute. padding-bottom: 0.25rem; }.pt-1 { padding-top: 0.25rem; -}.pt-3 { - padding-top: 0.75rem; +}.pb-4 { + padding-bottom: 1rem; }.text-left { text-align: left; }.text-center { @@ -990,7 +990,7 @@ Ensure the default browser behavior of the `hidden` attribute. margin-left: 0.5rem; margin-right: 0.5rem; margin-top: 0px; - margin-bottom: 0.25rem; + margin-bottom: 0px; width: 33.333333%; max-width: 28rem; display: flex; diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index f02f62a..3e6490e 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -40,7 +40,7 @@ checksum = "61604a8f862e1d5c3229fdd78f8b02c68dcf73a4c4b05fd636d12240aaa242c1" [[package]] name = "app" -version = "3.0.1" +version = "3.1.0" dependencies = [ "serde", "serde_json", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 9b3de9e..5cd2ec5 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "app" -version = "3.0.1" +version = "3.1.0" description = "Progress tracking app" authors = [ "antimatter96" ] license = "" diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index e120fb5..a34a25c 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "package": { "productName": "calc", - "version": "3.0.1" + "version": "3.1.0" }, "build": { "distDir": "../dist", diff --git a/src/src/js/main.ts b/src/src/js/main.ts index 1adc0a3..5455f4c 100644 --- a/src/src/js/main.ts +++ b/src/src/js/main.ts @@ -65,6 +65,7 @@ class Main { "lastChangeTime": 1634845763686 } let ww = JSON.parse(JSON.stringify(sampleJSON)) + ww.hidden = false; let w2 = new Week(ww); this.wm.registerWeek(w2); @@ -89,35 +90,35 @@ class Main { ww.name = "4"; ww.hidden = false; - let w5 = new Week(ww); - this.wm.registerWeek(w5); + // let w5 = new Week(ww); + // this.wm.registerWeek(w5); + let trial2 = { + "id": "102", "name": "102", "factor": 0.70, + "solvableTime": 45, "solvable": { "activities": { "total": 0, "left": 0 }, "tutorials": { "total": 0, "left": 0 }, "assignments": { "total": 2, "left": 2 } }, + "hasProgrammable": true, "programmableTime": 20, programmable: { "practice": { "total": 1, "left": 0 }, "graded": { "total": 1, "left": 0 } }, + "videos": [{ "m": 33, "s": 3, "seen": true }, { "m": 3, "s": 23, "seen": true }, { "m": 33, "s": 23, "seen": true }, ], + "lastChangeTime": 1634845763686 + } + let w7 = new Week(trial2); + this.wm.registerWeek(w7); let trial = { - "id": "101", "name": "1", "factor": 0.70, - "solvableTime": 45, "solvable": { "activities": { "total": 1, "left": 0 }, "tutorials": { "total": 1, "left": 0 }, "assignments": { "total": 2, "left": 1 } }, + "id": "101", "name": "101", "factor": 0.70, + "solvableTime": 45, "solvable": { "activities": { "total": 0, "left": 0 }, "tutorials": { "total": 0, "left": 1 }, "assignments": { "total": 2, "left": 1 } }, "hasProgrammable": true, "programmableTime": 20, programmable: { "practice": { "total": 1, "left": 0 }, "graded": { "total": 1, "left": 0 } }, - "videos": [], + "videos": [{ "m": 33, "s": 3, "seen": true }, { "m": 3, "s": 23, "seen": true }, { "m": 33, "s": 23, "seen": true }, { "m": 33, "s": 23, "seen": true }, { "m": 33, "s": 23, "seen": true }, { "m": 33, "s": 23, "seen": true }, { "m": 12, "s": 12, "seen": true }], "lastChangeTime": 1634845763686 } let w6 = new Week(trial); this.wm.registerWeek(w6); - let trial2 = { - "id": "102", "name": "1", "factor": 0.70, - "solvableTime": 45, "solvable": { "activities": { "total": 0, "left": 0 }, "tutorials": { "total": 0, "left": 0 }, "assignments": { "total": 0, "left": 0 } }, - "hasProgrammable": true, "programmableTime": 20, programmable: { "practice": { "total": 1, "left": 0 }, "graded": { "total": 1, "left": 0 } }, - "videos": [], - "lastChangeTime": 1634845763686 - } - let w7 = new Week(trial2); - this.wm.registerWeek(w7); let trial3 = { - "id": "103", "name": "1", "factor": 0.70, - "solvableTime": 45, "solvable": { "activities": { "total": 1, "left": 0 }, "tutorials": { "total": 1, "left": 0 }, "assignments": { "total": 2, "left": 1 } }, - "hasProgrammable": false, "programmableTime": 20, programmable: { "practice": { "total": 0, "left": 0 }, "graded": { "total": 0, "left": 0 } }, - "videos": [], + "id": "103", "name": "103", "factor": 0.70, + "solvableTime": 45, "solvable": { "activities": { "total": 0, "left": 0 }, "tutorials": { "total": 0, "left": 0 }, "assignments": { "total": 2, "left": 1 } }, + "hasProgrammable": true, "programmableTime": 20, programmable: { "practice": { "total": 2, "left": 2 }, "graded": { "total": 2, "left": 2 } }, + "videos": [{ "m": 33, "s": 3, "seen": true }, { "m": 3, "s": 23, "seen": true }, { "m": 33, "s": 23, "seen": true }, ], "lastChangeTime": 1634845763686 } let w8 = new Week(trial3); diff --git a/src/src/js/week.ts b/src/src/js/week.ts index df937e2..aecda97 100644 --- a/src/src/js/week.ts +++ b/src/src/js/week.ts @@ -537,40 +537,42 @@ export function templateFunc(week: Week) { let programmables = []; - let _programmable = week.programmable; - let programmableData = []; - - programmableData.push({ - title: 'Practice', - done: _programmable.practice.total - _programmable.practice.left, - total: _programmable.practice.total, - }) - programmableData.push({ - title: 'Graded', - done: _programmable.graded.total - _programmable.graded.left, - total: _programmable.graded.total, - }) - - programmableData.forEach((data) => { - if (data.total == 0) { - return; - } + if (week.hasProgrammable) { + let _programmable = week.programmable; + let programmableData = []; + + programmableData.push({ + title: 'Practice', + done: _programmable.practice.total - _programmable.practice.left, + total: _programmable.practice.total, + }) + programmableData.push({ + title: 'Graded', + done: _programmable.graded.total - _programmable.graded.left, + total: _programmable.graded.total, + }) + + programmableData.forEach((data) => { + if (data.total == 0) { + return; + } - const btnUpValid = data.total > data.done; - const btnDownValid = data.done > 0; + const btnUpValid = data.total > data.done; + const btnDownValid = data.done > 0; - const inProgress = { 'in-progress': btnUpValid, 'done': (!btnUpValid && btnDownValid) } + const inProgress = { 'in-progress': btnUpValid, 'done': (!btnUpValid && btnDownValid) } - programmables.push(html` -
-

${data.title} :
${data.done}/${data.total}

-
- - + programmables.push(html` +
+

${data.title} :
${data.done}/${data.total}

+
+ + +
-
- `); - }) + `); + }) + } // consider max 12 videos overall if (videos.length > max_in_row) { @@ -584,12 +586,19 @@ export function templateFunc(week: Week) { 'gradient-border': (Math.floor(_percentage / 10)) == 10 } + let solvableHeading = "Solvable" + + if (solvables.length > 0 && solvables.length < 3 && programmables.length > 0 && programmables.length < 3) { + solvableHeading = "Solvable + Programming" + solvables.push(programmables.shift(), programmables.shift()) + } + let videosContainerClass = { 'pb-3': videos.length > 0, 'pb-0': videos.length == 0 }; - let solvableContainerBorderBottom = { 'border-b-2': (week.hasProgrammable && programmables.length > 0), 'border-gray-600': (week.hasProgrammable && programmables.length > 0) }; + let solvableContainerBorderBottom = { 'border-b-2': (programmables.length > 0), 'border-gray-600': (programmables.length > 0) }; return html`
-
+
@@ -650,19 +659,19 @@ export function templateFunc(week: Week) {
-
+

- Solvable + ${solvableHeading}

-
+
0, "pb-4": programmables.length == 0})}"> ${solvables}
-
+

Programming diff --git a/src/src/style.css b/src/src/style.css index 9abd4b4..0a7278d 100644 --- a/src/src/style.css +++ b/src/src/style.css @@ -159,7 +159,7 @@ body { } .act-time { - @apply w-4/12 mx-2 mt-0 mb-1 max-w-md; + @apply w-4/12 mx-2 mt-0 mb-0 max-w-md; @apply flex; @apply bg-white;