Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-03-11 Thread Tom Hughes via rails-dev
@tomhughes approved this pull request.

I might still have added a local stylesheet with a require just so there was 
consistency between the javascript and the styles but it doesn't really matter 
so I think this is good to go now - thanks for your work on it!



-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#pullrequestreview-2675777996
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-03-11 Thread Tom Hughes via rails-dev
Merged #5402 into master.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#event-16695447398
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-03-11 Thread Emin Kocan via rails-dev
@kcne pushed 2 commits.

9a23dfc07cdc90f1eebbc876312b6b5f82ef508a  Add heatmap data caching and query 
for user contributions
9be4b0f8b38141631bc1fd82552c341d90ec8b52  Add tests for heatmap data in 
UsersController

-- 
View it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402/files/356192f445bb253e60908292ba87f8abe3db96ff..9be4b0f8b38141631bc1fd82552c341d90ec8b52
You are receiving this because you are subscribed to this thread.

Message ID: 

___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-03-10 Thread Emin Kocan via rails-dev
@kcne commented on this pull request.



> @@ -0,0 +1,102 @@
+//= link cal-heatmap/dist/cal-heatmap.css

Thanks for the feedback, Tom. Since the code inside `common.scss` was 
unnecessary, I removed it completely, linked the `.css` file to `manifest.js`, 
and included it in the view directly. Let me know if any further modifications 
are needed.  

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#discussion_r1988320879
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-03-09 Thread Tom Hughes via rails-dev
@tomhughes commented on this pull request.



> @@ -0,0 +1,102 @@
+//= link cal-heatmap/dist/cal-heatmap.css

I think the best solution is probably to create `app/assets/heatmap.scss` which 
can require that, and also include the heap rule you added to `common.scss` and 
then have the view load `heatmap` rather than `cal-heatmap/dist/cal-heatmap`.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#discussion_r1986427253
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-03-09 Thread Emin Kocan via rails-dev
@kcne commented on this pull request.



