First mind reading session - WIP
This commit is contained in:
+22
-11
@@ -4,24 +4,35 @@
|
||||
controller: "bar",
|
||||
bar_dialog_outlet: "#bar-modal",
|
||||
bar_search_url_value: search_path,
|
||||
bar_search_turbo_frame_name_value: "search",
|
||||
bar_ask_url_value: conversation_path,
|
||||
bar_ask_turbo_frame_name_value: "conversation",
|
||||
action: "
|
||||
keydown.meta+k@document->bar#search keydown.ctrl+k@document->bar#search
|
||||
keydown.meta+a@document->bar#ask keydown.ctrl+a@document->bar#ask"
|
||||
} do %>
|
||||
<div class="flex justify-center gap" hidden>
|
||||
<button class="btn btn--plain" data-action="bar#search">
|
||||
<div class="flex justify-center gap">
|
||||
<%= tag.button \
|
||||
class: "btn btn--plain",
|
||||
data: {
|
||||
controller: "hotkey",
|
||||
action: "
|
||||
bar#search
|
||||
keydown.meta+k@document->bar#search keydown.ctrl+k@document->bar#search" } do %>
|
||||
<span>Search [<%= hotkey_label(["ctrl", "K"]) %>]</span>
|
||||
</button>
|
||||
<% end %>
|
||||
<span>or</span>
|
||||
<button class="btn btn--plain" data-action="bar#ask">
|
||||
<%= tag.button \
|
||||
class: "btn btn--plain",
|
||||
data: {
|
||||
controller: "hotkey",
|
||||
action: "
|
||||
bar#ask
|
||||
keydown.meta+a@document->bar#ask keydown.ctrl+a@document->bar#ask" } do %>
|
||||
<span>Ask [<%= hotkey_label(["ctrl", "A"]) %>]</span>
|
||||
</button>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<%= render "searches/form", query_terms: @query_terms %>
|
||||
<div hidden>
|
||||
<%= render "searches/form", query_terms: "" %>
|
||||
|
||||
<%= render "conversations/composer" %>
|
||||
</div>
|
||||
|
||||
<%= tag.dialog \
|
||||
id: "bar-modal",
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
<%= form_with model: Conversation::Message.new, local: true,
|
||||
class: "conversation__composer",
|
||||
data: {
|
||||
action: "turbo:submit-end->conversation--composer#submitEnd",
|
||||
controller: "conversation--composer",
|
||||
conversation__composer_conversation__messages_outlet: "#conversation-messages" } do |form| %>
|
||||
|
||||
<%= form.hidden_field :client_message_id, data: { conversation__composer_target: "clientMessageIdInput" } %>
|
||||
|
||||
<div class="conversation__input">
|
||||
<%= form.text_field :content,
|
||||
autofocus: "on",
|
||||
placeholder: "Ask something…",
|
||||
class: "input input--textarea",
|
||||
data: {
|
||||
action: "
|
||||
keydown.enter->conversation--composer#submit
|
||||
keydown.ctrl+enter->conversation--composer#submit",
|
||||
conversation__composer_target: "textInput" } %>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -9,7 +9,7 @@
|
||||
</div>
|
||||
<%= turbo_frame_tag dom_id(@conversation, :messages_container), src: conversation_messages_path, target: "_top" %>
|
||||
<%= render partial: "conversations/show/thinking_indicator", locals: { conversation: @conversation } %>
|
||||
<%= render partial: "conversations/show/composer", locals: { conversation: @conversation } %>
|
||||
<%= render partial: "composer" %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
<%= form_with model: Conversation::Message.new, local: true,
|
||||
id: dom_id(conversation, :composer),
|
||||
class: "conversation__composer",
|
||||
data: {
|
||||
action: "turbo:submit-end->conversation--composer#submitEnd",
|
||||
controller: "conversation--composer",
|
||||
conversation__composer_conversation__messages_outlet: "##{dom_id(conversation, :messages)}" } do |form| %>
|
||||
|
||||
<%= form.hidden_field :client_message_id, data: { conversation__composer_target: "clientMessageIdInput" } %>
|
||||
|
||||
<div class="conversation__input">
|
||||
<%= form.text_area :content, autofocus: "on", placeholder: "Ask something…", rows: 1,
|
||||
class: "input input--textarea", data: { action: "keydown.enter->conversation--composer#submit keydown.ctrl+enter->conversation--composer#submit", conversation__composer_target: "textInput" } %>
|
||||
</div>
|
||||
|
||||
<div class="conversation__submit">
|
||||
<%= form.button type: "submit", class: "btn btn--link txt-small",
|
||||
data: { conversation__composer_target: "submitButton", action: "click->conversation--composer#submit"} do %>
|
||||
<%= icon_tag "arrow-up" %>
|
||||
<span class="for-screen-reader">Send message</span>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
Reference in New Issue
Block a user