Skip to content

[plugins] LeetCode Summary 0.2.0: desktop tile host - #231

Open
mannish01 wants to merge 2 commits into
Ryoku-dev:mainfrom
mannish01:add-leetcode-summary-desktop
Open

mannish01 wants to merge 2 commits into
Ryoku-dev:mainfrom
mannish01:add-leetcode-summary-desktop

Conversation

@mannish01

Copy link
Copy Markdown
Contributor

Follow-up to the maintainer's note on #227: LeetCode Pulse's desktop tile is now a second host inside LeetCode Summary, so the same stats are available as a bar glyph (with panel) and a desktop tile, sharing one service and one helper like Coffee/VPN. The separate Pulse PR stays closed; this PR carries the feature.

What changed

  • content/Widget.qml dispatches on density: Glyph.qml at glyph (bar) and Card.qml at compact (desktop). content/Card.qml is the paper-and-ink tile: solved count, rank, difficulty bar, streak, acceptance, top languages and a 12-week activity grid. A click opens the configured profile only when a username is set.
  • bin/leetcode_summary.py now fetches /language too, so the tile does not need a second helper. All four endpoints must answer before a snapshot is called live or the cache is rewritten; a partial outage keeps the saved snapshot.
  • Manifest/registry bumped to 0.2.0, hosts [topbarGlyph, desktopWidget], densities glyph/compact, both preview images included, official: false.
  • This PR is based on current main, so it preserves the merged per-user defaults from [plugins] add LeetCode Summary bar plugin #228 (empty username, 120 s minimum poll, no fetch until a handle is set). The tile shows SET USERNAME instead of any hardcoded profile until configured.

Per-user behaviour and safety

  • Each installer sets their own handle in the panel; both views switch to that account and use a username-scoped summary.json under pluginApi.stateDir for offline fallback.
  • Declared hosts remain alfa-leetcode-api.onrender.com and leetcode.com; the profile URL is opened only on an explicit tile click and only with a non-empty username.
  • No token, no login, no shell interpolation; cache writes stay under stateDir.

Verification

  • Helper tests: all-live live=true, 37 solved, 3.37M rank, 64%, languages sorted, activity dot 3; /solved outage and /language outage each live=false with saved 37; offline other handle 0. All passed.
  • ryoku plugin validate plugins/leetcode-summary → 0 blocking, 0 warnings.
  • tests/validate-catalogue.sh and tests/validate-store.py --root . --categories plugins → OK.
  • tools/security-screen.py --staged → 0 blocking, 234 warning(s), 0 error(s), leetcode-summary findings: 0.
  • Quickshell harness loaded Card.qml through the new dispatcher with fake stats and no QML errors; the tile design is the already-rendered desktop preview at assets/preview-desktop.png.

Source repo updated first: https://github.com/mannish01/LeetCode-Summary.

@neur0map neur0map left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🔍 mika reviewed this change; details in the walkthrough comment.

🧹 Nitpicks (5) — optional, not blocking
  1. plugins/leetcode-summary/content/Widget.qml:29-39 — Bug — Forward root.open to Glyph; otherwise its open property stays false and the glyph loses its panel-open highlight. Regenerate the product manifest and registry hash after changing the payload.

    Suggested change

Loader {
    id: glyphLoader
    active: root.isGlyph
    sourceComponent: Glyph {
        pluginApi: root.pluginApi
        active: root.active
        open: root.open
        density: root.density
        s: root.s
        widthBudget: root.widthBudget
    }
}
  1. plugins/leetcode-summary/content/Card.qml:82 — Possible Bug — With the default empty username, the service has not fetched a snapshot, but the header still displays LIVE. Show an unconfigured or idle state until a live snapshot exists so the zero counts are not presented as fetch…

  2. plugins/leetcode-summary/content/Card.qml:220-226 — Possible Bug — build_dots returns consecutive days, but this grid fills seven columns before starting the next row. Each row therefore represents a week, rather than each column as described, making the activity map misleading; use 1…

    Suggested change

columns: 12
  1. plugins/leetcode-summary/content/Card.qml:285 — Possible Bug — The profile URL interpolates the username without encoding it as a path component. A configured handle containing ?, #, or / opens a different URL from the profile requested by the helper; encode the username befor…

    Suggested change

Qt.openUrlExternally("https://leetcode.com/u/" + encodeURIComponent(root.username) + "/");
  1. plugins/leetcode-summary/content/Widget.qml:29-39 — Suggestion: bug — Forward the panel-open state

    Suggested change

Loader {
    id: glyphLoader
    active: root.isGlyph
    sourceComponent: Glyph {
        pluginApi: root.pluginApi
        active: root.active
        open: root.open
        density: root.density
        s: root.s
        widthBudget: root.widthBudget
    }
}

@neur0map

