chats 0.5.1 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +118 -0
  3. data/README.md +36 -6
  4. data/app/assets/stylesheets/chats.css +111 -0
  5. data/app/controllers/chats/conversations_controller.rb +101 -11
  6. data/app/javascript/chats/dock_controller.js +15 -1
  7. data/app/javascript/chats/split_controller.js +97 -0
  8. data/app/views/chats/conversations/_conversation_pane.html.erb +42 -0
  9. data/app/views/chats/conversations/_conversation_row.html.erb +20 -4
  10. data/app/views/chats/conversations/_empty_pane.html.erb +23 -0
  11. data/app/views/chats/conversations/_group.html.erb +20 -4
  12. data/app/views/chats/conversations/_thread.html.erb +22 -8
  13. data/app/views/chats/conversations/_thread_header.html.erb +83 -0
  14. data/app/views/chats/conversations/index.html.erb +77 -14
  15. data/app/views/chats/conversations/pane.html.erb +12 -0
  16. data/app/views/chats/conversations/show.html.erb +10 -65
  17. data/app/views/chats/dock/_dock.html.erb +2 -1
  18. data/chats-0.3.2.gem +0 -0
  19. data/chats-0.4.0.gem +0 -0
  20. data/chats-0.4.1.gem +0 -0
  21. data/chats-0.4.2.gem +0 -0
  22. data/chats-0.5.0.gem +0 -0
  23. data/chats-0.5.1.gem +0 -0
  24. data/config/importmap.rb +1 -0
  25. data/config/locales/en.yml +1 -0
  26. data/config/locales/es.yml +1 -0
  27. data/docs/screenshots/split-inbox-empty.png +0 -0
  28. data/docs/screenshots/split-inbox-phone-list.png +0 -0
  29. data/docs/screenshots/split-inbox-phone-thread.png +0 -0
  30. data/docs/screenshots/split-inbox.png +0 -0
  31. data/lib/chats/configuration.rb +23 -0
  32. data/lib/chats/version.rb +1 -1
  33. data/lib/generators/chats/templates/initializer.rb +9 -0
  34. metadata +16 -1
@@ -8,6 +8,7 @@ en:
8
8
  no_results_title: "No results"
9
9
  no_results_hint: "Nothing matched “%{query}”."
10
10
  no_messages: "No messages yet"
11
+ select_hint: "Select a conversation"
11
12
  filtered_by: "Conversations with %{name}"
12
13
  clear_filter: "Show all conversations"
13
14
  group_count:
@@ -8,6 +8,7 @@ es:
8
8
  no_results_title: "Sin resultados"
9
9
  no_results_hint: "No hay nada que coincida con «%{query}»."
10
10
  no_messages: "Sin mensajes todavía"
11
+ select_hint: "Selecciona una conversación"
11
12
  filtered_by: "Conversaciones con %{name}"
12
13
  clear_filter: "Ver todas las conversaciones"
13
14
  group_count:
Binary file
@@ -15,6 +15,7 @@ module Chats
15
15
  class Configuration
16
16
  ATTACHMENT_MODES = [false, :images, :any].freeze
17
17
  DELETION_MODES = [false, :soft, :hard].freeze
18
+ INBOX_LAYOUTS = %i[split stacked].freeze
18
19
 
19
20
  # --- Host integration -----------------------------------------------------
20
21
 
@@ -92,6 +93,15 @@ module Chats
92
93
  # threads.
93
94
  attr_accessor :inbox_limit
94
95
 
96
+ # How the inbox and a conversation share the screen. `:split` (the
97
+ # default): on screens at least 700px wide, /messages is two panes, the
98
+ # conversation list on the left and the open conversation on the right,
99
+ # and /messages/:id is that same page with the conversation open
100
+ # (LinkedIn's messaging page); narrower, the list and the thread are
101
+ # separate pages. `:stacked`: separate pages at every width, as before
102
+ # 0.6.
103
+ attr_reader :inbox_layout
104
+
95
105
  # Per-sender send throttle, enforced with Rails 8's built-in controller
96
106
  # `rate_limit` when available (feature-detected; on Rails 7.1 it's a
97
107
  # no-op). Shape: `{ to: Integer, within: ActiveSupport::Duration }`.
@@ -187,6 +197,7 @@ module Chats
187
197
  @max_attachments_per_message = 4
188
198
  @send_rate_limit = { to: 60, within: 60 } # 60 messages per minute per sender
189
199
  @inbox_limit = 200
200
+ @inbox_layout = :split
190
201
 
191
202
  @encrypt_messages = false
192
203
 
@@ -244,6 +255,18 @@ module Chats
244
255
  @deletion = normalized
245
256
  end
246
257
 
258
+ def inbox_layout=(value)
259
+ normalized = value.respond_to?(:to_sym) ? value.to_sym : value
260
+ unless INBOX_LAYOUTS.include?(normalized)
261
+ raise ConfigurationError, "inbox_layout must be one of #{INBOX_LAYOUTS.inspect}, got #{value.inspect}"
262
+ end
263
+
264
+ @inbox_layout = normalized
265
+ end
266
+
267
+ # Whether the inbox and the open conversation are one two-pane page.
268
+ def split_inbox? = inbox_layout == :split
269
+
247
270
  def send_rate_limit=(value)
248
271
  if value.nil?
249
272
  @send_rate_limit = nil
data/lib/chats/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Chats
4
- VERSION = "0.5.1"
4
+ VERSION = "0.6.0"
5
5
  end
@@ -84,6 +84,15 @@ Chats.configure do |config|
84
84
  #
85
85
  # config.inbox_limit = 200
86
86
  #
87
+ # The messaging page's layout. :split (the default): from 700px wide,
88
+ # /messages is two panes, LinkedIn-style: the conversation list on the
89
+ # left, the open conversation on the right (/messages/:id is that same
90
+ # page, its conversation open); narrower, the list and the thread are
91
+ # separate pages. :stacked keeps them separate pages at every width.
92
+ # (Views you ejected with `rails g chats:views` keep rendering as they are.)
93
+ #
94
+ # config.inbox_layout = :split
95
+ #
87
96
  # Encrypt message bodies at rest (ActiveRecord Encryption; requires
88
97
  # `bin/rails db:encryption:init`). Body search degrades when enabled.
89
98
  #
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chats
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - rameerez
@@ -138,18 +138,23 @@ files:
138
138
  - app/javascript/chats/dock_controller.js
139
139
  - app/javascript/chats/recovery.js
140
140
  - app/javascript/chats/refresh_inbox_controller.js
141
+ - app/javascript/chats/split_controller.js
141
142
  - app/javascript/chats/thread_controller.js
142
143
  - app/javascript/chats/unread_badge_controller.js
144
+ - app/views/chats/conversations/_conversation_pane.html.erb
143
145
  - app/views/chats/conversations/_conversation_row.html.erb
146
+ - app/views/chats/conversations/_empty_pane.html.erb
144
147
  - app/views/chats/conversations/_group.html.erb
145
148
  - app/views/chats/conversations/_history.html.erb
146
149
  - app/views/chats/conversations/_locked_composer.html.erb
147
150
  - app/views/chats/conversations/_messages_page.html.erb
148
151
  - app/views/chats/conversations/_read_state.html.erb
149
152
  - app/views/chats/conversations/_thread.html.erb
153
+ - app/views/chats/conversations/_thread_header.html.erb
150
154
  - app/views/chats/conversations/badge.turbo_stream.erb
151
155
  - app/views/chats/conversations/dock.html.erb
152
156
  - app/views/chats/conversations/index.html.erb
157
+ - app/views/chats/conversations/pane.html.erb
153
158
  - app/views/chats/conversations/refresh.turbo_stream.erb
154
159
  - app/views/chats/conversations/show.html.erb
155
160
  - app/views/chats/conversations/window.html.erb
@@ -169,6 +174,12 @@ files:
169
174
  - app/views/chats/shared/_unread_badge.html.erb
170
175
  - app/views/chats/shared/_verified_badge.html.erb
171
176
  - chats-0.3.1.gem
177
+ - chats-0.3.2.gem
178
+ - chats-0.4.0.gem
179
+ - chats-0.4.1.gem
180
+ - chats-0.4.2.gem
181
+ - chats-0.5.0.gem
182
+ - chats-0.5.1.gem
172
183
  - config/importmap.rb
173
184
  - config/locales/en.yml
174
185
  - config/locales/es.yml
@@ -183,6 +194,10 @@ files:
183
194
  - docs/screenshots/dock-phone-panel.png
184
195
  - docs/screenshots/dock-phone-window.png
185
196
  - docs/screenshots/inbox.png
197
+ - docs/screenshots/split-inbox-empty.png
198
+ - docs/screenshots/split-inbox-phone-list.png
199
+ - docs/screenshots/split-inbox-phone-thread.png
200
+ - docs/screenshots/split-inbox.png
186
201
  - docs/screenshots/system-note-action.png
187
202
  - docs/screenshots/thread-actions-phone.png
188
203
  - gemfiles/rails_7.1.gemfile