openaustralia/planningalerts

View on GitHub
app/views/_tailwind/applications/_map.html.erb

Summary

Maintainability
Test Coverage
<% if application.location %>
  <%# Only using map class here to help target accessibility tests in rspec/features/comment_to_authority_spec.rb %>
  <div class="flex justify-between map">
    <div class="<%= class_names("w-full", "sm:h-[528px]", "aspect-1", "h-auto", "xl:w-[528px]" => !Flipper.enabled?(:disable_streetview_in_app, current_user)) %>">
      <%= render Tailwind::Map.new(lat: application.lat, lng: application.lng, address: application.address, zoom: 16) do %>
        <%= google_static_map(application, size: "528x528") %>
      <% end %>
    </div>
    <%# TODO: #1813 Don't show pano if there's no useful streetview available %>
    <% unless Flipper.enabled?(:disable_streetview_in_app, current_user) %>
      <div x-data class="hidden xl:block w-[528px] h-[528px]">
        <%= render Tailwind::Streetview.new(lat: application.lat, lng: application.lng, address: application.address) do %>
          <%# Note that the "Disable Javascript" extension for firefox and chrome has a bug in it where it doesn't show
          the second noscript when js is disabled https://github.com/dpacassi/disable-javascript/issues/79#issuecomment-743995262.
          However, when you turn off javascript in the browser settings it does show the contents
          of the second noscript. This is very confusing and sent me down a long rabbit-hole trying to figure out what
          was going on. %>
          <%= google_static_streetview(application, size: "528x528") %>
        <% end %>
      </div>
    <% end %>
  </div>
<% end %>