feat(ui): add Star on GitHub / Review on G2 CTAs#3116
Merged
Conversation
- add both CTAs to the footer link row with Tabler icons - surface an "Enjoying Anthias?" nudge after a successful asset add, gated on >=3 real (non-default) enabled assets - persist dismiss (permanent) and "Maybe later" (90-day snooze) in anthias.conf so state survives cache clears and spans browsers - fire via a review-cta HX-Trigger; home.ts replays it for the raw-XHR upload path Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Tag both G2 CTAs so review referrals are attributable, matching the existing footer UTM convention (utm_source=Anthias, utm_campaign=UI): footer link uses utm_medium=footer, the post-add nudge uses utm_medium=review_cta. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds “help the project” CTAs to the Anthias web UI (footer links + a post-add, dismissible review/star nudge) with server-persisted dismissal/snooze state and HTMX trigger plumbing.
Changes:
- Introduces server-side “review CTA” state (
review_cta_dismissed,review_cta_snooze_until) and two POST endpoints to dismiss/snooze the nudge. - Extends asset-add response helper to optionally attach a
review-ctaHX-Trigger (and refactors HX-Trigger handling to support stacking triggers). - Adds the nudge UI partial + styling, updates footer links, and adds tests covering threshold/dismiss/snooze behavior.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
tests/test_template_views.py |
Adds integration tests asserting when review-cta HX-Trigger should/shouldn’t be attached. |
src/anthias_server/settings.py |
Persists CTA dismissal/snooze state in anthias.conf defaults. |
src/anthias_server/app/views.py |
Adds HX-Trigger merge helper, CTA gating logic, and dismiss/snooze endpoints; wires CTA offering into asset-add flows. |
src/anthias_server/app/urls.py |
Registers routes for dismiss/snooze POST endpoints. |
src/anthias_server/app/templates/_review_cta.html |
Adds the Alpine-driven nudge UI and POST calls for dismiss/snooze. |
src/anthias_server/app/templates/_layout.html |
Includes the new nudge partial globally. |
src/anthias_server/app/templates/_footer.html |
Replaces plain GitHub footer link with “Star on GitHub” and “Review on G2”. |
src/anthias_server/app/static/src/home.ts |
Replays review-cta event for raw-XHR upload flow by parsing the HX-Trigger header. |
src/anthias_server/app/static/sass/_styles.scss |
Adds styling for the fixed-position CTA card. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
A hand-edited review_cta_snooze_until without a tz offset parsed to a naive datetime and raised "can't compare offset-naive and offset-aware datetimes" against timezone.now(). Anchor naive values with make_aware() before comparing. Adds a regression test. Addresses Copilot review feedback on #3116. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The dismiss path is only reached by acting on a CTA (star or review); there is no explicit "No thanks" action, so drop the misleading "said no" phrasing from the settings comment and the view docstring. Addresses Copilot review feedback on #3116. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
HX-Trigger is a JSON-encoded header string, not a subscriptable dict; describe the decode/set/re-encode merge instead of the misleading `response['HX-Trigger'][key] = value` notation. Addresses Copilot review feedback on #3116. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- _maybe_offer_review_cta only needs to know whether the device has REVIEW_CTA_MIN_ASSETS real assets, so slice before counting to cap the scan instead of COUNT(*) over the whole table. - drop awkward leading space/quote from the snooze view and test docstrings. Addresses Copilot review feedback on #3116. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The test env resolves settings.conf_file to the real ~/.anthias/anthias.conf, so the fixture's settings.save() leaked dismiss/snooze state onto the developer machine. Redirect conf_file to a per-test temp path for the duration of the fixture and reload the real config on teardown. Addresses Copilot review feedback on #3116. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.



What
Adds two lightweight "help the project" CTAs to the web UI:
When the nudge appears
Only at a genuinely positive moment, and never nags:
default_*assets don't count. A fresh device with its first asset is never asked.anthias.conf(review_cta_dismissed,review_cta_snooze_until), so it survives a browser/cache clear and stays consistent across every browser/device the operator uses.Implementation notes
_maybe_offer_review_cta()attaches areview-ctaHX-Trigger on qualifying adds._set_toast_headerwas refactored into a shared_merge_hx_triggerso the toast and CTA triggers stack in one header without clobbering each other.home.tsreplays thereview-ctaevent by hand for that path.review_cta_dismissandreview_cta_snooze.Tests
Four cases in
tests/test_template_views.py: fires at threshold, silent below threshold, suppressed after dismiss, suppressed while snoozed.ruff check/ruff format --checkclean.Note for reviewers
The G2 link points at
https://www.g2.com/products/anthias/reviews— please confirm that product page exists before merge (otherwise the CTA 404s).🤖 Generated with Claude Code