livechat 0.3.0 → 0.3.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 03a4a70e650dd115654bf8ab48e4afc02b5f628009732d3efbff4a7a36e278cc
4
- data.tar.gz: e74596da328480eacab3097e9c08cc78464369ab2e9db6f9c015904498d53809
3
+ metadata.gz: 88beaba89d92d510674dde9c207d9ce3cbe0252859c3deaff9663ee9e9d9cbb6
4
+ data.tar.gz: d84b3d047e0506b0c37331256364257b4cadbd6c8f44bd6ba89c837e062c7786
5
5
  SHA512:
6
- metadata.gz: 83f87fff5df20fc4b6ba70190fd66fc01dd4a32920f5acd36069d94c6f15eb8ab07711a865020b639ce2bd0c7d6555d606415844f2f7b639575d61dfd211fd16
7
- data.tar.gz: ed3589f43b665ae857d6f9a918643feae0c239515f6413a41579a66e6caf4e4a1ca4bc356db9dfeeb274e6162c841649893dc87e535f91cb6733c4ca4f80dbc4
6
+ metadata.gz: 8d06ded8fdcd4e2e649ddece6b6ffeba9261b248482f0fbc4ad50b64bb93bbda2fb93cef4849117e4b0efe1fc6f4f85fd86305f42161c88693dfe6ddf6f41896
7
+ data.tar.gz: f180c508a50a94ef83086b6433b68945237660d713bb1273e71a75cab4a4b89f9a0fc643ab94b5490f7ed5277e969fd3d940806230d505a38d3214cbc5ac96ae
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.1
4
+
5
+ - The Agents column shows initials avatars (deterministic colors, full name
6
+ on hover) instead of a comma-joined list.
7
+
3
8
  ## 0.3.0
4
9
 
5
10
  - Inbox search: visitor name, email, and full message text, scoped to the
data/README.md CHANGED
@@ -4,8 +4,8 @@
4
4
  [![CI](https://github.com/yshmarov/livechat/actions/workflows/ci.yml/badge.svg)](https://github.com/yshmarov/livechat/actions/workflows/ci.yml)
5
5
  [![License: MIT](https://img.shields.io/badge/license-MIT-blue)](MIT-LICENSE)
6
6
 
7
- Open-source live chat for Rails. Self-hosted alternative to Crisp, Intercom
8
- and Chatwoot — as a gem, not another service to deploy.
7
+ Open-source live chat for Rails. Alternative to Crisp, Intercom and
8
+ Chatwoot — inside your Rails app, as a gem, not another service to deploy.
9
9
 
10
10
  Your users already have questions. `livechat` gives them a chat bubble and
11
11
  gives you an inbox, inside the app you already run. Visitors write — signed
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Livechat
4
+ module InboxHelper
5
+ # Agents have no avatar images (no FK to host users) — initials in a
6
+ # deterministically colored circle do the job: same label, same color,
7
+ # every page load. Full label rides the title tooltip.
8
+ AVATAR_COLORS = 6
9
+
10
+ def livechat_agent_avatar(label)
11
+ initials = label.to_s.split.first(2).map { |word| word[0] }.join.upcase
12
+ initials = label.to_s.first(2).upcase if initials.blank?
13
+ color = label.to_s.each_byte.sum % AVATAR_COLORS
14
+
15
+ tag.span(initials, class: "avatar color-#{color}", title: label)
16
+ end
17
+ end
18
+ end
@@ -65,6 +65,14 @@
65
65
  background: var(--surface); color: var(--text); font: inherit; }
66
66
  button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
67
67
  .case-id { color: var(--muted); font-weight: 400; font-size: 15px; }
68
+ .avatars { display: inline-flex; }
69
+ .avatars .avatar { width: 26px; height: 26px; border-radius: 50%; display: inline-flex;
70
+ align-items: center; justify-content: center; font-size: 10px; font-weight: 700;
71
+ color: #fff; border: 2px solid var(--surface); cursor: default; }
72
+ .avatars .avatar + .avatar { margin-left: -8px; }
73
+ .avatar.color-0 { background: #2563eb; } .avatar.color-1 { background: #16a34a; }
74
+ .avatar.color-2 { background: #d97706; } .avatar.color-3 { background: #dc2626; }
75
+ .avatar.color-4 { background: #7c3aed; } .avatar.color-5 { background: #0891b2; }
68
76
  .context-line { margin: -6px 0 16px; overflow-wrap: anywhere; }
69
77
  .thread { display: flex; flex-direction: column; gap: 4px; padding: 16px; }
70
78
  .thread .who { font-size: 12px; color: var(--muted); margin: 10px 4px 2px; }
@@ -53,7 +53,13 @@
53
53
  <% end %>
54
54
  </td>
55
55
  <td class="muted"><%= conversation.last_message_preview %></td>
56
- <td class="muted"><%= @agents.fetch(conversation.id, []).join(', ') %></td>
56
+ <td>
57
+ <span class="avatars">
58
+ <% @agents.fetch(conversation.id, []).each do |label| %>
59
+ <%= livechat_agent_avatar(label) %>
60
+ <% end %>
61
+ </span>
62
+ </td>
57
63
  <td class="muted">
58
64
  <% if conversation.last_activity_at %>
59
65
  <%= time_ago_in_words(conversation.last_activity_at) %>
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Livechat
4
- VERSION = '0.3.0'
4
+ VERSION = '0.3.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: livechat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yaroslav Shmarov
@@ -47,6 +47,7 @@ files:
47
47
  - app/controllers/livechat/messages_controller.rb
48
48
  - app/controllers/livechat/visitor_controller.rb
49
49
  - app/controllers/livechat/widgets_controller.rb
50
+ - app/helpers/livechat/inbox_helper.rb
50
51
  - app/helpers/livechat/widget_helper.rb
51
52
  - app/mailers/livechat/mailer.rb
52
53
  - app/models/livechat/application_record.rb