-
-
Notifications
You must be signed in to change notification settings - Fork 177
feat(virtual-lab): improve subject nav and restructure home labs #983
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| {% extends "virtual_lab/layout.html" %} | ||
|
|
||
| {% load i18n %} | ||
|
|
||
| {% block virtual_lab_content %} | ||
| <div class="container mx-auto px-4 py-8"> | ||
| <div class="bg-white dark:bg-gray-800 shadow-lg rounded-lg overflow-hidden"> | ||
| <div class="px-8 py-6"> | ||
| <h2 class="text-4xl font-extrabold text-gray-800 dark:text-gray-100 mb-4">{% trans "Physics Experiments" %}</h2> | ||
| <p class="text-gray-600 dark:text-gray-300 mb-8"> | ||
| {% trans "Explore these interactive physics simulations. Click on any card below to begin." %} | ||
| </p> | ||
| <div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6"> | ||
| <a href="{% url 'virtual_lab:physics_pendulum' %}" | ||
| class="block bg-gradient-to-b from-blue-50 dark:from-blue-900 to-white dark:to-gray-800 border border-blue-200 dark:border-blue-700 rounded-lg p-6 shadow hover:shadow-md transition focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 dark:focus:ring-offset-gray-800"> | ||
| <h3 class="text-2xl font-semibold text-blue-700 dark:text-blue-300 mb-2">{% trans "Pendulum Motion" %}</h3> | ||
| <p class="text-blue-600 dark:text-blue-400">{% trans "Visualize how length affects a pendulum's period." %}</p> | ||
| </a> | ||
| <a href="{% url 'virtual_lab:physics_projectile' %}" | ||
| class="block bg-gradient-to-b from-green-50 dark:from-green-900 to-white dark:to-gray-800 border border-green-200 dark:border-green-700 rounded-lg p-6 shadow hover:shadow-md transition focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 dark:focus:ring-offset-gray-800"> | ||
| <h3 class="text-2xl font-semibold text-green-700 dark:text-green-300 mb-2">{% trans "Projectile Motion" %}</h3> | ||
| <p class="text-green-600 dark:text-green-400"> | ||
| {% trans "Launch a projectile and observe its real-time trajectory." %} | ||
| </p> | ||
| </a> | ||
| <a href="{% url 'virtual_lab:physics_inclined' %}" | ||
| class="block bg-gradient-to-b from-yellow-50 dark:from-yellow-900 to-white dark:to-gray-800 border border-yellow-200 dark:border-yellow-700 rounded-lg p-6 shadow hover:shadow-md transition focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-yellow-500 dark:focus:ring-offset-gray-800"> | ||
| <h3 class="text-2xl font-semibold text-yellow-800 dark:text-yellow-300 mb-2">{% trans "Inclined Plane" %}</h3> | ||
| <p class="text-yellow-700 dark:text-yellow-400"> | ||
| {% trans "See a block slide down and discover acceleration on a ramp." %} | ||
| </p> | ||
| </a> | ||
| <a href="{% url 'virtual_lab:physics_mass_spring' %}" | ||
| class="block bg-gradient-to-b from-purple-50 dark:from-purple-900 to-white dark:to-gray-800 border border-purple-200 dark:border-purple-700 rounded-lg p-6 shadow hover:shadow-md transition focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-purple-500 dark:focus:ring-offset-gray-800"> | ||
| <h3 class="text-2xl font-semibold text-purple-700 dark:text-purple-300 mb-2">{% trans "Mass-Spring Oscillation" %}</h3> | ||
| <p class="text-purple-600 dark:text-purple-400"> | ||
| {% trans "Set k and m, drag the mass, then watch it oscillate and view x(t)." %} | ||
| </p> | ||
| </a> | ||
| <a href="{% url 'virtual_lab:physics_electrical_circuit' %}" | ||
| class="block bg-gradient-to-b from-teal-50 dark:from-teal-900 to-white dark:to-gray-800 border border-teal-200 dark:border-teal-700 rounded-lg p-6 shadow hover:shadow-md transition focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-teal-500 dark:focus:ring-offset-gray-800"> | ||
| <h3 class="text-2xl font-semibold text-teal-700 dark:text-teal-300 mb-2">{% trans "Basic Electrical Circuit" %}</h3> | ||
| <p class="text-teal-600 dark:text-teal-400"> | ||
| {% trans "Build an RC circuit, adjust R, C, and V0, and watch the capacitor charge in real time." %} | ||
| </p> | ||
| </a> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| {% endblock virtual_lab_content %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick | 🔵 Trivial
Consider data-driven styling to reduce template conditionals.
The if/elif/else chain for subject-specific colors works but is verbose. If more subjects are added, this pattern will grow. Consider adding color classes to the subject data structure in
build_virtual_lab_subjects().♻️ Example approach
In
views.py, add color metadata:{ "key": "physics", "label": _("Physics"), "color": "blue", # or "bg_class": "bg-blue-50 dark:bg-blue-900", etc. ... }Then simplify the template to use
subject.colordirectly in class interpolation or a template filter.🤖 Prompt for AI Agents