-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/go 368 filters #249
base: main
Are you sure you want to change the base?
Changes from 38 commits
473af6d
914d2fb
0a03182
a6b44f0
be94fbe
d8e29ff
5b0b7a3
2fcbce2
8d1e4e9
8bfd59d
44d03c7
f6108e5
3281e2e
34e344b
a11f431
9a6425f
d07a6a0
8bcf810
adf8361
ef6105c
87c0bd8
7cc6801
3783ec4
5935dd4
cf6ebfa
6c4313f
6a69302
41f947a
ab4b919
6afd341
01240ec
c845d7b
715141c
15dfcdd
901e018
25c6d2a
d0bf118
699fc2f
6f5ba24
29cc358
0776ad3
84646a6
21ef1b7
8824a1f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<div class="flex justify-center items-center flex-grow-0 flex-shrink-0 relative overflow-hidden gap-2.5 px-3.5 py-2.5 rounded-md bg-white border border-gray-300 hover:bg-gray-100"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tu sme sa dohodli, ze uz pouzivame IconComponent a nevyrabame komponenty per-ikona. |
||
<%= render Icons::ChevronDownComponent.new %> | ||
</div> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module Common | ||
class DownButtonComponent < ViewComponent::Base | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="<%= @stroke_width %>" stroke="currentColor" class="shrink-0 <%= @classes.present? ? @classes : "w-6 h-6" %>"> | ||
<path stroke-linecap="round" stroke-linejoin="round" d="<%= @svg %>" /> | ||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="<%= @stroke_width %>" stroke="currentColor" class="shrink-0 <%= @classes.presence || "w-6 h-6" %>"> | ||
<% if @svg.class == Array %> | ||
<% @svg.each do |svg| %> | ||
<path stroke-linecap="round" stroke-linejoin="round" d="<%= svg %>" /> | ||
<% end %> | ||
<% else %> | ||
<path stroke-linecap="round" stroke-linejoin="round" d="<%= @svg %>" /> | ||
<% end %> | ||
</svg> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<div class="flex justify-center items-center flex-grow-0 flex-shrink-0 relative overflow-hidden gap-2.5 px-3.5 py-2.5 rounded-md bg-white border border-gray-300 hover:bg-gray-100"> | ||
<%= render Icons::ChevronUpComponent.new %> | ||
</div> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module Common | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. detto |
||
class UpButtonComponent < ViewComponent::Base | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<svg class="shrink-0 <%= @css_classes.present? ? @css_classes : "w-6 h-6" %>" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512" stroke-width="<%= @stroke_width %>" stroke="currentColor" style="aspect-ratio: 1.6;"> | ||
<path d="M40 352l48 0c22.1 0 40 17.9 40 40l0 48c0 22.1-17.9 40-40 40l-48 0c-22.1 0-40-17.9-40-40l0-48c0-22.1 17.9-40 40-40zm192 0l48 0c22.1 0 40 17.9 40 40l0 48c0 22.1-17.9 40-40 40l-48 0c-22.1 0-40-17.9-40-40l0-48c0-22.1 17.9-40 40-40zM40 320c-22.1 0-40-17.9-40-40l0-48c0-22.1 17.9-40 40-40l48 0c22.1 0 40 17.9 40 40l0 48c0 22.1-17.9 40-40 40l-48 0zM232 192l48 0c22.1 0 40 17.9 40 40l0 48c0 22.1-17.9 40-40 40l-48 0c-22.1 0-40-17.9-40-40l0-48c0-22.1 17.9-40 40-40zM40 160c-22.1 0-40-17.9-40-40L0 72C0 49.9 17.9 32 40 32l48 0c22.1 0 40 17.9 40 40l0 48c0 22.1-17.9 40-40 40l-48 0zM232 32l48 0c22.1 0 40 17.9 40 40l0 48c0 22.1-17.9 40-40 40l-48 0c-22.1 0-40-17.9-40-40l0-48c0-22.1 17.9-40 40-40z"/> | ||
</svg> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
class Icons::GripComponent < ViewComponent::Base | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ukazalo sa, ze lepsi sposob je cez Common::IconComponent. kukni tam.
luciajanikova marked this conversation as resolved.
Show resolved
Hide resolved
|
||
def initialize(css_classes: nil, stroke_width: 1.5) | ||
@css_classes = css_classes | ||
@stroke_width = stroke_width | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<svg class="shrink-0 <%= @css_classes.present? ? @css_classes : "w-6 h-6" %>" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512" stroke-width="<%= @stroke_width %>" stroke="currentColor"> | ||
<% if solid? %> | ||
<path d="M316.9 18C311.6 7 300.4 0 288.1 0s-23.4 7-28.8 18L195 150.3 51.4 171.5c-12 1.8-22 10.2-25.7 21.7s-.7 24.2 7.9 32.7L137.8 329 113.2 474.7c-2 12 3 24.2 12.9 31.3s23 8 33.8 2.3l128.3-68.5 128.3 68.5c10.8 5.7 23.9 4.9 33.8-2.3s14.9-19.3 12.9-31.3L438.5 329 542.7 225.9c8.6-8.5 11.7-21.2 7.9-32.7s-13.7-19.9-25.7-21.7L381.2 150.3 316.9 18z"/> | ||
<% elsif light? %> | ||
<path d="M287.9 0c9.2 0 17.6 5.2 21.6 13.5l68.6 141.3 153.2 22.6c9 1.3 16.5 7.6 19.3 16.3s.5 18.1-5.9 24.5L433.6 328.4l26.2 155.6c1.5 9-2.2 18.1-9.7 23.5s-17.3 6-25.3 1.7l-137-73.2L151 509.1c-8.1 4.3-17.9 3.7-25.3-1.7s-11.2-14.5-9.7-23.5l26.2-155.6L31.1 218.2c-6.5-6.4-8.7-15.9-5.9-24.5s10.3-14.9 19.3-16.3l153.2-22.6L266.3 13.5C270.4 5.2 278.7 0 287.9 0zm0 79L235.4 187.2c-3.5 7.1-10.2 12.1-18.1 13.3L99 217.9 184.9 303c5.5 5.5 8.1 13.3 6.8 21L171.4 443.7l105.2-56.2c7.1-3.8 15.6-3.8 22.6 0l105.2 56.2L384.2 324.1c-1.3-7.7 1.2-15.5 6.8-21l85.9-85.1L358.6 200.5c-7.8-1.2-14.6-6.1-18.1-13.3L287.9 79z"/> | ||
<% end %> | ||
</svg> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
class Icons::StarComponent < ViewComponent::Base | ||
luciajanikova marked this conversation as resolved.
Show resolved
Hide resolved
|
||
def initialize(css_classes: nil, stroke_width: 1.5, variant: :solid) | ||
@css_classes = css_classes | ||
@stroke_width = stroke_width | ||
@variant = variant | ||
end | ||
|
||
def solid? | ||
@variant == :solid | ||
end | ||
|
||
def light? | ||
@variant == :light | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,30 @@ | ||
<% if @filters.present? %> | ||
<div class="flex flex-col justify-start items-start gap-2" data-test="filters"> | ||
<div class="flex justify-start items-start px-4 py-2"> | ||
<p class="text-sm text-center text-gray-400">Filtre</p> | ||
</div> | ||
<div | ||
<% if @sortable %> | ||
data-controller="sortable" | ||
data-sortable-url-value="<%= sort_filters_path %>" | ||
data-sortable-draggable-class=".item" | ||
data-sortable-handle-class=".handle" | ||
<% end %> | ||
class="w-full flex flex-col justify-start items-start gap-2" | ||
data-test="filters" | ||
> | ||
<% if @sortable %> | ||
<%= link_to 'Sort', '', class: 'hidden', data: { turbo_method: :patch, sortable_target: 'submit', url: sort_filters_path } %> | ||
<% end %> | ||
<% if @label.present? %> | ||
<div class="flex justify-start items-start px-4 py-2"> | ||
<p class="text-sm text-center text-gray-400"><%= @label %></p> | ||
</div> | ||
<% end %> | ||
<% @filters.each do |filter| %> | ||
<% url = message_threads_path(q: filter.query) %> | ||
<%= link_to url, class: "text-gray-700 hover:text-indigo-600 hover:bg-gray-50 group w-72 flex gap-x-3 rounded-md p-2 px-4 text-sm leading-6 font-semibold data-[active=true]:bg-gray-50 data-[active=true]:text-indigo-600", data: { active: current_page?(url) } do %> | ||
<%= render Icons::BookmarkComponent.new %> | ||
<p class="truncate text-base font-medium"><%= filter.name %></p> | ||
<% end %> | ||
<%= render TW::SidebarMenuItemComponent.new( | ||
name: filter.name, | ||
url: filtered_message_threads_path(filter:), | ||
icon: icon_for(filter), | ||
variant: :light, | ||
classes: "item #{!@sortable ? 'pl-4' : ''}", | ||
) %> | ||
<% end %> | ||
</div> | ||
<% end %> | ||
<% end %> |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,5 +1,20 @@ | ||||||
class Layout::FilterListComponent < ViewComponent::Base | ||||||
def initialize(filters:) | ||||||
include MessageThreadHelper | ||||||
|
||||||
def initialize(label: nil, filters:, sortable: false) | ||||||
@label = label | ||||||
@filters = filters | ||||||
@sortable = sortable | ||||||
end | ||||||
|
||||||
def icon_for(filter) | ||||||
return Common::IconComponent.new(filter.icon) if filter.icon.present? | ||||||
|
||||||
if filter.tag_id.present? | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
return Common::IconComponent.new(filter.tag.icon) if filter.tag.icon.present? | ||||||
return Icons::TagComponent.new | ||||||
end | ||||||
|
||||||
Icons::BookmarkComponent.new | ||||||
end | ||||||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,18 @@ | ||
class MessageThreadsBulkActionsComponent < ViewComponent::Base | ||
def initialize(ids:, signable:, filter: nil, filter_subscription: nil) | ||
def initialize(ids: nil, signable:, filter: nil, query: nil, filter_subscription: nil) | ||
@ids = ids | ||
@signable = signable | ||
@filter = filter | ||
@query = query | ||
@filter_subscription = filter_subscription | ||
end | ||
|
||
def title | ||
return t(:selected_message, count: @ids.count) if @ids.present? | ||
return @filter.name if @filter.present? && @filter.is_a?(EverythingFilter) | ||
return "Správy z filtra '#{@filter.name}'" if @filter.present? | ||
return "Hľadaný výraz '#{@query}'" if @query.present? | ||
|
||
"Správy v schránke" | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<div class="flex flex-col justify-stretch items-stretch gap-4 sm:p-4"> | ||
<div class="flex flex-col justify-stretch items-stretch sm:rounded-md bg-white sm:border sm:border-gray-200" data-controller="form all-checkboxes"> | ||
<%= render MessageThreadsBulkActionsComponent.new(ids: [], filter: @filter, filter_subscription: @filter_subscription, signable: Current.user.signer?) %> | ||
<%= render MessageThreadsBulkActionsComponent.new(ids: [], filter:, query:, filter_subscription:, signable: Current.user.signer?) %> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ak su toto nepovinne parametre tak ich tam neposielajme, ale zvlastne ze to nepotrebujeme. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. niesu nepovinne, ale ide zase o Shorthand Hash Syntax |
||
<%= form_with url: bulk_actions_message_threads_path, data: { "form-target": "form", "all-checkboxes-target": "form" } do %> | ||
<ul role="list" id="message_threads" class="divide-y divide-gray-100"> | ||
<% message_threads.each do |message_thread| %> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<div class="w-full p-4 flex-col justify-start items-start gap-4 inline-flex"> | ||
<div class="self-stretch bg-white rounded-md border border-gray-200 flex-col justify-start items-start flex"> | ||
<div class="flex-col self-stretch p-6 border-b border-gray-200 justify-start items-start gap-4 inline-flex"> | ||
<div class="grow shrink basis-0 text-gray-900 text-xl font-semibold leading-[35px]">Filtre</div> | ||
Nastavte si osobnú preferenciu viditeľnosti filtrov v ľavom menu | ||
</div> | ||
<div class="self-stretch flex-col justify-start items-start flex"> | ||
<%= render Settings::UserFilterVisibilities::ListRowComponent.with_collection(@visibilities) %> | ||
</div> | ||
</div> | ||
</div> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class Settings::UserFilterVisibilities::ListComponent < ViewComponent::Base | ||
def initialize(visibilities) | ||
@visibilities = visibilities | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pin na verziu nerobime pokym naozaj nie je treba
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok