Fix errors

This commit is contained in:
venashial
2022-08-03 00:52:34 -07:00
parent 3139c0b3d8
commit cf670b3b4c
5 changed files with 88 additions and 43 deletions

View File

@@ -3,7 +3,8 @@
import IconHeart from 'virtual:icons/lucide/heart'; import IconHeart from 'virtual:icons/lucide/heart';
import IconDownload from 'virtual:icons/heroicons-outline/download'; import IconDownload from 'virtual:icons/heroicons-outline/download';
import IconCalendar from 'virtual:icons/lucide/calendar'; import IconCalendar from 'virtual:icons/lucide/calendar';
import { ago, simplify } from 'omorphia/utils'; import { ago } from 'omorphia/utils';
import { simplify } from '$lib/number';
import { Avatar, Button } from 'omorphia'; import { Avatar, Button } from 'omorphia';
import { tagIcons } from '$generated/tags.json'; import { tagIcons } from '$generated/tags.json';

View File

@@ -138,7 +138,12 @@
&__container { &__container {
max-height: calc(100vh - 400px); max-height: calc(100vh - 400px);
overflow-y: auto; overflow-y: auto;
mask-image: linear-gradient(to bottom, transparent, hsla(0, 0%, 0%, 1) 5% 95%, transparent); mask-image: linear-gradient(
to bottom,
transparent,
hsla(0, 0%, 0%, 1) 5% 95%,
transparent
);
scrollbar-width: none; scrollbar-width: none;
padding: 8px 0; padding: 8px 0;
display: flex; display: flex;
@@ -175,7 +180,6 @@
width: 34px; width: 34px;
} }
} }
}
> :global(*) { > :global(*) {
margin-bottom: 24px; margin-bottom: 24px;

View File

@@ -75,7 +75,6 @@
color: var(--color-text-lightest); color: var(--color-text-lightest);
} }
} }
}
.statuses { .statuses {
margin-left: auto; margin-left: auto;

View File

@@ -0,0 +1,40 @@
/**
* Convert large numbers to human readable strings
* @source https://github.com/rohmanhm/simplify-number
*/
export function simplify(num = 0): string {
let numberVar = num;
// 2 decimal places => 100, 3 => 1000, etc
const decPlaces = Math.pow(10, 1);
// Enumerate number abbreviations
const abbrev = ['K', 'M', 'B', 'T'];
// Go through the array backwards, so we do the largest first
for (let i = abbrev.length - 1; i >= 0; i--) {
// Convert array index to "1000", "1000000", etc
const size = Math.pow(10, (i + 1) * 3);
// If the number is bigger or equal do the abbreviation
if (size <= numberVar) {
// Here, we multiply by decPlaces, round, and then divide by decPlaces.
// This gives us nice rounding to a particular decimal place.
numberVar = Math.round((numberVar * decPlaces) / size) / decPlaces;
// Handle special case where we round up to the next abbreviation
if (numberVar === 1000 && i < abbrev.length - 1) {
numberVar = 1;
i++;
}
// Add the letter for the abbreviation
(numberVar as any) += abbrev[i];
// We are done... stop
break;
}
}
return String(numberVar);
}

View File

@@ -12,7 +12,8 @@ const config = {
precompileIntl('locales'), precompileIntl('locales'),
Generator({ Generator({
gameVersions: true, gameVersions: true,
openapi: true openapi: true,
tags: true
}) })
], ],
optimizeDeps: { optimizeDeps: {