Skip to content

Conversation

@mveytsman
Copy link
Member

@mveytsman mveytsman commented Jan 26, 2026

Describe your changes

  • Add /tags admin page for dispatchers to manage rider tags
  • Tags can be marked as restricted, hiding them from riders on their profile
  • Restricted tags are shown with a lock icon in the dispatcher view
  • Riders can only see and modify non-restricted tags on their profile
  • Remove inline tag creation from rider edit form (use Tags page instead)
  • Add Tags link to sidebar navigation
CleanShot 2026-01-26 at 00 22 55@2x

Editing a riders' tags
CleanShot 2026-01-26 at 00 23 05@2x

When not a dispatcher you don't see restricted tags
CleanShot 2026-01-26 at 00 23 31@2x

Checklist before requesting a review

  • I have performed a self-review of my code
  • If it is a core feature, I have added tests.
  • Are there other PRs or Issues that I should link to here?
  • Will this be part of a product update? If yes, please write one phrase
    about this update in the description above.

- Add /tags admin page for dispatchers to manage rider tags
- Tags can be marked as restricted, hiding them from riders on their
  profile
- Restricted tags are shown with a lock icon in the dispatcher view
- Riders can only see and modify non-restricted tags on their profile
- Remove inline tag creation from rider edit form (use Tags page
  instead)
- Add Tags link to sidebar navigation
- Add tag fixture in test/support/fixtures.ex for creating test tags
- Add context tests in riders_test.exs for tag CRUD operations:
  - create_tag, update_tag, delete_tag
  - list_tags, list_tags_with_rider_count
  - toggle_tag_restricted, change_tag, get_tag!, search_tags
- Create tag_live_test.exs for Tags admin page:
  - List tags with name, restricted status, and rider count
  - Create, edit, delete tags via modals
  - Toggle restricted status inline
  - Access control for non-dispatchers
- Add tag visibility tests in rider_live_test.exs:
  - Dispatcher can see all tags including restricted
  - Rider cannot see restricted tags on profile
  - Rider cannot see restricted tags in edit form
Copy link
Contributor

@teesloane teesloane left a comment

Choose a reason for hiding this comment

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

Added a few optional nits and comments but can be merged without.

def render(assigns) do
~H"""
<div class="block w-full px-3 py-2 my-1 border border-gray-300 rounded-md focus-within:outline-none focus-within:ring-1 focus-within:ring-blue-500 focus-within:border-blue-300">
<div class="block w-full px-3 py-2 my-1 border border-gray-300 rounded-md">
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
<div class="block w-full px-3 py-2 my-1 border border-gray-300 rounded-md">
<div class="flex flex-wrap gap-1 w-full px-3 py-2 my-1 border border-gray-300 rounded-md">

This will remove the jumpiness from the tags when toggling them:

CleanShot.2026-01-28.at.09.26.49.mp4

Comment on lines +118 to +127
<span
class={[
"my-0.5 inline-flex items-center px-2.5 py-1.5 rounded-md text-md font-medium cursor-pointer hover:bg-gray-200",
if(tag.restricted, do: "bg-gray-200 text-gray-500", else: "bg-gray-100 text-gray-500")
]}
phx-click={JS.push("select", value: %{name: tag.name}, target: @myself)}
>
<Heroicons.plus mini class="w-4 h-4 mr-1" />
{tag.name}
<Heroicons.lock_closed :if={tag.restricted} mini class="w-4 h-4 ml-1 text-amber-600" />
Copy link
Contributor

Choose a reason for hiding this comment

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

Not required but we could make this a "dumb component" to tidy up a bit.

<.header>
Tags
<:subtitle>
Manage rider tags. Restricted tags are hidden from riders on their profile.
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it worth saying why one might want to add rider tags / how they are used?

<% visible_tags =
if @current_user.is_dispatcher,
do: @rider.tags,
else: Enum.reject(@rider.tags, & &1.restricted) %>
Copy link
Contributor

Choose a reason for hiding this comment

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

Opinion: normally I think it's fine to assign variables in template code, but since we're dealing with content that may be restricted, it might be worth pulling this out into a function and putting it in rider_live/show.ex

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants