Skip to content

Add interactive circuit visualizations using GIFs and video embeds#775

Open
Ram-sah19 wants to merge 6 commits intoCircuitVerse:masterfrom
Ram-sah19:feature/circuit-animations
Open

Add interactive circuit visualizations using GIFs and video embeds#775
Ram-sah19 wants to merge 6 commits intoCircuitVerse:masterfrom
Ram-sah19:feature/circuit-animations

Conversation

@Ram-sah19
Copy link
Copy Markdown

@Ram-sah19 Ram-sah19 commented Mar 27, 2026

Description
Problem

Currently, circuit diagrams in the application are static, which makes it difficult for users to understand how circuits and logic gates function dynamically.

Solution

This PR introduces:

GIF-based animations to demonstrate circuit behavior
Optional embedded videos (via YouTube) for deeper explanations
Features Added
Logic gate animations (AND, OR, NOT)
Circuit behavior visualization
Reusable CircuitVisualizer component
Technical Details
Added React component for rendering GIFs/videos
Used responsive layout for better UX
Lazy loading for performance optimization
Screenshots / Demo

(Add screenshots or GIFs here)

Type of Change

Enhancement (UI/UX improvement)

Checklist

Code compiles correctly

No console errors

Responsive design tested

Performance considered

Related Issue

Fixes #605

Summary by CodeRabbit

  • New Features

    • Interactive logic-gate animations added to the logic gates documentation.
  • Bug Fixes

    • More reliable quiz answer randomization.
    • Improved mouse/pointer handling for interactive diagrams.
  • Chores

    • GitHub workflow checkout updated and build script no longer requires elevated privileges.
    • Site footer now displays the current year dynamically; analytics tracking entry removed/disabled.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 27, 2026

Warning

Rate limit exceeded

@Ram-sah19 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 21 minutes and 14 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 21 minutes and 14 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 59de4071-de19-4ff0-8ca3-f0ebe1c67e16

📥 Commits

Reviewing files that changed from the base of the PR and between aea53ac and 2252829.

📒 Files selected for processing (1)
  • _sass/custom/custom.scss

Walkthrough

This pull request adds a new Jekyll include that renders interactive logic-gate animations (AND, OR, NOT, NAND, NOR, XOR, XNOR) on a canvas with live input toggles and output display, plus accompanying SCSS for widget styling. It inserts gate include instances into documentation pages. Additionally, it updates GitHub Actions checkout to v4 and removes sudo from an API generation step, changes site config to use a dynamic footer year and removes the Universal Analytics ID, refactors JavaScript for robust scroll handling and answer shuffling, and removes a stray shebang line.

🚥 Pre-merge checks | ✅ 2 | ❌ 3

❌ Failed checks (2 warnings, 1 inconclusive)

Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title references GIFs and video embeds, but the actual changeset implements HTML/JavaScript canvas-based animations, not GIFs or embedded videos. Update the title to reflect the actual implementation, e.g., 'Add interactive canvas-based logic gate animations'.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Linked Issues check ❓ Inconclusive The PR implements canvas-based animations for logic gates, which partially addresses issue #605's goal of interactive circuit visualizations, but issue #605 specifically requested GIFs or embedded videos, not custom JavaScript animations. Clarify whether canvas animations satisfy the requirements, or add GIF/video embeds as originally requested in issue #605.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Out of Scope Changes check ✅ Passed All changes are scoped to logic gate visualization enhancements, supporting configuration updates, and minor cleanup (shebang removal, dependency upgrades).

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 94efdf1f-e017-42ba-a9e4-c01fc76ca32d

📥 Commits

Reviewing files that changed from the base of the PR and between ac91c0a and ac7ac2d.

📒 Files selected for processing (8)
  • .github/scripts/assign-or-comment.js
  • .github/workflows/deploy.yml
  • _config.yml
  • _includes/gate_animation.html
  • _sass/custom/custom.scss
  • assets/js/module.js
  • assets/js/quiz.js
  • docs/comb-ssi/logic-gates.md
💤 Files with no reviewable changes (1)
  • .github/scripts/assign-or-comment.js

Comment thread _config.yml
# Footer content
# appears at the bottom of every page's main content
footer_content: "Copyright © 2026 Contributors to CircuitVerse. Distributed under a [CC-by-sa] license."
footer_content: "Copyright © {% assign current_year = 'now' | date: '%Y' %}{{ current_year }} Contributors to CircuitVerse. Distributed under a [CC-by-sa] license."
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Check how just-the-docs theme renders footer_content

