Skip to content
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

Add preferences for analytics #843

Merged
merged 8 commits into from
Mar 10, 2023
Merged

Add preferences for analytics #843

merged 8 commits into from
Mar 10, 2023

Conversation

dhruvkb
Copy link
Member

@dhruvkb dhruvkb commented Mar 5, 2023

Fixes

Fixes #821 by @dhruvkb

Description

This PR

  • adds a switch view to the checkbox based on the WordPress design language
  • removes dummy example feature flags
  • adds feature flag for analytics
  • updates the preferences UI to match mockups from Safe content browsing flow #791
  • adds documentation for the feature flag system

Testing Instructions

Checklist

  • My pull request has a descriptive title (not a vague title like
    Update index.md).
  • My pull request targets the default branch of the repository (main) or
    a parent feature branch.
  • My commit messages follow best practices.
  • My code follows the established code style of the repository.
  • I added or updated tests for the changes I made (if applicable).
  • I added or updated documentation (if applicable).
  • I tried running the project locally and verified that there are no visible
    errors.

Developer Certificate of Origin

Developer Certificate of Origin
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

@dhruvkb dhruvkb added this to the Analytics milestone Mar 5, 2023
@dhruvkb dhruvkb requested a review from a team as a code owner March 5, 2023 01:09
@dhruvkb dhruvkb requested review from krysal and AetherUnbound March 5, 2023 01:09
@openverse-bot openverse-bot added 🟨 priority: medium Not blocking but should be addressed soon 🌟 goal: addition Addition of new feature 💻 aspect: code Concerns the software code in the repository labels Mar 5, 2023
@github-actions
Copy link

github-actions bot commented Mar 5, 2023

Full-stack documentation: Ready

https://WordPress.github.io/openverse/_preview/843

Please note that GitHub pages takes a little time to deploy newly pushed code, if the links above don't work or you see old versions, wait 5 minutes and try again.

You can check the GitHub pages deployment action list to see the current status of the deployments.

@dhruvkb dhruvkb mentioned this pull request Mar 6, 2023
7 tasks
Copy link
Member

@zackkrida zackkrida left a comment

Choose a reason for hiding this comment

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

This is really, really impressive. I have some ideas, particularly around making /preferences a user-facing page in production and hiding some of the implementation details from end users of our flagging setup:

  • We should sentence case the flag names, so new_header becomes the more human-readable "New header".
  • In production, we should only show features which are switchable, since they are the only thing actionable to users. This also allows us to have "private" features in beta. For example, I've been thinking of creating a feature flag which randomly makes 50% of returned results marked as "sensitive", so we can more easily test sensitive content blurring. I would want that to be switchable in staging but hidden entirely in production, because it would only serve to confuse users.
  • Similarly, we should hide the 'content-filtering' and 'store-state' sections in production.
  • I quite like the idea of a dedicated group for analytics. Could we then exclude analytics from the 'Switchable features' section? And if we show it in production, maybe give it a friendlier name like "Labs" or "Beta features", something like that?

Bugs, other thoughts

  • I believe the store state needs to be stringified, as I'm currently only seeing "[object Object]" output in the code block.

  • What is the "Content filtering" section, exactly? I'm having trouble understanding it. It seems like it's meant to show the state of some flags.

  • The toggle, despite being from the WordPress design language, is difficult visually. The active state is filled in black completely and looks odd to me. Is this how it's meant to look?

    CleanShot 2023-03-06 at 10 14 00

@dhruvkb
Copy link
Member Author

dhruvkb commented Mar 6, 2023

One I want to mention is that the preferences page is still internal and not for public use. What I meant by the UI updated to match the mockups is only regarding this segment:

Screenshot 2023-03-06 at 9 42 15 PM

Francisco's mockups in #791 suggest a popover for settings and this area matches the contents of that popup.

So while you're raising some very good points in the first half of your review, they don't really apply here because making this page public is not the plan here.

Bugs, other thoughts

  • The code block renders just fine for me. I tested it on Firefox and Chrome and it renders the complete data for me.
  • I can't remember what that section is exactly, which is a pretty good sign that it can just be removed altogether 😄.
  • The switches have a white knob when enabled and match the WP DL 100%. I tested it on Firefox and Chrome and it renders the white knob for me.

It is very weird that you're seeing UI bugs which are rendering fine for me. Screenshot attached for reference:

image

@dhruvkb dhruvkb requested a review from a team as a code owner March 6, 2023 18:00
@dhruvkb dhruvkb requested review from zackkrida and obulat March 6, 2023 18:00
Copy link
Member

@zackkrida zackkrida left a comment

Choose a reason for hiding this comment

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

oh god, I had JS disabled on the page when reviewing the first time 🤦 .

I tested the a11y of the checkbox and I think it's good. Especially considering this is not intended to be a public page, I think we can save additional auditing of that component for the future. LGTM.

@zackkrida zackkrida mentioned this pull request Mar 7, 2023
26 tasks
@krysal krysal removed their request for review March 7, 2023 21:43
@dhruvkb dhruvkb added 🟧 priority: high Stalls work on the project or its dependents and removed 🟨 priority: medium Not blocking but should be addressed soon labels Mar 8, 2023
@dhruvkb
Copy link
Member Author

dhruvkb commented Mar 8, 2023

Upped the priority to high because I'd like to be able to use this work in #862.

@dhruvkb dhruvkb added the 🧱 stack: frontend Related to the Nuxt frontend label Mar 9, 2023
Copy link
Contributor

@obulat obulat left a comment

Choose a reason for hiding this comment

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

Looks beautiful! I have a question and a suggestion inline, but they are not blocking.

@dhruvkb dhruvkb merged commit 47343a8 into main Mar 10, 2023
@dhruvkb dhruvkb deleted the switch branch March 10, 2023 15:52
dhruvkb pushed a commit that referenced this pull request Apr 14, 2023
Co-authored-by: Madison Swain-Bowden <bowdenm@spu.edu>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💻 aspect: code Concerns the software code in the repository 🌟 goal: addition Addition of new feature 🟧 priority: high Stalls work on the project or its dependents 🧱 stack: frontend Related to the Nuxt frontend
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add feature flag for analytics
4 participants