aboutsummaryrefslogtreecommitdiff
path: root/src/lib/Auction.svelte
blob: 39f4904f5c323cf01b71461fd7fb7a648d4738d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<script lang="ts">
	import type { MatcherFile } from 'skyblock-assets'
	import Item from './minecraft/Item.svelte'
	import Username from './minecraft/Username.svelte'
	import { millisecondsToTime, removeFormattingCode } from './utils'

	export let auction
	export let pack: MatcherFile
</script>

<div class="auction">
	<div class="item-slot-container">
		<Item item={auction.item} {pack} />
	</div>

	<h4 class="auction-item-name">
		{removeFormattingCode(auction.item.display.name)}
	</h4>
	{#if auction.bin}
		<b>Bin</b>
	{/if}
	<div class="auction-info-text">
		<p>Coins: <b>{auction.coins.toLocaleString()}</b></p>
		{#if auction.buyer}
			<p>Buyer: <Username player={auction.buyer} prefix hyperlinkToProfile /></p>
		{:else}
			<p>No buyer</p>
		{/if}
		<p>{millisecondsToTime(Date.now() - auction.creationTimestamp)} ago</p>
	</div>
</div>

<style>
	.auction-info-text {
		color: var(--theme-darker-text);
	}
	.auction-info-text b {
		color: var(--theme-main-text);
	}

	.auction-item-name {
		font-size: 1.5rem;
		margin: 0;
	}

	.auction {
		border: 1px solid rgba(255, 255, 255, 0.1);
		background: rgba(0, 0, 0, 0.1);
		padding: 0.75em;
		border-radius: 1em;
		width: 18em;
	}
	.item-slot-container {
		float: right;
	}

	p {
		margin: 0;
	}
</style>