1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-21 14:19:39 +02:00

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
This commit is contained in:
Alex Hatzenbuhler 2025-05-22 10:38:05 -05:00 committed by GitHub
parent a71b62575c
commit b719a8b80d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 22 additions and 20 deletions

View file

@ -9,6 +9,8 @@
variant: "icon", variant: "icon",
icon: "menu", icon: "menu",
href: path, href: path,
frame: chat_frame,
text: "All chats"
) %> ) %>
<div class="grow"> <div class="grow">
@ -24,7 +26,8 @@
variant: "link", variant: "link",
text: "Edit chat title", text: "Edit chat title",
href: edit_chat_path(chat, ctx: "chat"), 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( <% menu.with_item(
variant: "button", variant: "button",

View file

@ -2,32 +2,31 @@
<%= turbo_frame_tag chat_frame do %> <%= turbo_frame_tag chat_frame do %>
<div class="flex flex-col h-full md:p-4"> <div class="flex flex-col h-full md:p-4">
<% if @chats.any? %> <% if @chats.any? %>
<nav class="mb-6"> <div class="grow flex flex-col">
<% back_path = @last_viewed_chat ? chat_path(@last_viewed_chat) : new_chat_path %> <div class="flex items-center justify-between my-6">
<h1 class="text-xl font-medium">Chats</h1>
<%= render LinkComponent.new( <%= render LinkComponent.new(
variant: "icon", id: "new-chat",
icon: "arrow-left", icon: "plus",
href: back_path, variant: "icon",
) %> href: new_chat_path,
</nav> frame: chat_frame,
<% end %> text: "New chat"
) %>
<div class="grow flex flex-col"> </div>
<% if @chats.any? %>
<h1 class="text-xl font-medium mb-6">Chats</h1>
<div class="space-y-2 px-0.5"> <div class="space-y-2 px-0.5">
<%= render @chats %> <%= render @chats %>
</div> </div>
<% else %> </div>
<% else %>
<div class="grow flex flex-col">
<h1 class="sr-only">Chats</h1> <h1 class="sr-only">Chats</h1>
<div class="mt-auto py-8"> <div class="mt-auto py-8">
<%= render "chats/ai_greeting" %> <%= render "chats/ai_greeting" %>
</div> </div>
<%= render "messages/chat_form" %> <%= render "messages/chat_form" %>
<% end %> </div>
</div> <% end %>
</div> </div>
<% end %> <% end %>
</div> </div>

View file

@ -1,5 +1,5 @@
<%= turbo_frame_tag chat_frame do %> <%= turbo_frame_tag chat_frame do %>
<div class="flex flex-col h-full md:px-4 md:pb-4"> <div class="flex flex-col h-full md:p-4">
<%= render "chats/chat_nav", chat: @chat %> <%= render "chats/chat_nav", chat: @chat %>
<div class="mt-auto py-8"> <div class="mt-auto py-8">