diff --git a/assets/js/app.js b/assets/js/app.js
index a311dc6..36d845b 100644
--- a/assets/js/app.js
+++ b/assets/js/app.js
@@ -197,10 +197,12 @@ Hooks.AudioPlayer = {
Hooks.Ping = {
mounted(){
+ let pingEvery
this.handleEvent("pong", () => {
let rtt = Date.now() - this.nowMs
+ pingEvery = pingEvery ? 5000 : 1000
this.el.innerText = `ping: ${rtt}ms`
- this.timer = setTimeout(() => this.ping(rtt), 5000)
+ this.timer = setTimeout(() => this.ping(rtt), pingEvery)
})
this.ping(null)
},
diff --git a/config/dev.exs b/config/dev.exs
index 23e4424..baa2a3b 100644
--- a/config/dev.exs
+++ b/config/dev.exs
@@ -13,10 +13,9 @@ config :live_beats, :github,
# Configure your database
config :live_beats, LiveBeats.Repo,
- username: "root",
- password: nil,
+ username: "postgres",
+ password: "postgres",
hostname: "localhost",
- port: 26257,
database: "live_beats_dev",
migration_lock: false,
stacktrace: true,
diff --git a/lib/live_beats/media_library.ex b/lib/live_beats/media_library.ex
index 216698a..39e6670 100644
--- a/lib/live_beats/media_library.ex
+++ b/lib/live_beats/media_library.ex
@@ -304,6 +304,7 @@ defmodule LiveBeats.MediaLibrary do
def get_profile!(%Accounts.User{} = user) do
%Profile{
user_id: user.id,
+ songs_count: user.songs_count,
username: user.username,
tagline: user.profile_tagline,
avatar_url: user.avatar_url,
diff --git a/lib/live_beats/media_library/profile.ex b/lib/live_beats/media_library/profile.ex
index 815b2d6..dd829ba 100644
--- a/lib/live_beats/media_library/profile.ex
+++ b/lib/live_beats/media_library/profile.ex
@@ -1,3 +1,8 @@
defmodule LiveBeats.MediaLibrary.Profile do
- defstruct user_id: nil, username: nil, tagline: nil, avatar_url: nil, external_homepage_url: nil
+ defstruct user_id: nil,
+ username: nil,
+ tagline: nil,
+ avatar_url: nil,
+ external_homepage_url: nil,
+ songs_count: 0
end
diff --git a/lib/live_beats_web/channels/presence.ex b/lib/live_beats_web/channels/presence.ex
index cc20910..085c645 100644
--- a/lib/live_beats_web/channels/presence.ex
+++ b/lib/live_beats_web/channels/presence.ex
@@ -161,16 +161,13 @@ defmodule LiveBeatsWeb.Presence.BadgeComponent do
<%= @presence.username %>
- <%= if @ping do %>
-
ping: <%= @ping %>ms
- <%= if @region do %>
-
- <% end %>
- <% end %>
+
ping: <%= if @ping, do: "#{@ping}ms", else: "..." %>
+
diff --git a/lib/live_beats_web/components/core_components.ex b/lib/live_beats_web/components/core_components.ex
index af64f39..0c8bcd7 100644
--- a/lib/live_beats_web/components/core_components.ex
+++ b/lib/live_beats_web/components/core_components.ex
@@ -524,7 +524,7 @@ defmodule LiveBeatsWeb.CoreComponents do
attr :patch, :string
attr :primary, :boolean, default: false
- attr :rest, :global
+ attr :rest, :global, include: ["disabled"]
slot :inner_block
diff --git a/lib/live_beats_web/live/player_live.ex b/lib/live_beats_web/live/player_live.ex
index bec4b76..791a256 100644
--- a/lib/live_beats_web/live/player_live.ex
+++ b/lib/live_beats_web/live/player_live.ex
@@ -52,7 +52,7 @@ defmodule LiveBeatsWeb.PlayerLive do
<% end %>
- <%= if is_nil(@profile) or @own_profile? do %>
+ <%= if @own_profile? do %>
- <% else %>
+ <% end %>
+ <%= if !@own_profile? && @profile && @profile.songs_count > 0 do %>