neur0map commented Nov 30, 2026 •

Copy link
Copy Markdown
Member

🦊 mika's review

Incremental review: new commits since the last checkpoint.

Summary

  • Add a desktop tile alongside the existing bar glyph.
  • Share statistics and settings across both hosts.
  • Fetch language statistics and show submission totals.
  • Update catalogue metadata and installation guidance.

Estimated review effort: 1/5 · risk: low

📁 Walkthrough details

plugins/leetcode-summary/content/Card.qml

  • Adds a compact desktop tile backed by the shared plugin service.
    • Displays solved counts, rank, difficulty, streak, acceptance, languages, and activity.
    • Shows loading or saved status and opens the configured profile on click.

plugins/leetcode-summary/content/Widget.qml

  • Dispatches the shared host entry point to the glyph or desktop card by density.
    • Loads Glyph.qml for glyph density and Card.qml otherwise.
    • Passes shared host properties to the selected view.

plugins/leetcode-summary/content/Glyph.qml

  • Extracts the existing bar glyph into a separate view.
    • Retains panel toggling and adds acceptance to the tooltip.

plugins/leetcode-summary/bin/leetcode_summary.py

  • Extends the shared helper with language and submission statistics for both views.
    • Fetches the language endpoint alongside the existing endpoints.
    • Returns the top three languages and accepted and total submissions.
    • Increases the activity intensity cap and removes the helper's empty-username guard.

plugins/leetcode-summary/content/Panel.qml

  • Adds accepted and total submission counts to the bar panel.
    • Displays the new helper fields alongside existing statistics.

plugins/leetcode-summary/manifest.json

  • Registers the desktop host and its default placement for version 0.2.0.
    • Adds the new views and desktop preview to the file list.

plugins/leetcode-summary/product-manifest.json

  • Updates the delivery manifest for the new version and files.
    • Adds installable QML views and the desktop preview metadata.
    • Refreshes sizes and hashes for changed files.

plugins/registry.json

  • Updates the catalogue entry to advertise both supported hosts.
    • Bumps the version and manifest hash and adds the desktop screenshot and tag.

plugins/leetcode-summary/README.md

  • Documents the shared service, desktop tile, settings, and offline behavior.
    • Adds desktop preview and placement instructions.

No actionable findings. Mika looked for bugs, security issues, and risks in the diff and came up empty on clear defects.

🚦 Merge recommendation: no_concerns_found


🦊 Generated by Mika — the Ryoku org's self-hosted AI code reviewer. Machine findings: verify before merging.

@mannish01

Copy link
Copy Markdown
Contributor Author

Addressed all five nitpicks from mika, and used the chance to polish the two views as requested.

Review fixes

  1. Panel-open highlight — Widget.qml now forwards open: root.open to Glyph.qml, so the bar glyph keeps its open-state colour through the dispatcher.
  2. Unconfigured tile — the tile status pill now shows SET USERNAME when no handle is set, IDLE before the first snapshot, then SYNCING / SAVED / LIVE. The footer says SET A USERNAME IN THE BAR PANEL instead of misleading Fetching languages…, and the header shows @SET USERNAME rather than a fake profile.
  3. Activity grid — Card.qml now uses columns: 12, so each column is one week of seven consecutive days (matching the helper's chronological 84-day array and the existing panel grid). Today's cell is outlined in the accent colour.
  4. Profile URL — the tile click path now uses encodeURIComponent(root.username), matching the panel action, so ?, # or / in a handle cannot change the URL. It still only opens when a username is set.
  5. Duplicate open-state finding — covered by the same open forwarding fix.

Product manifest and registry hash were regenerated with tools/pack-product.py plugins/leetcode-summary --touch after the payload changed.

Polish / extra features

  • Tile: hover highlights the card border; rank line now has an optional solved / total progress track when the API reports a question total; accepted / submissions totals appear under the acceptance figure.
  • Panel: added an accepted / submissions line under the headline solved count.
  • Bar glyph tooltip now includes the acceptance rate.

Verification (on this push)

  • Helper tests: all-live live=true, 37 solved, 3.37M, 64%, languages sorted, dot 3; /solved and /language outages each keep saved 37 with live=false; offline other handle 0. Passed.
  • Quickshell harness rendered the new Card.qml through the dispatcher with 84 activity days, total, accepted and submissions populated — HARNESS_OK … 37, no QML reference errors (the first grid run caught and fixed a missing required index property).
  • ryoku plugin validate plugins/leetcode-summary → 0 blocking, 0 warnings.
  • Catalogue/store validators → OK.
  • tools/security-screen.py --staged → 0 blocking, 234 warning(s), 0 error(s), leetcode-summary findings: 0.

Source repo updated first at https://github.com/mannish01/LeetCode-Summary. Ready for re-review.

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.

2 participants