[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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user