Skip to content

create new universal js config file to include into the skill wheel t…#659

Merged
Sahil590 merged 20 commits intomainfrom
595-js-snippet
Apr 1, 2026
Merged

create new universal js config file to include into the skill wheel t…#659
Sahil590 merged 20 commits intomainfrom
595-js-snippet

Conversation

@Sahil590
Copy link
Copy Markdown
Contributor

@Sahil590 Sahil590 commented Mar 27, 2026

Description

I removed the common bits of JS code and moved them to a JS file in the static folder and Included it in the skill profile page, roles and index page (hero.html)

Fixes #595

Type of change

  • Documentation (non-breaking change that adds or improves the documentation)
  • New feature (non-breaking change which adds functionality)
  • Optimization (non-breaking, back-end change that speeds up the code)
  • Technical work (non-breaking, change which is work as part of a new feature)
  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (whatever its nature)

Key checklist

  • All tests pass (eg. python -m pytest)
  • The documentation builds and looks OK (eg. mkdocs serve)
  • Pre-commit hooks run successfully (eg. pre-commit run --all-files)

Further checks

  • Code is commented, particularly in hard-to-understand areas
  • Tests added or an issue has been opened to tackle that in the future. (Indicate issue here: # (issue))

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR centralizes the Radial Bar Chart (“Skills Wheel”) configuration and render helper into a shared static JS file, then updates templates to use that shared function rather than repeating the config inline.

Changes:

  • Added main/static/main/js/radial-bar-chart-config.js to hold radialBarChartConfig and renderRadialBarChart(...).
  • Updated three templates to load the shared JS and call renderRadialBarChart(...) instead of duplicating the config object.
  • Reduced inline JS duplication across the Skills Wheel pages/snippets.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

File Description
main/templates/main/user_skill_profile.html Loads shared chart config JS and switches to renderRadialBarChart(...).
main/templates/main/snippets/hero.html Loads shared chart config JS and reuses renderRadialBarChart(...) for the homepage hero wheel.
main/templates/main/pages/roles.html Loads shared chart config JS and reuses renderRadialBarChart(...) to render all sample role wheels.
main/static/main/js/radial-bar-chart-config.js New shared chart configuration + render helper.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread main/templates/main/user_skill_profile.html Outdated
Comment thread main/templates/main/snippets/hero.html Outdated
Comment thread main/templates/main/pages/roles.html Outdated
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Sahil Raja and others added 3 commits March 27, 2026 12:08
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Comment thread main/static/js/radial-bar-chart-config.js Outdated
Comment thread main/templates/main/pages/roles.html Outdated
Copy link
Copy Markdown
Collaborator

@AdrianDAlessandro AdrianDAlessandro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! I much prefer this approach of using a template snippet.

I think we can unify the modes with a bit of logic and not need to provide a mode at all. Certainly the skill-profile and hero mode should be able to use the exact same logic. They both take data for one user and produce one plot. And then following that, the data for one user can just be in a list of length one, and that's the only different in the roles mode (it takes a list of user data instead of just one).

Does that make sense?

Comment thread main/views/page_views.py Outdated
Comment on lines +161 to +167
context["sample_data"] = sample_data
context["chart_data"] = dumps(
[
{"target_id": str(p["user_id"]), "user_data": p["user_data"]}
for p in sample_data
]
)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a huge fan of this structure. We're doubling up on the context data being sent. Since the "user_data" values are in both context entries. It also means that in the templates, the id value of the div is coming from the "sample_data", but the id that the JS is updating is coming from the "chart_data", which feels unstable to me.

Perhaps, instead of adding an entirely new context variable to all of the views, the best option is to use the existing "user_id" field of the sample data. This just means adding that value in to the skill profile view.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is still sending a separate sample_data that also contains the user_data. We should only need to send one of them.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I missed this I still had sample_data in the HTML file just changed it now.

@Sahil590 Sahil590 requested review from Copilot and removed request for Copilot April 1, 2026 07:10
Copy link
Copy Markdown
Collaborator

@AdrianDAlessandro AdrianDAlessandro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! Happy with this now!

@Sahil590 Sahil590 merged commit 61ae34a into main Apr 1, 2026
5 checks passed
@Sahil590 Sahil590 deleted the 595-js-snippet branch April 1, 2026 09:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make snippet for the skill wheel visualisation

3 participants