Skip to content

Commit

Permalink
Empty chart fix
Browse files Browse the repository at this point in the history
  • Loading branch information
aceberg committed Dec 25, 2023
1 parent de73292 commit 760bb59
Show file tree
Hide file tree
Showing 16 changed files with 73 additions and 129 deletions.
27 changes: 0 additions & 27 deletions .github/workflows/binary-release.yml

This file was deleted.

1 change: 1 addition & 0 deletions .version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VERSION=0.1.0
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
# Change Log
All notable changes to this project will be documented in this file.

## [0.1.1] - 2023-12-23
### Added
- Local JS and Themes
- Weight chart

## [0.1.0] - 2023-12-23
### Added
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ mod:

run:
cd cmd/$(PKG_NAME)/ && \
go run . -n "http://192.168.2.3:8850"
go run .

fmt:
go fmt ./...
Expand Down
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Light and easy workout diary
- [Quick start](https://github.com/aceberg/exercisediary#quick-start)
- [Config](https://github.com/aceberg/exercisediary#config)
- [Options](https://github.com/aceberg/exercisediary#options)
- [Local network only](https://github.com/aceberg/exercisediary#local-network-only)
- [Roadmap](https://github.com/aceberg/exercisediary#roadmap)
- [Thanks](https://github.com/aceberg/exercisediary#thanks)

Expand Down Expand Up @@ -48,7 +49,24 @@ Configuration can be done through config file or environment variables

| Key | Description | Default |
| -------- | ----------- | ------- |
| -c | Path to config dir | /data/ExerciseDiary |
| -d | Path to config dir | /data/ExerciseDiary |
| -n | Path to local JS and Themes ([node-bootstrap](https://github.com/aceberg/my-dockerfiles/tree/main/node-bootstrap)) | "" |

## Local network only
By default, this app pulls themes, icons and fonts from the internet. But, in some cases, it may be useful to have an independent from global network setup. I created a separate [image](https://github.com/aceberg/my-dockerfiles/tree/main/node-bootstrap) with all necessary modules and fonts.
```sh
docker run --name node-bootstrap \
-v ~/.dockerdata/icons:/app/icons \ # For local images
-p 8850:8850 \
aceberg/node-bootstrap
```
```sh
docker run --name exdiary \
-v ~/.dockerdata/ExerciseDiary:/data/ExerciseDiary \
-p 8849:8849 \
aceberg/exercisediary -n "http://$YOUR_IP:8850"
```
Or use [docker-compose](docker-compose-local.yml)

## Roadmap
- [x] HeatMap
Expand Down
36 changes: 0 additions & 36 deletions build/ci/build-deb.sh

This file was deleted.

20 changes: 0 additions & 20 deletions build/ci/build.sh

This file was deleted.

12 changes: 0 additions & 12 deletions configs/AppTemplate.service

This file was deleted.

13 changes: 0 additions & 13 deletions configs/[email protected]

This file was deleted.

7 changes: 0 additions & 7 deletions configs/install.sh

This file was deleted.

25 changes: 25 additions & 0 deletions docker-compose-local.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
version: "3"
services:
node-bootstrap:
image: aceberg/node-bootstrap
restart: unless-stopped
ports:
- 8850:8850
volumes:
- ~/.dockerdata/icons:/app/icons # For local icons
exdiary:
image: aceberg/exercisediary
restart: unless-stopped
ports:
- 8851:8851
command: "-n http://YOUR_IP:8850" # Put your server IP or DNS name here
depends_on:
- node-bootstrap
volumes:
- ~/.dockerdata/ExerciseDiary:/data/ExerciseDiary # app data (set your own path instead of dockerdata)
environment:
TZ: Asia/Novosibirsk # required for uptime monitor, default ""
HOST: "0.0.0.0" # optional, default: 0.0.0.0
PORT: "8851" # optional, default: 8851
THEME: "grass" # optional, default: grass
COLOR: "light" # optional, default: light
4 changes: 3 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
version: "3"
services:
ExerciseDiary:
exdiary:
image: aceberg/exercisediary
restart: unless-stopped
ports:
- 8851:8851
volumes:
- ~/.dockerdata/ExerciseDiary:/data/ExerciseDiary
environment:
Expand Down
2 changes: 1 addition & 1 deletion internal/web/public/js/heatmap.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function makeChart(heat, hcolor, sets) {
const res = window.myMatrix.getElementsAtEventForMode(e, 'nearest', { intersect: true }, true);
let clickDate = res[0].element.$context.raw.d;
// console.log('CLICK DATE =', clickDate);

setFormContent(sets, clickDate); // index.js
},
plugins: {
Expand Down
15 changes: 11 additions & 4 deletions internal/web/public/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ function setFormContent(sets, date) {
document.getElementById("formDate").value = date;
document.getElementById("realDate").value = date;

let len = sets.length;
for (let i = 0 ; i < len; i++) {
if (sets[i].Date == date) {
addExercise(sets[i].Name, sets[i].Weight, sets[i].Reps);
if (sets) {
let len = sets.length;
for (let i = 0 ; i < len; i++) {
if (sets[i].Date == date) {
addExercise(sets[i].Name, sets[i].Weight, sets[i].Reps);
}
}
}
};
Expand All @@ -37,6 +39,11 @@ function setFormDate(sets) {
setFormContent(sets, today);
};

function setWeightDate() {
let date = document.getElementById("realDate").value;
document.getElementById("weightDate").value = date;
};

function delExercise(exID) {

document.getElementById(exID).remove();
Expand Down
3 changes: 2 additions & 1 deletion internal/web/public/js/weight.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ function splitWeight(weight) {

function weightChart(weight, wcolor) {

if (weight) {
splitWeight(weight);
// console.log('FDATA =', dates, ws);

Expand Down Expand Up @@ -49,5 +50,5 @@ function weightChart(weight, wcolor) {
}
}
});

}
};
11 changes: 6 additions & 5 deletions internal/web/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ <h5 class="modal-title">Add weight</h5>
<table class="table table-borderless">
<tr>
<td>Date</td>
<td><input name="date" type="date" class="form-control"></td>
<td><input name="date" type="date" class="form-control" id="weightDate"></td>
</tr>
<tr>
<td>Weight</td>
Expand All @@ -46,13 +46,13 @@ <h5 class="modal-title">Add weight</h5>
<div class="card-body">
<div class="hstack gap-2">
<div class="chart-container m-auto">
<canvas id="matrix-chart" style="max-height: 100px; width: 820px;">
<canvas id="matrix-chart" style="max-height: 100px; width: 820px;"></canvas>
</div>
<div class="chart-container m-auto">
<canvas id="weight-chart" style="max-height: 100px;">
<canvas id="weight-chart" style="max-height: 100px;"></canvas>
</div>
<div class="m-auto">
<button class="btn del-set-button" title="Add weight" data-bs-toggle="modal" data-bs-target="#mWeight">
<button class="btn del-set-button" title="Add weight" data-bs-toggle="modal" data-bs-target="#mWeight" onclick='setWeightDate()'>
<h4><i class="bi bi-window-plus"></i></h4>
</button>
</div>
Expand All @@ -77,7 +77,7 @@ <h2 class="accordion-header">
{{ range $.ExData.Exs }}
{{ if eq .Group $gr }}
<div class="hstack gap-2">
<a href="/exercise/?id={{ .ID }}"><button class="btn add-exercise-button" title="Edit">
<a href="/exercise/?id={{ .ID }}"><button class="btn del-set-button" title="Edit">
<i class="bi bi-pencil-square"></i>
</button></a>
<!-- Button trigger modal -->
Expand Down Expand Up @@ -107,6 +107,7 @@ <h5 class="modal-title">{{ .Name }}</h5>
</div>
</div>
</div>
<!-- End Modal -->
<button class="btn exercise-button" onclick='addExercise("{{ .Name }}", "{{ .Weight }}", "{{ .Reps }}")' title="Weight: {{ .Weight }}; Reps: {{ .Reps }};">{{ .Name }}</button>
<button class="btn add-exercise-button" onclick='addExercise("{{ .Name }}", "{{ .Weight }}", "{{ .Reps }}")' title="Add">
<i class="bi bi-arrow-right-square"></i>
Expand Down

0 comments on commit 760bb59

Please sign in to comment.