Skip to content

Conversation

@sanne-san
Copy link
Contributor

@sanne-san sanne-san commented Nov 5, 2025

Changes

  • All empty states have been enhanced by center-aligned copy, link to docs, and CTA.
  • Whenever empty state is shown, the setting's subtitle is hidden.

Tests

  • Automated tests have been added

Dark mode

  • The UI has been tested both in dark and light mode

@ukutaht ukutaht added the preview label Nov 5, 2025
@github-actions
Copy link

github-actions bot commented Nov 5, 2025

Preview environment👷🏼‍♀️🏗️
PR-5874

@sanne-san sanne-san requested a review from a team November 6, 2025 09:07
- Add show_content? attribute to generic tile component
- Ensure content is hidden when toggled off
- Avoid rendering border and empty space when toggled off
- Fix formatting
Add funnel
</.button>
</.filter_bar>
<%= if String.trim(@filter_text) != "" || Enum.count(@funnels) > 0 do %>
Copy link
Member

Choose a reason for hiding this comment

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

or is perfectly valid here since both left and right hand side expressions return a boolean

aerosol and others added 2 commits November 18, 2025 11:26
- Update the settings live views to use the new tile component
- Ensure tile component is updated when feature visibility is toggled
- Extract `no_search_results` and `empty_state` components for better readability
- Extract `highlighted` component
- Update tests
Copy link
Member

@aerosol aerosol left a comment

Choose a reason for hiding this comment

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

Impressive work! Some comments inline.

</.button>
</.filter_bar>
<% end %>
Copy link
Member

@aerosol aerosol Nov 19, 2025

Choose a reason for hiding this comment

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

Suggested change
<.filter_bar :if={@searching? or length(@props) > 0} filter_text={@filter_text} placeholder="Search Properties">
<.button phx-click="add-prop" mt?={false}>
Add property
</.button>
</.filter_bar>

when can props be anything else than a list here? 🤔

Copy link
Member

Choose a reason for hiding this comment

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

The suggestion above displays in a weird way, apologies, probably not a great idea to commit it directly 😓

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed with Adam, even though the condition existed already before this PR, it's safe to remove. I think this is some kind of leftover from when site.allowed_event_props (which can be nil, meaning that all props are allowed to display) was passed into this component directly. But I just checked that that's not the case anymore and @props gets the value of site.allowed_event_props || [].

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok cool, yeah I kept it as I wasn't sure if I was missing any context on that. Updated it to be the same as goals and funnels.

<.search_form
:if={
@has_sites? and
(Teams.setup?(@current_team) or @sites.entries != [] or @filter_text != "")
Copy link
Member

Choose a reason for hiding this comment

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

Why is Teams.setup?(@current_team) here?

If a team is setup and all its sites have been deleted, then perhaps it's pointless to show the search bar? The +Add button becomes broken then though.

With several new conditions here and there, we might want to test those cases to guard it from regression - removing that :if breaks zero tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The reason is that I improved the personal sites empty state, so that it's hidden there when personal sites is empty and team sites isn't.
CleanShot 2025-11-19 at 09 36 03@2x

But I realise now that I should also fix up the empty state for team sites, and perhaps that can simplify the whole thing a bit (although we still want a different call to action on the personal sites empty state).


test "search funnels input is rendered", %{conn: conn, site: site} do
setup_goals(site)
{:ok, _} = setup_funnels(site)
Copy link
Member

Choose a reason for hiding this comment

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

👌 ✨

sanne-san and others added 4 commits November 19, 2025 15:43
- Hide top bar on `/sites` when empty state is shown
- Extract empty state logic to a separate function
- Show the same empty state for both personal and team sites, with different copy
- extract search logic to a separate function
- add tests for various empty states cases
  - remove HTTP feature visibility routes now that
    we're doing it 100% via LV
  - add tests for feature toggling
  - move "site_role" to where it's used (upgrade CTA),
    since there were already some feature-related function calls
    there
  - fix random test failures left
Copy link
Contributor

@RobertJoonas RobertJoonas left a comment

Choose a reason for hiding this comment

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

Brilliant work! 👏 Thanks for this @sanne-san @aerosol!

Loving the site_role/current_role -> current_user assigns being changed. Also played around on staging and everything was working super smooth.

Noticed this small UI thing btw (not related to this PR but should be a very easy fix):

image

Comment on lines +514 to +515
<div class={["border-b dark:border-gray-700 mx-6", if(not @show_content?, do: "hidden")]}></div>
<div class={["relative", if(not @show_content?, do: "hidden")]}>
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice! 👌

:if={@feature_toggle?}
feature_mod={@feature_mod}
module={PlausibleWeb.Components.Site.Feature.ToggleLive}
id={"feature-toggle-#{@site.id}-#{@feature_mod}"}
Copy link
Contributor

Choose a reason for hiding this comment

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

What's this id used for? I'm seeing another id attribute defined by the ToggleLive component itself (the wrapper div):

<div class="mt-4" id={"feature-#{@feature_mod.name()}-toggle"}>

Should we stick to a single one?

Copy link
Member

Choose a reason for hiding this comment

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

Tests. I guess we prefer data-test-id?

@sanne-san
Copy link
Contributor Author

sanne-san commented Nov 20, 2025

Noticed this small UI thing btw (not related to this PR but should be a very easy fix):

image

Thank you! I'll look into this little bug separately 🙏

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants