defmodule ToweropsWeb.Layouts do
@moduledoc """
This module holds layouts and related functionality
used by your application.
"""
use ToweropsWeb, :html
# Embed all files in layouts/* within this module.
# The default root.html.heex file contains the HTML
# skeleton of your application, namely HTML headers
# and other static content.
embed_templates "layouts/*"
@doc """
Renders your app layout.
This function is typically invoked from every template,
and it often contains your application menu, sidebar,
or similar.
## Examples
Content
"""
attr :flash, :map, required: true, doc: "the map of flash messages"
attr :current_scope, :map,
default: nil,
doc: "the current [scope](https://hexdocs.pm/phoenix/scopes.html)"
slot :inner_block, required: true
def app(assigns) do
~H"""
{render_slot(@inner_block)}
<.flash_group flash={@flash} />
"""
end
@doc """
Renders the authenticated app layout with navigation.
Use this for pages that require organization context.
## Examples
Content
"""
attr :flash, :map, required: true, doc: "the map of flash messages"
attr :current_scope, :map,
default: nil,
doc: "the current scope (contains user and impersonation state)"
attr :current_organization, :any,
default: nil,
doc: "the current organization (can be nil for pages without org context)"
attr :active_page, :string,
default: nil,
doc: "the currently active page (dashboard, sites, equipment, or alerts)"
slot :inner_block, required: true
def authenticated(assigns) do
~H"""
<%= if @current_scope && @current_scope.impersonating? do %>
"""
end
@doc """
Provides dark vs light theme toggle based on themes defined in app.css.
See in root.html.heex which applies the theme before page load.
"""
def theme_toggle(assigns) do
~H"""
"""
end
@doc """
Renders the admin layout.
Use this for admin pages that require superuser access.
## Examples
Admin Content
"""
attr :flash, :map, required: true, doc: "the map of flash messages"
slot :inner_block, required: true
def admin(assigns) do
~H"""