chore: improve data display
This commit is contained in:
		
							parent
							
								
									141cfbf7a6
								
							
						
					
					
						commit
						1884262268
					
				@ -15,15 +15,9 @@
 | 
			
		||||
			return i.status_id === status_id;
 | 
			
		||||
		})
 | 
			
		||||
	);
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
{#if sorted.length > 0}
 | 
			
		||||
	<div class="card p-3 rounded-lg">
 | 
			
		||||
		<h1 class="flex gap-2">
 | 
			
		||||
			{title} <input bind:value={filter} placeholder="search" class="flex-grow text-blue-500" />
 | 
			
		||||
		</h1>
 | 
			
		||||
		<div class="flex flex-wrap gap-4">
 | 
			
		||||
			{#each sorted.filter((i) => {
 | 
			
		||||
	let internal = $derived(
 | 
			
		||||
		sorted.filter((i) => {
 | 
			
		||||
			if (!filter) {
 | 
			
		||||
				return true;
 | 
			
		||||
			}
 | 
			
		||||
@ -36,7 +30,18 @@
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			return x.match(f);
 | 
			
		||||
			}) as item}
 | 
			
		||||
		})
 | 
			
		||||
	);
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
{#if sorted.length > 0}
 | 
			
		||||
	<div class="card p-3 rounded-lg">
 | 
			
		||||
		<h1 class="flex gap-2">
 | 
			
		||||
			{title} ({internal.length})
 | 
			
		||||
			<input bind:value={filter} placeholder="search" class="flex-grow text-blue-500" />
 | 
			
		||||
		</h1>
 | 
			
		||||
		<div class="flex flex-wrap gap-4">
 | 
			
		||||
			{#each internal as item}
 | 
			
		||||
				<button
 | 
			
		||||
					class="card p-2 my-2 bg-slate-100 text-left"
 | 
			
		||||
					onclick={async () => {
 | 
			
		||||
 | 
			
		||||
@ -125,14 +125,18 @@
 | 
			
		||||
						data={[...statusStore.nodes, 'Created' as const].reduce(
 | 
			
		||||
							(acc, item) => {
 | 
			
		||||
								if (item === 'Created') {
 | 
			
		||||
									acc[item] = applicationStore.all.filter(
 | 
			
		||||
									const count = applicationStore.all.filter(
 | 
			
		||||
										(a) => a.status_id === null
 | 
			
		||||
									).length;
 | 
			
		||||
									if (count === 0) return acc;
 | 
			
		||||
									acc[item] = count;
 | 
			
		||||
									return acc;
 | 
			
		||||
								}
 | 
			
		||||
								acc[item.name] = applicationStore.all.filter(
 | 
			
		||||
								const count = applicationStore.all.filter(
 | 
			
		||||
									(a) => item.id === a.status_id
 | 
			
		||||
								).length;
 | 
			
		||||
								if (count === 0) return acc;
 | 
			
		||||
								acc[item.name] = count;
 | 
			
		||||
								return acc;
 | 
			
		||||
							},
 | 
			
		||||
							{} as Record<string, number>
 | 
			
		||||
 | 
			
		||||
@ -35,6 +35,7 @@
 | 
			
		||||
 | 
			
		||||
		const other = dataf.filter((v) => v.value / sum < sensitivity);
 | 
			
		||||
 | 
			
		||||
		if (other.length > 1) {
 | 
			
		||||
			dataf = dataf.filter((f) => f.value / sum > sensitivity);
 | 
			
		||||
 | 
			
		||||
			const otherSum = other.reduce((acc, v) => {
 | 
			
		||||
@ -50,6 +51,7 @@
 | 
			
		||||
						.reduce((acc, a) => `${acc}${a.name}: ${a.value}\n`, '')}`
 | 
			
		||||
				});
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		dataf = dataf.toSorted((a, b) => a.value - b.value);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user