[Enhancement] Improve handling of large media collections (#272)

* Added compound index for updated media item table for performance

* Improved large number display on homepage

* Improved UI around large numbers

* Centered the content of homepage data cards

* Renamed migration
This commit is contained in:
Kieran
2024-05-29 12:38:03 -07:00
committed by GitHub
parent 22439e0273
commit e751c65424
12 changed files with 146 additions and 42 deletions
@@ -5,9 +5,19 @@ defmodule PinchflatWeb.Pages.PageHTML do
embed_templates "page_html/*"
def readable_media_filesize(media_filesize) do
{num, suffix} = NumberUtils.human_byte_size(media_filesize, precision: 1)
attr :media_filesize, :integer, required: true
"#{Float.round(num)} #{suffix}"
def readable_media_filesize(assigns) do
{num, suffix} = NumberUtils.human_byte_size(assigns.media_filesize, precision: 2)
assigns =
Map.merge(assigns, %{
num: num,
suffix: suffix
})
~H"""
<.localized_number number={@num} /> <%= @suffix %>
"""
end
end