Fix navigation bugs
This commit is contained in:
@@ -16,4 +16,14 @@
|
||||
border-block-start: 1px solid var(--color-ink-lighter);
|
||||
}
|
||||
}
|
||||
|
||||
.bar__modal {
|
||||
inset: auto 0 0 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
max-height: 70vh;
|
||||
position: fixed;
|
||||
right: 0;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class ConversationsController < ApplicationController
|
||||
def create
|
||||
Conversation.create_or_find_by(user: Current.user)
|
||||
Current.user.start_or_continue_conversation
|
||||
end
|
||||
|
||||
def show
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Controller } from "@hotwired/stimulus"
|
||||
import { post } from "@rails/request.js"
|
||||
|
||||
export default class extends Controller {
|
||||
static targets = [ "modalTurboFrame" ]
|
||||
static targets = [ "turboFrame" ]
|
||||
static outlets = [ "dialog" ]
|
||||
static values = {
|
||||
searchUrl: String,
|
||||
@@ -11,6 +11,15 @@ export default class extends Controller {
|
||||
askTurboFrameName: String
|
||||
}
|
||||
|
||||
connect() {
|
||||
this.closeModal()
|
||||
}
|
||||
|
||||
closeModal() {
|
||||
this.dialogOutlet.close()
|
||||
this.#clearTurboFrame()
|
||||
}
|
||||
|
||||
search() {
|
||||
this.#openInTurboFrame(this.searchTurboFrameNameValue, this.searchUrlValue)
|
||||
this.dialogOutlet.open()
|
||||
@@ -22,9 +31,15 @@ export default class extends Controller {
|
||||
this.dialogOutlet.open()
|
||||
}
|
||||
|
||||
#clearTurboFrame() {
|
||||
this.turboFrameTarget.removeAttribute("id")
|
||||
this.turboFrameTarget.removeAttribute("src")
|
||||
this.turboFrameTarget.innerHtml = ""
|
||||
}
|
||||
|
||||
#openInTurboFrame(name, url) {
|
||||
this.modalTurboFrameTarget.id = name
|
||||
this.modalTurboFrameTarget.src = url
|
||||
this.turboFrameTarget.id = name
|
||||
this.turboFrameTarget.src = url
|
||||
}
|
||||
|
||||
#initializeConversation() {
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
<%= turbo_frame_tag "conversation", target: "_top" do %>
|
||||
<%= turbo_frame_tag "conversation" do %>
|
||||
<%= turbo_stream_from Current.user, :conversation %>
|
||||
<div class="conversation">
|
||||
<div class="conversation__header">
|
||||
<span class="txt-medium font-weight-black margin-inline-start-half">Fizzy /Ask</span>
|
||||
<form method="dialog">
|
||||
<button class="btn txt-x-small">
|
||||
<%= icon_tag "remove-med" %>
|
||||
<span class="for-screen-reader">Close</span>
|
||||
</button>
|
||||
</form>
|
||||
<button class="btn txt-x-small" data-action="bar#closeModal:prevent">
|
||||
<%= icon_tag "remove-med" %>
|
||||
<span class="for-screen-reader">Close</span>
|
||||
</button>
|
||||
</div>
|
||||
<%= turbo_frame_tag dom_id(@conversation, :messages_container), src: conversation_messages_path, target: "_top" %>
|
||||
<%= render partial: "conversations/show/thinking_indicator", locals: { conversation: @conversation } %>
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
<% if Current.user && !@hide_footer_frames %>
|
||||
<div id="footer_frames" data-turbo-permanent="true">
|
||||
<%= render "bar/bar" %>
|
||||
<%= render "my/pins/tray" %>
|
||||
<%= render "shared/bar" %>
|
||||
<%= render "notifications/tray" %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<li>
|
||||
<%= link_to result.source, class: "card card--search" do %>
|
||||
<%= link_to result.source, class: "card card--search", data: { turbo_frame: "_top" } do %>
|
||||
<header class="card__header">
|
||||
<label class="card__collection flex align-center">
|
||||
<span class="card__id"><%= result.card_id %></span>
|
||||
|
||||
@@ -1,44 +1,31 @@
|
||||
<% @page_title = "Search" %>
|
||||
|
||||
<% content_for :header do %>
|
||||
<nav class="header">
|
||||
<div class="header__actions header__actions--start">
|
||||
<%= link_to_back fallback_path: root_path %>
|
||||
</div>
|
||||
|
||||
<h1 class="header__title"><%= @page_title %></h1>
|
||||
|
||||
<div class="header__actions header__actions--end"></div>
|
||||
</nav>
|
||||
<% end %>
|
||||
|
||||
<%= turbo_frame_tag "search", target: :_top do %>
|
||||
<button class="btn txt-x-small" data-action="dialog#close:prevent">
|
||||
<button class="btn txt-x-small" data-action="bar#closeModal:prevent">
|
||||
<%= icon_tag "remove-med" %>
|
||||
<span class="for-screen-reader">Close</span>
|
||||
</button>
|
||||
<%= auto_submit_form_with url: searches_queries_path(q: @query_terms), method: :post %>
|
||||
|
||||
<section class="search">
|
||||
<% if @query_terms.present? %>
|
||||
<div class="search__results">
|
||||
<% if @search_results.none? %>
|
||||
<div class="search__empty">
|
||||
No search results
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<ul class="search__list">
|
||||
<%= render partial: "searches/result", collection: @search_results %>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<aside class="search__history">
|
||||
<h3>Your recent searches…</h3>
|
||||
<ul class="search__list">
|
||||
<%= render partial: "searches/search_query", collection: @recent_search_queries.first(10) %>
|
||||
</ul>
|
||||
</aside>
|
||||
<% end%>
|
||||
|
||||
<%= render "searches/form", query_terms: @query_terms %>
|
||||
|
||||
<div class="search__results">
|
||||
<% if @query_terms.present? && @search_results.none? %>
|
||||
<div class="search__empty">
|
||||
No search results
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<ul class="search__list">
|
||||
<%= render partial: "searches/result", collection: @search_results %>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<aside class="search__history">
|
||||
<h3>Your recent searches…</h3>
|
||||
<ul class="search__list">
|
||||
<%= render partial: "searches/search_query", collection: @recent_search_queries.first(10) %>
|
||||
</ul>
|
||||
</aside>
|
||||
</section>
|
||||
<% end %>
|
||||
|
||||
Reference in New Issue
Block a user