Attribution score and date range filter values

Этот коммит содержится в:
Maarten 2024-10-11 20:44:33 +02:00
родитель dca26bd54d
Коммит 6041ebaedb
2 изменённых файлов: 49 добавлений и 41 удалений

Просмотреть файл

@ -1,46 +1,53 @@
<script> <script>
import { utcFormat } from 'd3-time-format'; import { utcFormat } from 'd3-time-format';
export let cases export let cases;
</script> </script>
<div class="table-container"> <div class="table-container">
<table class="table is-striped is-fullwidth"> <table class="table is-striped is-fullwidth">
<thead> <thead>
<tr> <tr>
<td>Title</td> <td>Title</td>
<td>Description</td> <td>Description</td>
<td>Attribution date</td> <td>Attribution date</td>
<td>Source</td> <td>Source</td>
<td>Source category</td> <td>Source category</td>
<td>Actor nation</td> <td>Actor nation</td>
</tr> <td>Campaign</td>
</thead> </tr>
<tbody> </thead>
{#each cases as attrCase} <tbody>
{#if attrCase.show} {#each cases as attrCase}
<tr id={'case-' + attrCase.attribution_id}> {#if attrCase.show}
<td>{attrCase.short_title}</td> <tr id={'case-' + attrCase.attribution_id}>
<td>{attrCase.short_description}</td> <td>{attrCase.short_title}</td>
<td>{utcFormat('%B %d, %Y')(new Date(attrCase.attribution_date))}</td> <td>{attrCase.short_description}</td>
<td>{attrCase.source}</td> <td>{utcFormat('%B %d, %Y')(new Date(attrCase.attribution_date))}</td>
<td>{attrCase.source_category}</td> <td>{attrCase.source}</td>
<td>{#each attrCase.actor_nation as nation, i} <td>{attrCase.source_category}</td>
{attrCase.actor_nation.length != (i + 1) ? nation + ', ' : nation} <td
{/each}</td> >{#each attrCase.actor_nation as nation, i}
</tr> {attrCase.actor_nation.length != i + 1 ? nation + ', ' : nation}
{/if} {/each}</td
{/each} >
</tbody> <td>
</table> {#each attrCase.campaign as camp, i}
{attrCase.campaign.length != i + 1 ? camp + ', ' : camp}
{/each}
</td>
</tr>
{/if}
{/each}
</tbody>
</table>
</div> </div>
<style> <style>
thead { thead {
font-weight: bold; font-weight: bold;
} }
.table-container { .table-container {
max-height: 800px; max-height: 800px;
overflow-y: scroll; overflow-y: scroll;
} }
</style> </style>

Просмотреть файл

@ -4,6 +4,7 @@
import DateRangeSlider from '$lib/components/DateRangeSlider.svelte'; import DateRangeSlider from '$lib/components/DateRangeSlider.svelte';
import SearchText from '$lib/components/SearchText.svelte'; import SearchText from '$lib/components/SearchText.svelte';
import Share from '$lib/components/Share.svelte'; import Share from '$lib/components/Share.svelte';
import { utcFormat } from 'd3-time-format';
//import { attributionScoreScale } from '../../stores/scales'; //import { attributionScoreScale } from '../../stores/scales';
import { import {
platformFilter, platformFilter,
@ -21,7 +22,7 @@
defaultTimeRange defaultTimeRange
} from '../../stores/filters'; } from '../../stores/filters';
//$: console.log($timeRangeFilter) const timeFormat = utcFormat('%m/%d/%y')
export let cases; export let cases;
@ -71,7 +72,7 @@
/> />
<Slider <Slider
value={$attributionScoreFilter} value={$attributionScoreFilter}
label="Attribution Score" label={`Attribution Score: ${$attributionScoreFilter[0]} - ${$attributionScoreFilter[1]}`}
min={attributionScoreDef[0]} min={attributionScoreDef[0]}
max={attributionScoreDef[1]} max={attributionScoreDef[1]}
showHandleLabels={false} showHandleLabels={false}
@ -117,7 +118,7 @@
></Dropdown> ></Dropdown>
<DateRangeSlider <DateRangeSlider
value={timeDummyRange} value={timeDummyRange}
label="Date Range" label={`Date Range: ${timeFormat($timeRangeFilter[0])} - ${timeFormat($timeRangeFilter[1])}`}
min={0} min={0}
max={10} max={10}
showHandleLabels={false} showHandleLabels={false}