From b719a8b80dfa49881d2640e60fa560ee876acfe3 Mon Sep 17 00:00:00 2001 From: Alex Hatzenbuhler Date: Thu, 22 May 2025 10:38:05 -0500 Subject: [PATCH] Add new ai chat button, tweak ai navigation (#2272) * Add new chat button * Tweak chat navigation * Fix chat nav padding on new chat * Make the button nicer * Fix bad tailwind class * Use menu icon instead of left * Fix path --- app/views/chats/_chat_nav.html.erb | 5 ++++- app/views/chats/index.html.erb | 35 +++++++++++++++--------------- app/views/chats/new.html.erb | 2 +- 3 files changed, 22 insertions(+), 20 deletions(-) diff --git a/app/views/chats/_chat_nav.html.erb b/app/views/chats/_chat_nav.html.erb index c4be93ee..5f4d44b5 100644 --- a/app/views/chats/_chat_nav.html.erb +++ b/app/views/chats/_chat_nav.html.erb @@ -9,6 +9,8 @@ variant: "icon", icon: "menu", href: path, + frame: chat_frame, + text: "All chats" ) %>
@@ -24,7 +26,8 @@ variant: "link", text: "Edit chat title", href: edit_chat_path(chat, ctx: "chat"), - icon: "pencil", data: { turbo_frame: dom_id(chat, "title") }) %> + icon: "pencil", + frame: dom_id(chat, "title")) %> <% menu.with_item( variant: "button", diff --git a/app/views/chats/index.html.erb b/app/views/chats/index.html.erb index 8560ef97..1b8f6d1d 100644 --- a/app/views/chats/index.html.erb +++ b/app/views/chats/index.html.erb @@ -2,32 +2,31 @@ <%= turbo_frame_tag chat_frame do %>
<% if @chats.any? %> - - <% end %> - -
- <% if @chats.any? %> -

Chats

+
+
+

Chats

+ <%= render LinkComponent.new( + id: "new-chat", + icon: "plus", + variant: "icon", + href: new_chat_path, + frame: chat_frame, + text: "New chat" + ) %> +
<%= render @chats %>
- <% else %> +
+ <% else %> +

Chats

<%= render "chats/ai_greeting" %>
- <%= render "messages/chat_form" %> - <% end %> -
+
+ <% end %>
<% end %>
diff --git a/app/views/chats/new.html.erb b/app/views/chats/new.html.erb index fd1311b3..8bee5429 100644 --- a/app/views/chats/new.html.erb +++ b/app/views/chats/new.html.erb @@ -1,5 +1,5 @@ <%= turbo_frame_tag chat_frame do %> -
+
<%= render "chats/chat_nav", chat: @chat %>