Loggest thy stuff
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

40 lines
1.1 KiB

<script lang="ts">
import type { StandaloneItem } from "$lib/models/item";
import Entry from "../layout/Entry.svelte";
import EntryAmounts from "../layout/EntryAmounts.svelte";
import EntryDescription from "../layout/EntryDescription.svelte";
import EntryName from "../layout/EntryName.svelte";
export let item: StandaloneItem
export let compact: boolean = false;
let link = "";
let amounts = [];
let subtitle = "";
$: if (item.project != null) {
link = `/${item.scope.id}/project/${item.project.id}?focusitem=${item.id}`
} else {
link = `/${item.scope.id}/item/${item.id}`
}
$: amounts = item.stats.map(s => ({amount: s.acquired || s.required, label: s.name}))
$: subtitle = item.project != null ? item.project.name : item.scope.abbreviation
</script>
<a href={link}>
<Entry>
<EntryName subtitle={subtitle}>{item.name}</EntryName>
{#if !compact}
<EntryDescription>{item.description}</EntryDescription>
{/if}
<EntryAmounts values={amounts} />
</Entry>
</a>
<style>
a {
text-decoration: none;
color: inherit;
}
</style>