> +
+  let cal = new CalHeatmap();
+  let currentTheme = getTheme();
+
+  function renderHeatmap() {
+cal.destroy();
+cal = new CalHeatmap();
+
+cal.paint({
+  itemSelector: "#cal-heatmap",
+  theme: currentTheme,
+  domain: {
+type: "month",
+gutter: 4,
+label: {
+  text: (timestamp) => I18n.strftime(new Date(2000, new 
Date(timestamp).getMonth(), 15), "%b"),

You're right. Updated the code. Thank you.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#discussion_r1986416748
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-03-09 Thread Emin Kocan via rails-dev
@kcne commented on this pull request.



> @@ -0,0 +1,102 @@
+//= link cal-heatmap/dist/cal-heatmap.css

I’m not sure if we changed anything in the assets pipeline recently, but when I 
ran the code today, I kept getting errors about the missing `.css` file, even 
after compiling the assets. I got it working by adding this here. I can move 
this to `manifest.js` if you prefer, but since we're only using it here, I 
found it more appropriate to keep it in this file.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#pullrequestreview-2669521216
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-03-09 Thread Emin Kocan via rails-dev
@kcne pushed 2 commits.

affa5257d62fef356828f0cd27ac3de5ccca9ac1  Add heatmap data caching and query 
for user contributions
356192f445bb253e60908292ba87f8abe3db96ff  Add tests for heatmap data in 
UsersController

-- 
View it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402/files/6882e4e5d76aac473e63fd918cd74f8aa1221de7..356192f445bb253e60908292ba87f8abe3db96ff
You are receiving this because you are subscribed to this thread.

Message ID: 

___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-03-09 Thread Tom Hughes via rails-dev
@tomhughes requested changes on this pull request.



> +
+  let cal = new CalHeatmap();
+  let currentTheme = getTheme();
+
+  function renderHeatmap() {
+cal.destroy();
+cal = new CalHeatmap();
+
+cal.paint({
+  itemSelector: "#cal-heatmap",
+  theme: currentTheme,
+  domain: {
+type: "month",
+gutter: 4,
+label: {
+  text: (timestamp) => I18n.strftime(new Date(2000, new 
Date(timestamp).getMonth(), 15), "%b"),

If we've constructed a date from the timestamp why do you then extract the 
month from that and build a new date? If the format only uses the month the 
rest of the date doesn't matter?

It might a bit faster to just lookup `I18n.t("date.abbr_month_names")` once 
before the paint call and then index that array with the month number rather 
than calling strftime repeatedly - just beware of 0/1 based indexing!

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#pullrequestreview-2669390875
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-03-06 Thread Emin Kocan via rails-dev
kcne left a comment (openstreetmap/openstreetmap-website#5402)

Now that #5654 was merged, I think current implementation is already setup to 
support this. Please let me know if i need to add anything else to support it. 
Thank you.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#issuecomment-2705684927
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-03-06 Thread Anton Khorev via rails-dev
@AntonKhorev approved this pull request.





-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#pullrequestreview-2664178796
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-03-02 Thread Tom Hughes via rails-dev
@tomhughes commented on this pull request.



> @@ -0,0 +1,100 @@
+//= require d3/dist/d3
+//= require cal-heatmap/dist/cal-heatmap
+//= require popper

I don't understand how this works? Shouldn't it be `@popperjs/core` or 
something here? How is it finding `popper` and is it actually finding the 
version we think it is?

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#pullrequestreview-2651425782
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-03-01 Thread Anton Khorev via rails-dev
AntonKhorev left a comment (openstreetmap/openstreetmap-website#5402)

With #5654 it's possible to translate the tooltips with language-specific 
pluralizations:

```
heatmap:
  tooltip:
contributions:
  one: "%{count} правка %{date}"
  few: "%{count} правки %{date}"
  many: "%{count} правок %{date}"
  other: ""
no_contributions: "Нет правок %{date}"
```

![image](https://github.com/user-attachments/assets/046d0758-acc7-4f18-8022-9d71ef19f07a)
 
![image](https://github.com/user-attachments/assets/066270ae-458a-460b-a9e7-31267e09f88c)
 
![image](https://github.com/user-attachments/assets/b665eeca-0b49-4843-82cb-fedded5ce871)

Otherwise only `one` for `count==1` and `other` rules are supported.

Do we merge #5654 first?

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#issuecomment-2692264076
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-02-28 Thread Emin Kocan via rails-dev
@kcne commented on this pull request.



> @@ -0,0 +1,100 @@
+//= require d3/dist/d3
+//= require cal-heatmap/dist/cal-heatmap
+//= require popper

This import is the same as the one inside `application.js` and was not 
introduced in this PR. It's provided by the [popper_js 
gem](https://github.com/glebm/popper_js-rubygem), which looking at the repo 
automatically supplies popper.js assets to rails.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#discussion_r1975841618
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-02-20 Thread Emin Kocan via rails-dev
kcne left a comment (openstreetmap/openstreetmap-website#5402)

I've resolved the conflicts in `yarn.lock` again. Since changes keep getting 
merged into master, I keep running into conflicts. Are there any remaining 
issues to address, or is this good to merge now?

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#issuecomment-2670881575
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-02-20 Thread Emin Kocan via rails-dev
@kcne pushed 2 commits.

8b2400a8aeb9c9d53ce932aa9fbe3e978417cf49  Add heatmap data caching and query 
for user contributions
6882e4e5d76aac473e63fd918cd74f8aa1221de7  Add tests for heatmap data in 
UsersController

-- 
View it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402/files/ba919c3aa637a01bf413ec7430456faa0b096c07..6882e4e5d76aac473e63fd918cd74f8aa1221de7
You are receiving this because you are subscribed to this thread.

Message ID: 

___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-02-18 Thread Emin Kocan via rails-dev
@kcne pushed 2 commits.

dd5eb6401e8267d2a1edcd88425fda4721001757  Add heatmap data caching and query 
for user contributions
ba919c3aa637a01bf413ec7430456faa0b096c07  Add tests for heatmap data in 
UsersController

-- 
View it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402/files/377e33aa9aa294d4711f64837e194c7bad00b45b..ba919c3aa637a01bf413ec7430456faa0b096c07
You are receiving this because you are subscribed to this thread.

Message ID: 

___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-02-18 Thread Emin Kocan via rails-dev
@kcne pushed 2 commits.

d9a1d198ff59957bc3cd5861df0ea71957ec666d  Add heatmap data caching and query 
for user contributions
377e33aa9aa294d4711f64837e194c7bad00b45b  Add tests for heatmap data in 
UsersController

-- 
View it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402/files/1618add8068ed0a2eed38b49f3482234479daf7e..377e33aa9aa294d4711f64837e194c7bad00b45b
You are receiving this because you are subscribed to this thread.

Message ID: 

___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-02-17 Thread Emin Kocan via rails-dev
@kcne commented on this pull request.



> @@ -4,24 +4,24 @@
 
 "@aashutoshrathi/word-wrap@^1.2.3":
   version "1.2.6"
-  resolved 
"https://registry.yarnpkg.com/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz#bd9154aec9983f77b3a034ecaa015c2e4201f6cf";
+  resolved 
"https://registry.npmjs.org/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz";

Should be resolved now.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#discussion_r1958632109
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-02-17 Thread Emin Kocan via rails-dev
@kcne pushed 2 commits.

766d131acf65f26cce3e26c00ceb4c10acb920b7  Add heatmap data caching and query 
for user contributions
1618add8068ed0a2eed38b49f3482234479daf7e  Add tests for heatmap data in 
UsersController

-- 
View it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402/files/33dcb66b3a04a5f00fd011cba8d603f35ce70173..1618add8068ed0a2eed38b49f3482234479daf7e
You are receiving this because you are subscribed to this thread.

Message ID: 

___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-02-17 Thread github-actions[bot] via rails-dev
github-actions[bot] left a comment (openstreetmap/openstreetmap-website#5402)



  

  
  
  1 Warning
  
 
  
  

  :warning:
  Number of updated lines of code is too large to 
be in one PR. Perhaps it should be separated into two or more?

  



  Generated by :no_entry_sign: https://danger.systems/";>Danger



-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#issuecomment-2663783384
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-02-17 Thread Emin Kocan via rails-dev
@kcne pushed 2 commits.

d93f4bf014a33ecd57d2bde4511489102e18a8bf  Add heatmap data caching and query 
for user contributions
33dcb66b3a04a5f00fd011cba8d603f35ce70173  Add tests for heatmap data in 
UsersController

-- 
View it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402/files/c10ac0d8f23e618f1fa184964b657c80a615525c..33dcb66b3a04a5f00fd011cba8d603f35ce70173
You are receiving this because you are subscribed to this thread.

Message ID: 

___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-02-14 Thread Anton Khorev via rails-dev
@AntonKhorev commented on this pull request.



> @@ -4,24 +4,24 @@
 
 "@aashutoshrathi/word-wrap@^1.2.3":
   version "1.2.6"
-  resolved 
"https://registry.yarnpkg.com/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz#bd9154aec9983f77b3a034ecaa015c2e4201f6cf";
+  resolved 
"https://registry.npmjs.org/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz";

Now there are no updates to `yarn.lock`.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#discussion_r1956082125
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-02-11 Thread Emin Kocan via rails-dev
@kcne pushed 2 commits.

879fa679be8e7f1d2aff93e21c0ae046b2ec5465  Add heatmap data caching and query 
for user contributions
c10ac0d8f23e618f1fa184964b657c80a615525c  Add tests for heatmap data in 
UsersController

-- 
View it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402/files/edeaaa5ecc089faf23566b5b0bc63331be49b57b..c10ac0d8f23e618f1fa184964b657c80a615525c
You are receiving this because you are subscribed to this thread.

Message ID: 

___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-02-11 Thread Emin Kocan via rails-dev
@kcne pushed 2 commits.

50339d184d3208dc1a9dd570fc227c12e3b8d6fa  Add heatmap data caching and query 
for user contributions
edeaaa5ecc089faf23566b5b0bc63331be49b57b  Add tests for heatmap data in 
UsersController

-- 
View it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402/files/d2e9531921a05a28b10d1795e37c74e9ff44a11c..edeaaa5ecc089faf23566b5b0bc63331be49b57b
You are receiving this because you are subscribed to this thread.

Message ID: 

___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-02-11 Thread Emin Kocan via rails-dev
@kcne commented on this pull request.



> @@ -4,24 +4,24 @@
 
 "@aashutoshrathi/word-wrap@^1.2.3":
   version "1.2.6"
-  resolved 
"https://registry.yarnpkg.com/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz#bd9154aec9983f77b3a034ecaa015c2e4201f6cf";
+  resolved 
"https://registry.npmjs.org/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz";

Must have messed this up during conflict. I will try to restore the file and do 
rebase again. Thank you.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#discussion_r1951008056
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-02-11 Thread Anton Khorev via rails-dev
@AntonKhorev commented on this pull request.



> @@ -4,24 +4,24 @@
 
 "@aashutoshrathi/word-wrap@^1.2.3":
   version "1.2.6"
-  resolved 
"https://registry.yarnpkg.com/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz#bd9154aec9983f77b3a034ecaa015c2e4201f6cf";
+  resolved 
"https://registry.npmjs.org/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz";

Now there's a ton of `registry.yarnpkg.com` -> `registry.npmjs.org` changes.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#pullrequestreview-2608887119
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-02-10 Thread Emin Kocan via rails-dev
@kcne pushed 2 commits.

a9de558a42a4575fba177bff8a9c206f79d65d38  Add heatmap data caching and query 
for user contributions
1f4672cbf34ca1ecb83ac993c88d53437d595dc9  Add tests for heatmap data in 
UsersController

-- 
View it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402/files/f9d674f8377182fa276bba0548ac4ec156ff9578..1f4672cbf34ca1ecb83ac993c88d53437d595dc9
You are receiving this because you are subscribed to this thread.

Message ID: 

___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-02-10 Thread Emin Kocan via rails-dev
The test failing here doesn't have nothing to do with the changes introduced in 
this PR. I tried force pushing again to rerun checks but again got failing test 
on different version of Ruby this time, which is weird. Is there some kind of 
bug in CI/CD right now or should I push again to rerun checks? 

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#issuecomment-2650003059
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-02-10 Thread Emin Kocan via rails-dev
@kcne pushed 9 commits.

7e6cea81a4defb516c7f59a8bb6e1d76a88d243f  Move map offline flash to partial
4d749262afc416d59f751209f1a5bba30e2708d3  Use offline flash partial on edit page
d43af148658e63de9b5649e714aaaf9bec32b078  Use offline flash partial on offline 
redirect target page
e13b6ee7a9ebfafb0d73eea44d21d682dd158e38  Change scope of offline flash messages
a64d523177c1a6c71e467dbdb83d5f01a21ec2f3  Add offline announcement setting
f2b7583f98de0a75a452b708f8d22c23c60dd2f6  Add expected restoration date setting
c0cbf2d3dd775302d849ae68b2982827c9a4be79  Remove references to database 
maintenance from offline messages
44d6709c2421f66dc53389223878e9a252e3a464  Add heatmap data caching and query 
for user contributions
2efbb6c315dfb10f3013bb47c00a0bc7ff9607cd  Add tests for heatmap data in 
UsersController

-- 
View it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402/files/7ff09b4fa1fa531a36fbbdd65a4bf54ac5f83091..2efbb6c315dfb10f3013bb47c00a0bc7ff9607cd
You are receiving this because you are subscribed to this thread.

Message ID: 

___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-02-10 Thread Emin Kocan via rails-dev
@kcne commented on this pull request.



> +one_contribution: "1 contribution on %{date}"
+contributions: "%{count} contributions on %{date}"

Resolved.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#discussion_r1949743265
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-02-10 Thread Emin Kocan via rails-dev
@kcne commented on this pull request.



> +return value === 1 ?
+  I18n.t("javascripts.heatmap.tooltip.one_contribution", { date: 
localizedDate }) :
+  I18n.t("javascripts.heatmap.tooltip.contributions", { count: value, 
date: localizedDate });

Resolved. 

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#discussion_r1949743003
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-02-10 Thread Emin Kocan via rails-dev
@kcne pushed 2 commits.

373ded893fce0b68a7767ca43974d92cf864d30e  Add heatmap data caching and query 
for user contributions
7ff09b4fa1fa531a36fbbdd65a4bf54ac5f83091  Add tests for heatmap data in 
UsersController

-- 
View it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402/files/1caa215e8274b32402358276bfd596b8a8f1c01b..7ff09b4fa1fa531a36fbbdd65a4bf54ac5f83091
You are receiving this because you are subscribed to this thread.

Message ID: 

___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-02-10 Thread Emin Kocan via rails-dev
@kcne pushed 2 commits.

cd763846341fecf62df1df0ba35bc393c860e926  Add heatmap data caching and query 
for user contributions
1caa215e8274b32402358276bfd596b8a8f1c01b  Add tests for heatmap data in 
UsersController

-- 
View it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402/files/38f909333e62e46665f0e0bb123573b79023bc87..1caa215e8274b32402358276bfd596b8a8f1c01b
You are receiving this because you are subscribed to this thread.

Message ID: 

___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-02-06 Thread Anton Khorev via rails-dev
@AntonKhorev commented on this pull request.



> +one_contribution: "1 contribution on %{date}"
+contributions: "%{count} contributions on %{date}"

```suggestion
contributions:
  one: "%{count} contribution on %{date}"
  other: "%{count} contributions on %{date}"
```

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#pullrequestreview-2600637843
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-02-06 Thread Anton Khorev via rails-dev
@AntonKhorev commented on this pull request.



> +return value === 1 ?
+  I18n.t("javascripts.heatmap.tooltip.one_contribution", { date: 
localizedDate }) :
+  I18n.t("javascripts.heatmap.tooltip.contributions", { count: value, 
date: localizedDate });

```suggestion
return I18n.t("javascripts.heatmap.tooltip.contributions", { count: value, 
date: localizedDate });
```

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#pullrequestreview-2600638847
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-02-05 Thread Emin Kocan via rails-dev
@kcne pushed 2 commits.

840decddc6af04be60ff5ef398f9fffd113b407e  Add heatmap data caching and query 
for user contributions
38f909333e62e46665f0e0bb123573b79023bc87  Add tests for heatmap data in 
UsersController

-- 
View it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402/files/a068ef7ad03658871fbd1723e20449126f76f32d..38f909333e62e46665f0e0bb123573b79023bc87
You are receiving this because you are subscribed to this thread.

Message ID: 

___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-02-05 Thread Emin Kocan via rails-dev
@kcne commented on this pull request.



> @@ -3300,6 +3300,10 @@ en:
   show_address: Show address
   query_features: Query features
   centre_map: Centre map here
+heatmap:
+  tooltip:
+contributions: "%{count} contributions on %{date}"

Updated keys and js code respectively. Now we got `no_contributions`, 
`contributions` with `%{count}` and `one_contribution`. 

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#discussion_r1943625554
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-02-05 Thread Emin Kocan via rails-dev
@kcne pushed 2 commits.

7a2fd38e7a2b86aaa1cfb13f91972b8480b1d2c9  Add javascript logic, styles and 
heatmap in view
a068ef7ad03658871fbd1723e20449126f76f32d  Add tests for heatmap data in 
UsersController

-- 
View it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402/files/341fe1378fe6d3ebf260e1715329affb1aa1fa5f..a068ef7ad03658871fbd1723e20449126f76f32d
You are receiving this because you are subscribed to this thread.

Message ID: 

___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-02-05 Thread Anton Khorev via rails-dev
@AntonKhorev commented on this pull request.



> @@ -3300,6 +3300,10 @@ en:
   show_address: Show address
   query_features: Query features
   centre_map: Centre map here
+heatmap:
+  tooltip:
+contributions: "%{count} contributions on %{date}"

You need `one` and `other` versions with `%{count}`.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#pullrequestreview-2596390889
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-02-04 Thread Emin Kocan via rails-dev
@kcne commented on this pull request.



> +  
+
+  

Refactored the code to use flexbox instead. It is indeed much simpler, as I 
could get rid of some custom css classes. Thanks once again.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#discussion_r1942244049
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-02-04 Thread Emin Kocan via rails-dev
@kcne pushed 2 commits.

9fc9ed65c63ad95897af6665fe9275ccb8976a4f  Add javascript logic, styles and 
heatmap in view
341fe1378fe6d3ebf260e1715329affb1aa1fa5f  Add tests for heatmap data in 
UsersController

-- 
View it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402/files/ec5f4a5edc56db8a1a2bb14244cffdac85661466..341fe1378fe6d3ebf260e1715329affb1aa1fa5f
You are receiving this because you are subscribed to this thread.

Message ID: 

___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-02-04 Thread Emin Kocan via rails-dev
@kcne pushed 2 commits.

3fc5a320930d24208aabeaf0acfb5af4802c8cdd  Add javascript logic, styles and 
heatmap in view
ec5f4a5edc56db8a1a2bb14244cffdac85661466  Add tests for heatmap data in 
UsersController

-- 
View it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402/files/f504d36d34750e99d9fcf190d4f9cdc1d8bd25e8..ec5f4a5edc56db8a1a2bb14244cffdac85661466
You are receiving this because you are subscribed to this thread.

Message ID: 

___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-02-04 Thread Emin Kocan via rails-dev
@kcne commented on this pull request.



> +# Test user with no changesets
+user_without_changesets = create(:user)
+get user_path(user_without_changesets)
+assert_response :success
+assert_select "div#cal-heatmap", 1

Updated the test to reflect latest changes. Thank you.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#discussion_r1942227578
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-02-04 Thread Anton Khorev via rails-dev
@AntonKhorev commented on this pull request.



> +
+  
+
+
+   
+  <%= t("date.abbr_day_names")[1] %>
+   
+  <%= t("date.abbr_day_names")[3] %>
+   
+  <%= t("date.abbr_day_names")[5] %>
+   
+
+
+

The color scheme is already present in `data-bs-theme` on `` ("auto" if 
that attribute is missing).

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#pullrequestreview-2593626789
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-02-04 Thread Anton Khorev via rails-dev
@AntonKhorev commented on this pull request.



> +# Test user with no changesets
+user_without_changesets = create(:user)
+get user_path(user_without_changesets)
+assert_response :success
+assert_select "div#cal-heatmap", 1

This fails because `@heatmap_data.present?` is false when `@heatmap_data` is an 
empty array.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#pullrequestreview-2593593996
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-02-04 Thread Emin Kocan via rails-dev
@kcne pushed 2 commits.

fbe7865e0255c06d8e5760faa945c464009007c8  Add heatmap container to user profile 
view
ccaeee9113382d874dd015d9f5106f9296f38b39  Add tests for heatmap data in 
UsersController

-- 
View it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402/files/e1bc1b99783548e8382e29fd8d7fb5ea61a83fb6..ccaeee9113382d874dd015d9f5106f9296f38b39
You are receiving this because you are subscribed to this thread.

Message ID: 

___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-02-04 Thread Emin Kocan via rails-dev
@kcne commented on this pull request.



> @@ -237,11 +237,29 @@
 
 <%= @user.description.to_html 
%>
 
-<% if @heatmap_data.present? %>
-  
-<%= tag.div(:id => "cal-heatmap", :data => { :heatmap => 
@heatmap_data.to_json }) %>
+

Removed that div entirely, thank you. I thought  it would help make it 
responsive on small screens in bootstrap grid, but apparently it doesn't do 
anything in this case.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#discussion_r1940802623
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-02-04 Thread Emin Kocan via rails-dev
@kcne commented on this pull request.



> +<% if @heatmap_data.present? %>
+  
+<%= tag.div(:id => "cal-heatmap", :data => { :heatmap => 
@heatmap_data.to_json }) %>
+  
+<% end %>

When we decide the conditions for renedering we can refactor the if statement 
as necessary. Thank you.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#discussion_r1940799285
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-02-04 Thread Emin Kocan via rails-dev
@kcne commented on this pull request.



> +<% if @heatmap_data.present? %>
+  
+<%= tag.div(:id => "cal-heatmap", :data => { :heatmap => 
@heatmap_data.to_json }) %>
+  
+<% end %>

Okay, kept the if statement as it is now and also removed styling mentioned and 
`console.warn` statment from the javascript code. Thank you.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#discussion_r1940797988
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-02-04 Thread Emin Kocan via rails-dev
@kcne commented on this pull request.



> +  <%= stylesheet_link_tag "heatmap" %>
+  <%= javascript_include_tag "heatmap" %>

Removed from this commit and added later when the files are added. Thank you.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#discussion_r1940796304
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-02-04 Thread Emin Kocan via rails-dev
@kcne pushed 2 commits.

2c62802c3d056edb43f3e20e3e8a5d7d3c8fad05  Add heatmap container to user profile 
view
e1bc1b99783548e8382e29fd8d7fb5ea61a83fb6  Add tests for heatmap data in 
UsersController

-- 
View it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402/files/7680971278a6941ebf3ce639aa1dd4b4c07767cc..e1bc1b99783548e8382e29fd8d7fb5ea61a83fb6
You are receiving this because you are subscribed to this thread.

Message ID: 

___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-02-03 Thread Anton Khorev via rails-dev
@AntonKhorev commented on this pull request.



> +  
+
+  

Why wouldn't you use a single flex container that puts weekday labels next to 
the heatmap? No position absolute/relative, probably only one pixel value of 
top padding for the labels to align them.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#pullrequestreview-2591347707
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-02-03 Thread Anton Khorev via rails-dev
@AntonKhorev commented on this pull request.



> @@ -237,11 +237,29 @@
 
 <%= @user.description.to_html 
%>
 
-<% if @heatmap_data.present? %>
-  
-<%= tag.div(:id => "cal-heatmap", :data => { :heatmap => 
@heatmap_data.to_json }) %>
+

What does `class="small"` do?

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#pullrequestreview-2591344276
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-02-03 Thread Anton Khorev via rails-dev
@AntonKhorev commented on this pull request.



> +<% if @heatmap_data.present? %>
+  
+<%= tag.div(:id => "cal-heatmap", :data => { :heatmap => 
@heatmap_data.to_json }) %>
+  
+<% end %>

You overwrite this later almost entirely. I'd keep `if` because we will not 
output the heatmap [under some 
conditions](https://github.com/openstreetmap/openstreetmap-website/pull/5402#issuecomment-2602166082).

`style="max-height: 500px;"` shouldn't be here.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#pullrequestreview-2591342660
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-02-03 Thread Anton Khorev via rails-dev
@AntonKhorev commented on this pull request.



> +  <%= stylesheet_link_tag "heatmap" %>
+  <%= javascript_include_tag "heatmap" %>

The linked files don't exist yet. And the stylesheet won't exist later too.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#pullrequestreview-2591316201
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-02-03 Thread Emin Kocan via rails-dev
@kcne pushed 2 commits.

fde2ab967b45609d6d4186f00500b51b39f8c55d  Add heatmap javascript logic, styles 
and dependencies
7680971278a6941ebf3ce639aa1dd4b4c07767cc  Add tests for heatmap data in 
UsersController

-- 
View it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402/files/8a32593b005f706738fdfec7c8f775b5f01a5aa3..7680971278a6941ebf3ce639aa1dd4b4c07767cc
You are receiving this because you are subscribed to this thread.

Message ID: 

___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-02-03 Thread Emin Kocan via rails-dev
@kcne commented on this pull request.



> +.heatmap-wrapper {
+  position: relative;
+  height: 130px;
+}
+
+.heatmap-labels {
+position: absolute;
+  top: 2px;
+  left: 17px;
+  padding-top: 21px;
+  z-index: 1;
+  overflow-y: hidden;
+}
+
+.heatmap {
+  margin-left: 50px;
+  height: 100%;
+  z-index: 0;
+}

I decided to remove `heatmap.css` completely since we opted to using npm 
package and linking stylesheet inside `show.html.erb` directly. Since it's only 
18 lines of code I think we can leave it in `common.scss` for now. If you still 
think I should move it to separate file instead, just let me know.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#discussion_r1939893538
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-02-03 Thread Emin Kocan via rails-dev
@kcne commented on this pull request.



> +  height: 100%;
+  z-index: 0;

I thought they did as precaution but they don't. Removed now and everything 
works ok. Thank you.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#discussion_r1939889069
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-02-03 Thread Emin Kocan via rails-dev
@kcne commented on this pull request.



> +  top: 2px;
+  left: 17px;
+  padding-top: 21px;

I had issues while making this work on UI with positioning. Fixed now, removed 
padding top and relied on top property completely instead. Everything works 
properly. Marking as resolved.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#discussion_r1939887171
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-02-03 Thread Emin Kocan via rails-dev
@kcne commented on this pull request.



> +  const translations = I18n.translations[locale] || I18n.translations.en;
+  const date = translations && translations.date;
+  const abbrMonthNames = date && date.abbr_month_names;
+
+  const months = abbrMonthNames || [];
+  return months[monthIndex + 1] || "";

This is great, makes code much cleaner and shorter. Removed method altogether 
and just used the code you provided in the text callback. Thank you.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#discussion_r1939884862
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-02-03 Thread Emin Kocan via rails-dev
@kcne commented on this pull request.



> +  data: {
+source: heatmapData,
+type: "json",
+x: "date",
+y: "total_changes"
+  },
+  scale: {
+color: {
+  type: "threshold",
+  range: currentTheme === "dark" ? rangeColors : 
Array.from(rangeColors).reverse(),
+  domain: [10, 20, 30, 40]
+}
+  }
+}, [
+  [Tooltip, {
+text: (date, value) => getTooltipText(date, value, locale)

Fixed. Removed locale altogether since as you pointed out I can use I18n 
directly. Thank you.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#discussion_r1939882886
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-02-03 Thread Emin Kocan via rails-dev
@kcne commented on this pull request.



> +  type: "threshold",
+  range: currentTheme === "dark" ? rangeColors : 
Array.from(rangeColors).reverse(),
+  domain: [10, 20, 30, 40]
+}
+  }
+}, [
+  [Tooltip, {
+text: (date, value) => getTooltipText(date, value, locale)
+  }]
+]);
+  }
+});
+
+function getThemeFromColorScheme(colorScheme) {
+  if (colorScheme === "auto") {
+return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" 
: "light";

You were completely right. I tried removing the method, but instead of doing 
two things in one method or in if statement i just refactored the method and 
moved it around a bit. Thank you.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#discussion_r1939881436
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-02-03 Thread Emin Kocan via rails-dev
@kcne commented on this pull request.



>  //= link_tree ../../../vendor/assets/iD/iD/img
 //= link_directory ../../../vendor/assets/iD/iD/data .json
 //= link_directory ../../../vendor/assets/iD/iD/locales .json
 //= link_directory ../../../vendor/assets/iD/iD/mapillary-js .css
 //= link_directory ../../../vendor/assets/iD/iD/mapillary-js .js
 //= link_directory ../../../vendor/assets/iD/iD/pannellum .js
 //= link_directory ../../../vendor/assets/iD/iD/pannellum .css
+//= link_directory ../../../vendor/assets/d3 .js
+//= link_directory ../../../vendor/assets/cal-heatmap .js
+//= link_directory ../../../vendor/assets/cal-heatmap .css
 

Alright, fixed now and rebased the commits accordingly. Thank you for putting 
effort into demonstrating how to properly do this!


-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#discussion_r1939879726
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-02-03 Thread Emin Kocan via rails-dev
@kcne pushed 4 commits.

b4abb7c36d77d8634bf116d6287ee698fa3e63ad  Add heatmap data caching and query 
for user contributions
754f79000ccce4a41eea7d2e09e1bc039b3feba7  Add heatmap container to user profile 
view
183a14f2827d398b0465153b336204ad205981bb  Add heatmap javascript logic, styles 
and dependencies
8a32593b005f706738fdfec7c8f775b5f01a5aa3  Add tests for heatmap data in 
UsersController

-- 
View it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402/files/ad50c87e692aa87a3644027fb519c494b191e735..8a32593b005f706738fdfec7c8f775b5f01a5aa3
You are receiving this because you are subscribed to this thread.

Message ID: 

___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-02-03 Thread Emin Kocan via rails-dev
@kcne pushed 2 commits.

4347c00fb4b694a918dc9134c2f8f53d22392525  Add heatmap javascript logic, styles 
and dependencies
ad50c87e692aa87a3644027fb519c494b191e735  Add tests for heatmap data in 
UsersController

-- 
View it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402/files/661db86cbcb0d02f9a2451258bef5f4e81abc264..ad50c87e692aa87a3644027fb519c494b191e735
You are receiving this because you are subscribed to this thread.

Message ID: 

___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-02-03 Thread github-actions[bot] via rails-dev


  

  
  
  1 Warning
  
 
  
  

  :warning:
  Number of updated lines of code is too large to 
be in one PR. Perhaps it should be separated into two or more?

  



  Generated by :no_entry_sign: https://danger.systems/";>Danger



-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#issuecomment-2631698830
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-02-03 Thread Emin Kocan via rails-dev
@kcne pushed 4 commits.

5969abfcaf1c424db763488dcf05738884750192  Add heatmap data caching and query 
for user contributions
66834e32332adf773e8866f55452bd1379bdfa46  Add heatmap container to user profile 
view
49b1c4192368f34bf891d64555af5900ad7a79ac  Add heatmap javascript logic, styles 
and dependencies
661db86cbcb0d02f9a2451258bef5f4e81abc264  Add tests for heatmap data in 
UsersController

-- 
View it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402/files/7ebadd0eafcf62c30241db10167726bbe9424eae..661db86cbcb0d02f9a2451258bef5f4e81abc264
You are receiving this because you are subscribed to this thread.

Message ID: 

___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-01-31 Thread Anton Khorev via rails-dev
@AntonKhorev commented on this pull request.



> +  height: 100%;
+  z-index: 0;

Do these two properties do anything?

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#pullrequestreview-2586823620
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-01-31 Thread Anton Khorev via rails-dev
@AntonKhorev commented on this pull request.



> +  top: 2px;
+  left: 17px;
+  padding-top: 21px;

Why do you need both `top` and `padding-top`?

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#pullrequestreview-2586818329
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-01-31 Thread Anton Khorev via rails-dev
@AntonKhorev commented on this pull request.



> +.heatmap-wrapper {
+  position: relative;
+  height: 130px;
+}
+
+.heatmap-labels {
+position: absolute;
+  top: 2px;
+  left: 17px;
+  padding-top: 21px;
+  z-index: 1;
+  overflow-y: hidden;
+}
+
+.heatmap {
+  margin-left: 50px;
+  height: 100%;
+  z-index: 0;
+}

Why is it here and not in `heatmap.css`?

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#pullrequestreview-2586806249
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-01-31 Thread Anton Khorev via rails-dev
@AntonKhorev commented on this pull request.



> +  const translations = I18n.translations[locale] || I18n.translations.en;
+  const date = translations && translations.date;
+  const abbrMonthNames = date && date.abbr_month_names;
+
+  const months = abbrMonthNames || [];
+  return months[monthIndex + 1] || "";

```suggestion
  return I18n.strftime(new Date(2000, monthIndex, 15), "%b");
```

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#pullrequestreview-2586789797
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-01-31 Thread Anton Khorev via rails-dev
@AntonKhorev commented on this pull request.



> +  data: {
+source: heatmapData,
+type: "json",
+x: "date",
+y: "total_changes"
+  },
+  scale: {
+color: {
+  type: "threshold",
+  range: currentTheme === "dark" ? rangeColors : 
Array.from(rangeColors).reverse(),
+  domain: [10, 20, 30, 40]
+}
+  }
+}, [
+  [Tooltip, {
+text: (date, value) => getTooltipText(date, value, locale)

`getTooltipText` doesn't have the `locale` parameter. And you probably don't 
need to pass `locale` around to other places, given that you can read it from 
`I18n.locale`.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#pullrequestreview-2586720269
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-01-31 Thread Anton Khorev via rails-dev
@AntonKhorev commented on this pull request.



> +  type: "threshold",
+  range: currentTheme === "dark" ? rangeColors : 
Array.from(rangeColors).reverse(),
+  domain: [10, 20, 30, 40]
+}
+  }
+}, [
+  [Tooltip, {
+text: (date, value) => getTooltipText(date, value, locale)
+  }]
+]);
+  }
+});
+
+function getThemeFromColorScheme(colorScheme) {
+  if (colorScheme === "auto") {
+return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" 
: "light";

You already have `mediaQuery` defined. It can be used here:
```suggestion
return mediaQuery.matches ? "dark" : "light";
```

For this to work, declarations have to be moved around. Maybe this function 
doesn't need to be declared. You already have `if (colorScheme === "auto") ...` 
above that is not inside a function.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#pullrequestreview-2586681226
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-01-31 Thread Anton Khorev via rails-dev
@AntonKhorev commented on this pull request.



>  //= link_tree ../../../vendor/assets/iD/iD/img
 //= link_directory ../../../vendor/assets/iD/iD/data .json
 //= link_directory ../../../vendor/assets/iD/iD/locales .json
 //= link_directory ../../../vendor/assets/iD/iD/mapillary-js .css
 //= link_directory ../../../vendor/assets/iD/iD/mapillary-js .js
 //= link_directory ../../../vendor/assets/iD/iD/pannellum .js
 //= link_directory ../../../vendor/assets/iD/iD/pannellum .css
+//= link_directory ../../../vendor/assets/d3 .js
+//= link_directory ../../../vendor/assets/cal-heatmap .js
+//= link_directory ../../../vendor/assets/cal-heatmap .css
 

To address 
https://github.com/openstreetmap/openstreetmap-website/pull/5402#issuecomment-2549612467
 you'd do something like 
https://github.com/AntonKhorev/openstreetmap-website/commit/7ac349e61d57bf568b55c13a44f0fd0b16261ae3.
 Except of course you'd start with installing it using `yarn add cal-heatmap` 
and you wouldn't copy dependencies to `vendor` manually.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#pullrequestreview-2586548450
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-01-28 Thread Emin Kocan via rails-dev
@kcne pushed 6 commits.

fcc626b0c5a0ebe6f6c8747f80bfc77ec8c6cc8b  Add cal-heatmap lib with plugins and 
dependencies to vendor/assets/javascripts
b4ec65fc54bee34bbf12e5ff3f7fce1f9fb47c8d  Update manifest.js for asset linking
56c6c5b1f15f0205ff4571d1099333d854131241  Add heatmap data caching and query 
for user contributions
0f6fe9d79cc041f3f37ca4d5e0e20bb68a64ca50  Add heatmap container to user profile 
view
afc5e9079b6a49722002f47e5b057fa491dc30ec  Add heatmap javascript logic, styles 
and localization
7ebadd0eafcf62c30241db10167726bbe9424eae  Add tests for heatmap data in 
UsersController

-- 
View it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402/files/3e5bbc764f0f66cc557ade29d56ecc5e896aea93..7ebadd0eafcf62c30241db10167726bbe9424eae
You are receiving this because you are subscribed to this thread.

Message ID: 

___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-01-28 Thread Emin Kocan via rails-dev
> > I'm working on resolving this CSP violations. Right now I'm trying to 
> > generate nonce for the .js file and use that to validate and transpass the 
> > CSP violation. I'm not sure if it is the right approach for this since I 
> > never had experience dealing with similar stuff before. If there is a more 
> > elegant and compact solution, please feel free to point it out.
> 
> Using nonces should be an absolute last resort though it is possible if we 
> need to - it is enabled for styles and the nonce is available in the 
> `csp-nonce` meta tag in the document head.
> 
> Much better to use a proper stylesheet and just add and remove classes if you 
> can though.

I agree, Tom. Since it was an external dependency, I removed it and implemented 
the labels using plain HTML and CSS instead.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#issuecomment-2618405056
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-01-28 Thread Emin Kocan via rails-dev
@kcne commented on this pull request.



> +//= require popper
+//= require tooltip
+
+
+/* global CalHeatmap, CalendarLabel, Tooltip */
+document.addEventListener("DOMContentLoaded", () => {
+  const heatmapElement = document.querySelector("#cal-heatmap");
+
+  if (!heatmapElement) {
+console.warn("Heatmap element not found in the DOM.");
+return;
+  }
+
+  const heatmapData = heatmapElement.dataset.heatmap ? 
JSON.parse(heatmapElement.dataset.heatmap) : [];
+  const colorScheme = heatmapElement.dataset.siteColorScheme || "auto";
+  const locale = $("head").data().locale;

I noticed #5538 was merged. I updated the code to use `I18n.locale` here 
instead. Let me know if I need to improve this further. Thank you.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#discussion_r1931800660
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-01-26 Thread Tom Hughes via rails-dev
> I'm working on resolving this CSP violations. Right now I'm trying to 
> generate nonce for the .js file and use that to validate and transpass the 
> CSP violation. I'm not sure if it is the right approach for this since I 
> never had experience dealing with similar stuff before. If there is a more 
> elegant and compact solution, please feel free to point it out.

Using nonces should be an absolute last resort though it is possible if we need 
to - it is enabled for styles and the nonce is available in the `csp-nonce` 
meta tag in the document head.

Much better to use a proper stylesheet and just add and remove classes if you 
can though.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#issuecomment-2614313052
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-01-24 Thread Emin Kocan via rails-dev
Updated the code again, resolved some issues raised here. Few remarks:

> CSP violations, days of week won't be visible if not resolved:
> 
> > Content-Security-Policy: (Report-Only policy) The page’s settings would 
> > block an inline style (style-src-attr) from being applied
> 
> ![image](https://private-user-images.githubusercontent.com/4158490/399146508-63e176b4-22d8-4238-9d3c-101a1cd06332.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzc3MzM1NTAsIm5iZiI6MTczNzczMzI1MCwicGF0aCI6Ii80MTU4NDkwLzM5OTE0NjUwOC02M2UxNzZiNC0yMmQ4LTQyMzgtOWQzYy0xMDFhMWNkMDYzMzIucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDEyNCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAxMjRUMTU0MDUwWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MDhmOTIwM2Y2NzllNWI0ZjIwMmJkYjFjYjY1YWE4NDQzOTJhNGRkM2NhNjhhZDJmMWY5YWZhN2Y4MjQ5ZmQyZSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.EoL-EszNCUum1gnFkRiUnrIKw93dYJSdCIw2RcnULms)

The issue was caused by the `CalendarLabel` plugin. Given the simplicity of our 
use case, I opted to convert the labels to use plain HTML/CSS instead of 
introducing custom CSP policies for controller/view/JS files. Labels should now 
display correctly, and the CSP violations should be resolved. Please let me 
know if there’s anything I might have missed.

> Is it the intended effect that nothing gets rendered in case the user made no 
> edits in the span of one year?

The heatmap now renders regardless of whether the user has made edits in the 
past year. If there’s interest in hiding the heatmap for users with no 
contributions, I can refactor it to include a fallback or placeholder message 
instead. Let me know your preference.



-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#issuecomment-2612924757
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-01-24 Thread Emin Kocan via rails-dev
@kcne commented on this pull request.



> +//= require popper
+//= require tooltip
+
+
+/* global CalHeatmap, CalendarLabel, Tooltip */
+document.addEventListener("DOMContentLoaded", () => {
+  const heatmapElement = document.querySelector("#cal-heatmap");
+
+  if (!heatmapElement) {
+console.warn("Heatmap element not found in the DOM.");
+return;
+  }
+
+  const heatmapData = heatmapElement.dataset.heatmap ? 
JSON.parse(heatmapElement.dataset.heatmap) : [];
+  const colorScheme = heatmapElement.dataset.siteColorScheme || "auto";
+  const locale = $("head").data().locale;

I noticed you opened #5538. Are the changes there related to the initialization 
concerns mentioned here?  

Regarding delaying the heatmap or using a turbo frame/collapsible section for 
performance, I’m not sure about the best metrics to determine what's acceptable 
in terms of load time/size or resource usage. Here's the network tab from 
Chrome when testing locally with the cache disabled: 

![Screenshot 2025-01-24 at 17 20 
16](https://github.com/user-attachments/assets/df1b8c92-ec1c-4ac8-a88e-6a17c2050a5d)
  

If there are specific metrics or scenarios you'd recommend testing to ensure 
this is performant and I18n is properly initialized, I’d be happy to try those 
out.

Thank you.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#discussion_r1928941127
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-01-24 Thread Emin Kocan via rails-dev
@kcne pushed 2 commits.

e1f5c0efa7265ab8280fa4c5931b32402555b9fd  Add heatmap javascript logic, styles 
and localization
3e5bbc764f0f66cc557ade29d56ecc5e896aea93  Add tests for heatmap data in 
UsersController

-- 
View it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402/files/5f064f291a73032c11d413f39997ab4efd4d2515..3e5bbc764f0f66cc557ade29d56ecc5e896aea93
You are receiving this because you are subscribed to this thread.

Message ID: 

___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-01-23 Thread Emin Kocan via rails-dev
@kcne pushed 1 commit.

5f064f291a73032c11d413f39997ab4efd4d2515  Add tests for heatmap data in 
UsersController

-- 
View it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402/files/77cffabe7b7cf36a9a2ef85655c014dd00e28874..5f064f291a73032c11d413f39997ab4efd4d2515
You are receiving this because you are subscribed to this thread.

Message ID: 

___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-01-23 Thread Emin Kocan via rails-dev
@kcne pushed 1 commit.

77cffabe7b7cf36a9a2ef85655c014dd00e28874  Add tests for heatmap data in 
UsersController

-- 
View it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402/files/296f7c77a64cb18d513386654c43d57a8c9de18c..77cffabe7b7cf36a9a2ef85655c014dd00e28874
You are receiving this because you are subscribed to this thread.

Message ID: 

___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-01-23 Thread Emin Kocan via rails-dev
@kcne pushed 2 commits.

71de44bc64893c53dd47448bb7dc01d23a0311bf  Add heatmap javascript logic, styles 
and localization
296f7c77a64cb18d513386654c43d57a8c9de18c  Add tests for heatmap data in 
UsersController

-- 
View it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402/files/6b0dbbc67b456046dc50a6b416c7a5334a90ebe1..296f7c77a64cb18d513386654c43d57a8c9de18c
You are receiving this because you are subscribed to this thread.

Message ID: 

___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-01-23 Thread Emin Kocan via rails-dev
@kcne pushed 6 commits.

13a4257e7f5de1a3c2730ec054a70a45d1406385  Add cal-heatmap lib with plugins and 
dependencies to vendor/assets/javascripts
7b682c528118abdb46f86d6f372c39f612b6de84  Update manifest.js for asset linking
75b4c70b476b080ee5d4bfeb62db50be543c7e83  Add heatmap data caching and query 
for user contributions
c9225ca7e04f03454e62c4ac8a908796723e8b52  Add heatmap container to user profile 
view
93febf0c0630a553fd2099d711bb83256b0cc35c  Add heatmap javascript logic, styles 
and localization
6b0dbbc67b456046dc50a6b416c7a5334a90ebe1  Add tests for heatmap data in 
UsersController

-- 
View it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402/files/3b916c040a435aadfd7f2ddf49696a24f56ac5b4..6b0dbbc67b456046dc50a6b416c7a5334a90ebe1
You are receiving this because you are subscribed to this thread.

Message ID: 

___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-01-23 Thread Emin Kocan via rails-dev
@kcne commented on this pull request.



> +//= require d3
+//= require cal-heatmap
+//= require calendar-label
+//= require popper
+//= require tooltip

You were right, I was overriding changes in the later commit, instead of just 
updating this commit. It's fixed now. Thank you.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#discussion_r1926587083
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-01-22 Thread Anton Khorev via rails-dev
@AntonKhorev commented on this pull request.



> +//= require d3
+//= require cal-heatmap
+//= require calendar-label
+//= require popper
+//= require tooltip

This should be removed but this is not yet removed because this commit is still 
in the branch.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#discussion_r1926358060
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-01-22 Thread Emin Kocan via rails-dev
@kcne commented on this pull request.



> @@ -53,6 +53,23 @@ def show
 if @user &&
(@user.visible? || current_user&.administrator?)
   @title = @user.display_name
+
+  one_year_ago = 1.year.ago

Just double check if it looks alright before resolving comment. Thank you.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#discussion_r1925095097
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-01-22 Thread Emin Kocan via rails-dev
@kcne commented on this pull request.



> @@ -53,6 +53,23 @@ def show
 if @user &&
(@user.visible? || current_user&.administrator?)
   @title = @user.display_name
+
+  one_year_ago = 1.year.ago

This wasn’t about freezing; it should run each time the user profile page is 
accessed. I guess I left it like that by accident. The idea was to fetch the 
changeset data from one year ago up until the current date. The thought was 
that starting one year ago would naturally include changesets up to this 
moment, effectively capturing the data for the past year.

However, I’ve now refactored the code to explicitly set both the starting and 
ending points. This makes the date range more declarative and ensures better 
clarity and consistency, while also eliminating potential ambiguities.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#discussion_r1925087216
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-01-22 Thread Emin Kocan via rails-dev
@kcne pushed 4 commits.

830d3b3790ce6e9d176ad455f2e3d84aa91c0002  Add heatmap data caching and query 
for user contributions
9a12366aa760944e196973ea5ee536eac0979ea5  Add heatmap container to user profile 
view
bdc4b68f30ed1b6fc6bdac95ee3e7236ce06a896  Add heatmap javascript logic, styles 
and localization
8e6f90c0611b792084fe536594c2904817341a26  Add tests for heatmap data in 
UsersController

-- 
View it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402/files/5216857b16acde1187bef8ea94142729694dac00..8e6f90c0611b792084fe536594c2904817341a26
You are receiving this because you are subscribed to this thread.

Message ID: 

___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-01-22 Thread Emin Kocan via rails-dev
@kcne pushed 2 commits.

54f0dd273c5deda840f14529f2291eac9bdb10f3  Add heatmap javascript logic, styles 
and localization
5216857b16acde1187bef8ea94142729694dac00  Add tests for heatmap data in 
UsersController

-- 
View it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402/files/9603ce374e5e31c986d79cb37b6d42af66a306f1..5216857b16acde1187bef8ea94142729694dac00
You are receiving this because you are subscribed to this thread.

Message ID: 

___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-01-22 Thread Emin Kocan via rails-dev
@kcne commented on this pull request.



> +gutter: 4
+  },
+  date: {
+start: startDate
+  },
+  range: 13,
+  data: {
+source: heatmapData,
+type: "json",
+x: "date",
+y: "total_changes"
+  },
+  scale: {
+color: {
+  type: "threshold",
+  range: currentTheme === "dark" ? rangeColors : rangeColors.reverse(),

Resolved now. Thanks.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#discussion_r1925050534
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-01-22 Thread Emin Kocan via rails-dev
@kcne commented on this pull request.



> +  const jsDate = new Date(date);
+  const translations = I18n.translations[locale] || I18n.translations.en;
+  const dateTranslations = translations && translations.date;
+  const monthNames = dateTranslations && dateTranslations.month_names;
+
+  const months = monthNames || [];
+  const monthName = months[jsDate.getMonth() + 1] || `${jsDate.getMonth + 1}.`;
+  const day = jsDate.getDate();
+  const year = jsDate.getFullYear();
+
+  const localizedDate = `${day}. ${monthName} ${year}.`;

This simplifies code my code a lot. Thank you very much sir

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#discussion_r1925053063
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-01-22 Thread Emin Kocan via rails-dev
@kcne commented on this pull request.



> +//= require d3
+//= require cal-heatmap
+//= require calendar-label
+//= require popper
+//= require tooltip

This should be removed. Thanks.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#discussion_r1925046801
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-01-22 Thread Emin Kocan via rails-dev
@kcne pushed 2 commits.

9ba7d12ff7dea0d09561845c6e7c98d967faeb64  Add heatmap javascript logic, styles 
and localization
9603ce374e5e31c986d79cb37b6d42af66a306f1  Add tests for heatmap data in 
UsersController

-- 
View it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402/files/904951e3cfe2a8a46092ee894bbf44a9704746eb..9603ce374e5e31c986d79cb37b6d42af66a306f1
You are receiving this because you are subscribed to this thread.

Message ID: 

___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-01-21 Thread Anton Khorev via rails-dev
@AntonKhorev commented on this pull request.



> +//= require popper
+//= require tooltip
+
+
+/* global CalHeatmap, CalendarLabel, Tooltip */
+document.addEventListener("DOMContentLoaded", () => {
+  const heatmapElement = document.querySelector("#cal-heatmap");
+
+  if (!heatmapElement) {
+console.warn("Heatmap element not found in the DOM.");
+return;
+  }
+
+  const heatmapData = heatmapElement.dataset.heatmap ? 
JSON.parse(heatmapElement.dataset.heatmap) : [];
+  const colorScheme = heatmapElement.dataset.siteColorScheme || "auto";
+  const locale = $("head").data().locale;

I think the entire heatmap can be delayed by putting it in turbo frame or maybe 
some collapsible section (maybe for performance reasons). You need `I18n` 
initialized before anyway, I don't know how you're going to translate dates 
correctly otherwise. Although popup dates seem to work even if `I18n` is not 
initialized before the heatmap because they are constructed later.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#discussion_r1923769736
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-01-21 Thread Simon Poole via rails-dev
> @simonpoole This is not something you should worry about because it will take 
> one `if` statement to remove the entire thing unlike let's say feeds.

Oh, I'm not concerned at all. I was just pointing this out for good form, aka I 
saw something that I know is wrong, and I'm giving the people here a fighting 
chance to do the right thing. 

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#issuecomment-2603905668
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-01-20 Thread Holger Jeromin via rails-dev
@HolgerJeromin commented on this pull request.



> +gutter: 4
+  },
+  date: {
+start: startDate
+  },
+  range: 13,
+  data: {
+source: heatmapData,
+type: "json",
+x: "date",
+y: "total_changes"
+  },
+  scale: {
+color: {
+  type: "threshold",
+  range: currentTheme === "dark" ? rangeColors : rangeColors.reverse(),

```suggestion
  range: currentTheme === "dark" ? rangeColors : 
Array.from(rangeColors).reverse(),
```
would solve that.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#discussion_r1923216435
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

2025-01-20 Thread Anton Khorev via rails-dev
@AntonKhorev commented on this pull request.



> +//= require popper
+//= require tooltip
+
+
+/* global CalHeatmap, CalendarLabel, Tooltip */
+document.addEventListener("DOMContentLoaded", () => {
+  const heatmapElement = document.querySelector("#cal-heatmap");
+
+  if (!heatmapElement) {
+console.warn("Heatmap element not found in the DOM.");
+return;
+  }
+
+  const heatmapData = heatmapElement.dataset.heatmap ? 
JSON.parse(heatmapElement.dataset.heatmap) : [];
+  const colorScheme = heatmapElement.dataset.siteColorScheme || "auto";
+  const locale = $("head").data().locale;

If `application.js` is initialized, the locale is available in `I18n.locale`.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#pullrequestreview-2563471777
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


  1   2   >