mirror of
https://github.com/System-End/scraps.git
synced 2026-04-19 20:55:12 +00:00
add estimated time for an item
This commit is contained in:
parent
905a4833c6
commit
73272ffbe3
1 changed files with 9 additions and 1 deletions
|
|
@ -5,7 +5,7 @@
|
|||
import AddressSelectModal from '$lib/components/AddressSelectModal.svelte'
|
||||
import { API_URL } from '$lib/config'
|
||||
import { getUser } from '$lib/auth-client'
|
||||
import { X, Spool, PackageCheck } from '@lucide/svelte'
|
||||
import { X, Spool, PackageCheck, Clock } from '@lucide/svelte'
|
||||
import {
|
||||
shopItemsStore,
|
||||
shopLoading,
|
||||
|
|
@ -14,6 +14,13 @@
|
|||
type ShopItem
|
||||
} from '$lib/stores'
|
||||
|
||||
const PHI = (1 + Math.sqrt(5)) / 2
|
||||
const MULTIPLIER = 10
|
||||
|
||||
function estimateHours(scraps: number): number {
|
||||
return Math.round(scraps / (PHI * MULTIPLIER) * 10) / 10
|
||||
}
|
||||
|
||||
let selectedCategories = $state<Set<string>>(new Set())
|
||||
let sortBy = $state<'default' | 'favorites' | 'probability'>('default')
|
||||
|
||||
|
|
@ -258,6 +265,7 @@
|
|||
<p class="text-sm text-gray-600 mb-2">{item.description}</p>
|
||||
<div class="mb-3">
|
||||
<span class="text-lg font-bold flex items-center gap-1"><Spool size={18} />{item.price}</span>
|
||||
<span class="text-xs text-gray-500 flex items-center gap-1 mt-1"><Clock size={14} />~{estimateHours(item.price)}h</span>
|
||||
<div class="flex gap-1 flex-wrap mt-2">
|
||||
{#each item.category.split(',').map((c) => c.trim()).filter(Boolean) as cat}
|
||||
<span class="text-xs px-2 py-1 bg-gray-100 rounded-full">{cat}</span>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue