Skip to content

armgit / sure

Public Imported from GitHub
0

The personal finance app for everyone (by everyone)

Ruby
1.6 KB
Raw Blame
<div data-controller="chat hotkey" data-chat-response-timeout-value="<%= Chat.response_timeout_ms %>" class="h-full">
  <%= turbo_frame_tag chat_frame do %>
    <div class="flex flex-col h-full md:p-4">
      <% if show_demo_warning? %>
        <%= render "shared/demo_warning",
          title: t("chats.demo_banner_title"),
          message: t("chats.demo_banner_message") %>
      <% end %>

      <% if @chats.any? %>
        <div class="grow flex flex-col">
          <div class="flex items-center justify-between my-6">
            <h1 class="text-xl font-medium"><%= t(".chats") %></h1>
            <%= render DS::Link.new(
              id: "new-chat",
              icon: "plus",
              variant: "icon",
              href: new_chat_path,
              frame: chat_frame,
              text: t(".new_chat")
            ) %>
          </div>
          <div class="space-y-2 px-0.5">
            <%= render @chats %>
          </div>
          <%# The mobile "Assistant" nav item lands here and the layout's
              consent prompt only lives in the desktop sidebar, so an
              AI-disabled user with existing chats needs it shown here too. %>
          <% unless Current.user.ai_enabled? %>
            <%= render "chats/chat_composer" %>
          <% end %>
        </div>
      <% else %>
        <div class="grow flex flex-col">
          <h1 class="sr-only"><%= t(".chats") %></h1>
          <div class="mt-auto py-8">
            <%= render "chats/ai_greeting" %>
          </div>
          <%= render "chats/chat_composer" %>
        </div>
      <% end %>
    </div>
  <% end %>
</div>