Skip to content

feat(ui): add Star on GitHub / Review on G2 CTAs#3116

Merged
vpetersson merged 7 commits into
masterfrom
feat/star-review-ctas
Jul 6, 2026
Merged

feat(ui): add Star on GitHub / Review on G2 CTAs#3116
vpetersson merged 7 commits into
masterfrom
feat/star-review-ctas

Conversation

@vpetersson

Copy link
Copy Markdown
Contributor

What

Adds two lightweight "help the project" CTAs to the web UI:

  • Footer links — the plain "GitHub" footer link is replaced by two labelled CTAs: Star on GitHub and Review on G2 (Tabler icons).
  • Post-add nudge — a dismissible bottom-right card ("Enjoying Anthias?") that surfaces after a successful asset add, offering the same two actions plus a Maybe later.

When the nudge appears

Only at a genuinely positive moment, and never nags:

  • Fires after an asset is added (URL, App, YouTube, or file upload).
  • Gated on the device carrying ≥3 real (operator-added, enabled) assets — seed default_* assets don't count. A fresh device with its first asset is never asked.
  • Acting on either CTA silences it permanently; Maybe later snoozes it for 90 days.
  • State lives server-side in 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 a review-cta HX-Trigger on qualifying adds. _set_toast_header was refactored into a shared _merge_hx_trigger so the toast and CTA triggers stack in one header without clobbering each other.
  • The file-upload path is raw XHR, so htmx never sees the header — home.ts replays the review-cta event by hand for that path.
  • Two POST endpoints back the card: review_cta_dismiss and review_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 --check clean.

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

- 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>
@vpetersson vpetersson requested a review from a team as a code owner July 6, 2026 17:39
@vpetersson vpetersson requested a review from Copilot July 6, 2026 17:40
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>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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-cta HX-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.

Comment thread src/anthias_server/app/views.py
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>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

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

Comment thread src/anthias_server/app/templates/_review_cta.html
Comment thread src/anthias_server/settings.py Outdated
Comment thread src/anthias_server/app/views.py
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>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Comment thread src/anthias_server/app/views.py
Comment thread src/anthias_server/app/views.py

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Comment thread src/anthias_server/app/views.py
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>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

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

Comment thread src/anthias_server/app/views.py
Comment thread src/anthias_server/app/views.py Outdated
Comment thread tests/test_template_views.py Outdated
- _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>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Comment thread tests/test_template_views.py
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>
@vpetersson vpetersson requested a review from Copilot July 6, 2026 18:28
@sonarqubecloud

sonarqubecloud Bot commented Jul 6, 2026

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated no new comments.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated no new comments.

@vpetersson vpetersson merged commit 3f40f29 into master Jul 6, 2026
12 checks passed
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