Files
sure/app/views/layouts/auth.html.erb
Juan José Mata d47aa2fe90 PWA offline error page + login page cleanup (#327)
* Add friendly PWA offline error page

When the PWA fails to connect to the server, users now see a branded
offline page with a friendly "technical difficulties" message, the
app logo, and a reload button. The page automatically attempts to
reload when connectivity is restored.

Changes:
- Created public/offline.html with branded offline experience
- Updated service worker to cache and serve offline page on network failures
- Added service worker registration in application.js
- Service worker now handles navigation requests with offline fallback

* Extract PWA offline logo to separate cached asset

Move the inline SVG logo from offline.html to a separate file at
public/logo-offline.svg. This makes the logo asset easily identifiable
and maintainable, as it may diverge from other logo versions in the future.

Changes:
- Created public/logo-offline.svg with the offline page logo
- Updated service worker to cache logo as part of OFFLINE_ASSETS array
- Updated fetch handler to serve cached offline assets
- Updated offline.html to reference logo file instead of inline SVG

* Update offline message for better readability

Signed-off-by: Juan José Mata <juanjo.mata@gmail.com>

* CodeRabbit comments

* Keep 40x and 50x flowing

* Dark mode

* Logo tweaks

* Login/sign up cleanup

---------

Signed-off-by: Juan José Mata <juanjo.mata@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com>
2025-11-16 21:12:48 +01:00

45 lines
2.2 KiB
Plaintext

<%= render "layouts/shared/htmldoc" do %>
<div class="flex flex-col h-full">
<div class="flex flex-col h-full px-6 py-12 bg-surface">
<div class="grow flex flex-col justify-center">
<div class="sm:mx-auto sm:w-full sm:max-w-md">
<div class="flex justify-center mt-2 md:mb-6">
<%= image_tag "logomark.svg", class: "w-16 mb-6" %>
</div>
<div class="space-y-2">
<% if (controller_name == "sessions" && action_name == "new") || (controller_name == "registrations" && action_name == "new") %>
<div class="space-y-3 md:hidden w-full my-4">
<div class="bg-surface-inset rounded-lg p-1 flex">
<%= link_to new_session_path,
class: "w-1/2 px-2 py-1 rounded-md text-sm text-center font-medium #{current_page?(new_session_path) ? 'bg-surface shadow-sm text-primary' : 'text-secondary'}" do %>
<%= t("layouts.auth.sign_in") %>
<% end %>
<%= link_to new_registration_path,
class: "w-1/2 px-2 py-1 rounded-md text-sm text-center font-medium #{!current_page?(new_session_path) ? 'bg-surface shadow-sm text-primary' : 'text-secondary'}" do %>
<%= t("layouts.auth.sign_up") %>
<% end %>
</div>
</div>
<% end %>
<% if controller_name == "sessions" %>
<p class="text-sm text-center hidden md:block">
<%= tag.span t(".no_account", product_name: product_name), class: "text-secondary" %> <%= link_to t(".sign_up"), new_registration_path, class: "font-medium text-primary hover:underline transition" %>
</p>
<% elsif controller_name == "registrations" %>
<p class="text-sm text-center text-gray-600 hidden md:block">
<%= t(".existing_account") %> <%= link_to t(".sign_in"), new_session_path, class: "font-medium text-primary hover:underline transition" %>
</p>
<% end %>
</div>
</div>
<div class="mt-0 md:mt-8 sm:mx-auto sm:w-full sm:max-w-lg">
<%= yield %>
</div>
</div>
<%= render "layouts/shared/footer" %>
</div>
</div>
<% end %>