# Search for footer_content usage in theme layouts/includes
fd -e html -e liquid . | xargs rg -n 'site\.footer_content' 2>/dev/null || echo "No matches in local files"

# Check if liquify filter is available (would enable Liquid in config values)
rg -n 'liquify' --type-add 'rb:*.rb' --type rb 2>/dev/null || echo "No liquify filter found"

Repository: CircuitVerse/Interactive-Book

Length of output: 122


🌐 Web query:

Does Jekyll just-the-docs theme process Liquid in footer_content config value?

💡 Result:

No, the Jekyll Just the Docs theme does not process Liquid in the footer_content config value. The official documentation explicitly states that footer_content is deprecated and recommends using _includes/footer_custom.html for "more robust markup / liquid-based content," implying that the config value itself does not support Liquid processing. Config values in Jekyll _config.yml are strings and not rendered as Liquid templates unless explicitly passed through a Liquid filter like | markdownify or captured in an include. The example given uses static HTML strings without Liquid syntax. For Liquid support, users must use the custom include file instead.

Citations:


Move Liquid logic out of _config.yml — it will not be evaluated here.

Jekyll does not process Liquid tags within _config.yml values. The {% assign current_year = 'now' | date: '%Y' %}{{ current_year }} syntax will be output literally as raw text in the footer instead of rendering the dynamic year.

The just-the-docs theme recommends using _includes/footer_custom.html for Liquid-based content. Create that file with the year logic and remove the Liquid syntax from the config.

Comment on lines +6 to +7
<div class="gate-anim-wrapper" id="gate-anim-{{ include.gate }}">
<canvas class="gate-anim-canvas" id="canvas-{{ include.gate }}" width="340" height="120" aria-label="{{ include.gate }} gate animation"></canvas>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Make instance targeting unique; current ID scheme collides for repeated same-gate embeds.

Line 6-Line 7 use IDs based only on gate type. If gate_animation.html is included twice with the same gate, the DOM gets duplicate IDs and the script (Line 21-Line 25) will bind to the wrong instance.

💡 Proposed fix
-<div class="gate-anim-wrapper" id="gate-anim-{{ include.gate }}">
-  <canvas class="gate-anim-canvas" id="canvas-{{ include.gate }}" width="340" height="120" aria-label="{{ include.gate }} gate animation"></canvas>
+<div class="gate-anim-wrapper" data-gate="{{ include.gate }}">
+  <canvas class="gate-anim-canvas" width="340" height="120" aria-label="{{ include.gate }} gate animation"></canvas>
@@
-(function() {
-  var gateId = "{{ include.gate }}";
-  var canvas = document.getElementById("canvas-" + gateId);
-  var ctx = canvas.getContext("2d");
-  var wrapper = document.getElementById("gate-anim-" + gateId);
+(function() {
+  var gateId = "{{ include.gate }}";
+  var scriptEl = document.currentScript;
+  var wrapper = scriptEl ? scriptEl.previousElementSibling : null;
+  if (!wrapper) return;
+  var canvas = wrapper.querySelector(".gate-anim-canvas");
+  if (!canvas) return;
+  var ctx = canvas.getContext("2d");
+  if (!ctx) return;

Also applies to: 21-25

Comment on lines +162 to +165
var outEl = wrapper.querySelector(".output-val");
if (outEl) outEl.textContent = out ? "1 (HIGH)" : "0 (LOW)";
outEl.style.color = out ? "#28a745" : "#dc3545";
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Complete the null guard for .output-val updates.

Line 164 dereferences outEl.style even when outEl is null. Keep both writes under the same guard.

💡 Proposed fix
-    if (outEl) outEl.textContent = out ? "1 (HIGH)" : "0 (LOW)";
-    outEl.style.color = out ? "#28a745" : "#dc3545";
+    if (outEl) {
+      outEl.textContent = out ? "1 (HIGH)" : "0 (LOW)";
+      outEl.style.color = out ? "#28a745" : "#dc3545";
+    }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
var outEl = wrapper.querySelector(".output-val");
if (outEl) outEl.textContent = out ? "1 (HIGH)" : "0 (LOW)";
outEl.style.color = out ? "#28a745" : "#dc3545";
}
var outEl = wrapper.querySelector(".output-val");
if (outEl) {
outEl.textContent = out ? "1 (HIGH)" : "0 (LOW)";
outEl.style.color = out ? "#28a745" : "#dc3545";
}
}

Comment thread _sass/custom/custom.scss
margin-top: 0.5rem;
}

.gate-anim-controls label {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Merge rule .gate-anim-controls label with rule on line 331

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.

Adding Live Workings in Content

1 participant