Skip to content

Open-source live-chat, email support, omni-channel desk. An alternative to Intercom, Zendesk, Salesforce Service Cloud etc. πŸ”₯πŸ’¬

3.4 KB
Raw Blame
<% platform_icons = { "iPhone" => "i-ri-apple-fill", "iPad" => "i-ri-apple-fill", "Android" => "i-ri-android-fill" } %>

<% if @accounts_without_push.any? %>
  <%= render "notice", icon: "i-lucide-bell-off" do %>
    <%= t("#{scope}.push_settings.none_enabled",
          count: @accounts_without_push.size,
          names: @accounts_without_push.map { |setting| account_label(setting) }.join(', ')) %>
    <%= link_to t("#{scope}.push_settings.review_link"), super_admin_user_diagnostics_path(user_query: @query, tab: 'push') %>
  <% end %>
<% end %>

<%= render "card", title: t("#{scope}.sessions.heading"), count: @mobile_sessions.size do %>
  <% if @mobile_sessions.empty? %>
    <%= render "empty", icon: "i-lucide-smartphone", title: t("#{scope}.sessions.empty.title"), description: t("#{scope}.sessions.empty.description") %>
  <% else %>
    <p class="flex items-start gap-1.5 px-4 py-3 text-label-small text-n-slate-11">
      <span class="i-lucide-radio size-3.5 shrink-0 translate-y-px"></span>
      <%= t("#{scope}.sessions.description") %>
    </p>
    <div class="overflow-x-auto border-t border-n-weak">
      <%= render "table" do %>
        <thead>
          <tr>
            <% %w[app_version platform os_version device first_seen last_active].each do |column| %>
              <th><%= t("#{scope}.sessions.columns.#{column}") %></th>
            <% end %>
          </tr>
        </thead>
        <tbody>
          <% @mobile_sessions.each do |session| %>
            <tr>
              <td>
                <% if session.browser_version.present? %>
                  <span class="font-mono text-xs font-medium"><%= session.browser_version %></span>
                <% else %>
                  <%= render "badge", label: t("#{scope}.sessions.legacy_build"), tone: :warning %>
                <% end %>
              </td>
              <%# device_name holds the platform family, platform_name the device model. %>
              <td>
                <span class="inline-flex items-center gap-1.5">
                  <span class="<%= platform_icons.fetch(session.device_name.to_s, 'i-lucide-smartphone') %> size-4 shrink-0 text-n-slate-11"></span>
                  <%= session.device_name.presence || 'β€”' %>
                </span>
              </td>
              <td class="font-mono text-xs"><%= session.platform_version.presence || 'β€”' %></td>
              <td><%= session.platform_name.presence || 'β€”' %></td>
              <td class="whitespace-nowrap tabular-nums text-n-slate-11"><%= session.created_at.strftime('%Y-%m-%d') %></td>
              <td class="whitespace-nowrap tabular-nums">
                <% if session.last_activity_at %>
                  <%= session.last_activity_at.strftime('%Y-%m-%d %H:%M') %>
                  <span class="text-xs text-n-slate-10">(<%= t("super_admin.record.time_ago", time: time_ago_in_words(session.last_activity_at)) %>)</span>
                <% else %>
                  <span class="text-n-slate-10">β€”</span>
                <% end %>
              </td>
            </tr>
          <% end %>
        </tbody>
      <% end %>
    </div>
    <p class="flex items-start gap-1.5 border-t border-n-weak px-4 py-3 text-label-small text-n-slate-11">
      <span class="i-lucide-info size-3.5 shrink-0 translate-y-px"></span>
      <%= t("#{scope}.sessions.legacy_note") %>
    </p>
  <% end %>
<% end %>

<%= render "calls", scope: scope, readiness: @ring_readiness if @ring_readiness %>