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 IconDownload from 'virtual:icons/heroicons-outline/download';
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 { tagIcons } from '$generated/tags.json';

View File

@ -128,53 +128,57 @@
align-items: center;
grid-gap: 8px;
&__title {
text-transform: uppercase;
letter-spacing: 1px;
font-size: 11px;
line-height: 100%;
}
&__container {
max-height: calc(100vh - 400px);
overflow-y: auto;
mask-image: linear-gradient(to bottom, transparent, hsla(0, 0%, 0%, 1) 5% 95%, transparent);
scrollbar-width: none;
padding: 8px 0;
display: flex;
flex-direction: column;
gap: 4px;
&::-webkit-scrollbar {
display: none;
}
}
&__create {
margin-top: 16px;
display: flex;
align-items: center;
grid-gap: 8px;
:global(button) {
width: 32px;
}
}
&__title {
text-transform: uppercase;
letter-spacing: 1px;
font-size: 11px;
line-height: 100%;
}
> :global(*) {
margin-bottom: 24px;
&__container {
max-height: calc(100vh - 400px);
overflow-y: auto;
mask-image: linear-gradient(
to bottom,
transparent,
hsla(0, 0%, 0%, 1) 5% 95%,
transparent
);
scrollbar-width: none;
padding: 8px 0;
display: flex;
flex-direction: column;
gap: 4px;
&::-webkit-scrollbar {
display: none;
}
}
> *:last-child {
margin-top: auto;
margin-bottom: 0;
}
&__create {
margin-top: 16px;
display: flex;
align-items: center;
grid-gap: 8px;
:global(button) {
width: 34px;
:global(button) {
width: 32px;
}
}
}
> :global(*) {
margin-bottom: 24px;
}
> *:last-child {
margin-top: auto;
margin-bottom: 0;
}
:global(button) {
width: 34px;
}
}
> :global(*) {

View File

@ -75,7 +75,6 @@
color: var(--color-text-lightest);
}
}
}
.statuses {
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'),
Generator({
gameVersions: true,
openapi: true
openapi: true,
tags: true
})
],
optimizeDeps: {