Skip to content

Commit

Permalink
cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
bcolloran committed Sep 7, 2023
1 parent f493f15 commit 5481f0b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@
import { contextColumnWidth } from "./leaderboard-utils";
export let formattedValue: string;
export let showContext: LeaderboardContextColumn;
export let contextColumn: LeaderboardContextColumn;
$: neg = formattedValue[0] === "-";
$: noData = formattedValue === "" || !formattedValue;
$: customStyle = neg ? "text-red-500" : noData ? "opacity-50 italic" : "";
$: width = contextColumnWidth(showContext);
$: width = contextColumnWidth(contextColumn);
</script>

{#if showContext === LeaderboardContextColumn.DELTA_PERCENT || showContext === LeaderboardContextColumn.PERCENT}
{#if contextColumn === LeaderboardContextColumn.DELTA_PERCENT || contextColumn === LeaderboardContextColumn.PERCENT}
<div style:width="44px">
<PercentageChange value={formattedValue} />
</div>
{:else if showContext === LeaderboardContextColumn.DELTA_ABSOLUTE}
{:else if contextColumn === LeaderboardContextColumn.DELTA_ABSOLUTE}
<div style:width>
{#if noData}
<span class="opacity-50 italic" style:font-size=".925em">no data</span>
Expand Down
17 changes: 3 additions & 14 deletions web-common/src/features/dashboards/leaderboard/Leaderboard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import Tooltip from "@rilldata/web-common/components/tooltip/Tooltip.svelte";
import TooltipContent from "@rilldata/web-common/components/tooltip/TooltipContent.svelte";
import { cancelDashboardQueries } from "@rilldata/web-common/features/dashboards/dashboard-queries";
import { LeaderboardContextColumn } from "@rilldata/web-common/features/dashboards/leaderboard-context-column";
import {
getFilterForDimension,
useMetaDimension,
Expand Down Expand Up @@ -108,17 +108,6 @@
$: sortType = $dashboardStore.dashboardSortType;
$: contextColumn = $dashboardStore?.leaderboardContextColumn;
// Compose the comparison /toplist query
$: showTimeComparison =
(contextColumn === LeaderboardContextColumn.DELTA_PERCENT ||
contextColumn === LeaderboardContextColumn.DELTA_ABSOLUTE) &&
$timeControlsStore?.showComparison;
$: showPercentOfTotal =
$dashboardStore?.leaderboardContextColumn ===
LeaderboardContextColumn.PERCENT;
$: showContext = $dashboardStore?.leaderboardContextColumn;
$: querySortType = getQuerySortType(sortType);
Expand Down Expand Up @@ -219,7 +208,7 @@
{#each aboveTheFold as itemData (itemData.dimensionValue)}
<LeaderboardListItem
{itemData}
{showContext}
{contextColumn}
{atLeastOneActive}
{filterExcludeMode}
{isSummableMeasure}
Expand All @@ -236,7 +225,7 @@
{#each selectedBelowTheFold as itemData (itemData.dimensionValue)}
<LeaderboardListItem
{itemData}
{showContext}
{contextColumn}
{atLeastOneActive}
{filterExcludeMode}
{isSummableMeasure}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
$: selected = itemData.selected;
$: comparisonValue = itemData.comparisonValue;
export let showContext: LeaderboardContextColumn;
export let contextColumn: LeaderboardContextColumn;
export let atLeastOneActive = false;
Expand All @@ -50,7 +50,7 @@
$: contextColumnFormattedValue = formatContextColumnValue(
itemData,
showContext,
contextColumn,
formatPreset
);
Expand Down Expand Up @@ -169,7 +169,7 @@
</div>
<ContextColumnValue
formattedValue={contextColumnFormattedValue}
{showContext}
{contextColumn}
/>
</div>
</div>
Expand Down

0 comments on commit 5481f0b

Please sign in to comment.