Skip to content

Commit

Permalink
remove legacy info from dash and comm leader
Browse files Browse the repository at this point in the history
  • Loading branch information
secondl1ght committed Jan 22, 2024
1 parent 9e28da4 commit 93023e2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 114 deletions.
4 changes: 1 addition & 3 deletions src/components/CommunityLeaderboardItem.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
export let id: string;
export let upToDate: number;
export let total: number;
export let legacy: number;
export let grade: Grade;
import { SponsorBadge } from '$lib/comp';
Expand All @@ -15,13 +14,12 @@
$: stats = [
{ stat: upToDate, title: 'Up-To-Date' },
{ stat: total, title: 'Total Locations' },
{ stat: legacy, title: 'Legacy' },
{ stat: grade, title: 'Grade' }
];
</script>

<div
class="grid-cols-6 border-b border-statBorder py-5 text-center text-lg font-semibold text-link lg:grid"
class="grid-cols-5 border-b border-statBorder py-5 text-center text-lg font-semibold text-link lg:grid"
>
<span
class="my-auto {position > 3
Expand Down
30 changes: 4 additions & 26 deletions src/routes/communities/leaderboard/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@
let upToDateTooltip: HTMLButtonElement;
let upToDateTooltipMobile: HTMLButtonElement;
let legacyTooltip: HTMLButtonElement;
let legacyTooltipMobile: HTMLButtonElement;
let gradeTooltip: HTMLButtonElement;
let gradeTooltipMobile: HTMLButtonElement;
Expand All @@ -67,9 +65,7 @@
leaderboard.sort((a, b) =>
b.report.tags.up_to_date_percent === a.report.tags.up_to_date_percent
? b.report.tags.total_elements === a.report.tags.total_elements
? a.report.tags.legacy_elements - b.report.tags.legacy_elements
: b.report.tags.total_elements - a.report.tags.total_elements
? b.report.tags.total_elements - a.report.tags.total_elements
: b.report.tags.up_to_date_percent - a.report.tags.up_to_date_percent
);
Expand All @@ -84,20 +80,14 @@
$: leaderboardPaginated =
leaderboard && leaderboard.length && !loading ? leaderboard.slice(0, leaderboardCount) : [];
const headings = ['Position', 'Name', 'Up-To-Date', 'Total Locations', 'Legacy', 'Grade'];
const headings = ['Position', 'Name', 'Up-To-Date', 'Total Locations', 'Grade'];
const setTooltips = () => {
tippy([upToDateTooltip, upToDateTooltipMobile], {
content: `Locations that have been verified within one year.`,
allowHTML: true
});
tippy([legacyTooltip, legacyTooltipMobile], {
content: `Locations with a <em>payment:bitcoin</em> tag instead of the
<em>currency:XBT</em> tag.`,
allowHTML: true
});
tippy([gradeTooltip, gradeTooltipMobile], {
content: `<table>
<thead>
Expand Down Expand Up @@ -135,8 +125,6 @@
$: upToDateTooltip &&
upToDateTooltipMobile &&
legacyTooltip &&
legacyTooltipMobile &&
gradeTooltip &&
gradeTooltipMobile &&
setTooltips();
Expand Down Expand Up @@ -187,18 +175,14 @@
</div>

<section id="leaderboard" class="dark:lg:rounded dark:lg:bg-white/10 dark:lg:py-8">
<div class="mb-5 hidden grid-cols-6 text-center lg:grid">
<div class="mb-5 hidden grid-cols-5 text-center lg:grid">
{#each headings as heading}
<h3 class="text-lg font-semibold text-primary dark:text-white">
{heading}
{#if heading === 'Up-To-Date'}
<button bind:this={upToDateTooltip}>
<i class="fa-solid fa-circle-info text-sm" />
</button>
{:else if heading === 'Legacy'}
<button bind:this={legacyTooltip}>
<i class="fa-solid fa-circle-info text-sm" />
</button>
{:else if heading === 'Grade'}
<button bind:this={gradeTooltip}>
<i class="fa-solid fa-circle-info text-sm" />
Expand All @@ -215,11 +199,6 @@
<i class="fa-solid fa-circle-info" />
</button>
</h3>
<h3>
Legacy <button bind:this={legacyTooltipMobile}>
<i class="fa-solid fa-circle-info" />
</button>
</h3>
<h3>
Grade <button bind:this={gradeTooltipMobile}>
<i class="fa-solid fa-circle-info" />
Expand All @@ -238,7 +217,6 @@
id={item.id}
upToDate={item.report.tags.up_to_date_percent}
total={item.report.tags.total_elements}
legacy={item.report.tags.legacy_elements}
grade={item.report.tags.grade}
/>
{/each}
Expand All @@ -258,7 +236,7 @@
</div>

<p class="text-center text-sm text-body dark:text-white">
*Data sorted by Up-To-Date, then Total Locations, then Legacy.
*Data sorted by Up-To-Date and then Total Locations.
<br />
*Leaderboard updated once every 24 hours.
</p>
Expand Down
86 changes: 1 addition & 85 deletions src/routes/dashboard/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,6 @@
let upToDateChart: Chart<'line', number[] | undefined, string>;
let totalChartCanvas: HTMLCanvasElement;
let totalChart: Chart<'line', number[] | undefined, string>;
let legacyChartCanvas: HTMLCanvasElement;
let legacyChart: Chart<'line', number[] | undefined, string>;
let paymentMethodChartCanvas: HTMLCanvasElement;
let paymentMethodChart: Chart<'line', number[] | undefined, string>;
Expand Down Expand Up @@ -333,64 +331,6 @@
}
});
legacyChart = new Chart(legacyChartCanvas, {
type: 'line',
data: {
labels: statsFiltered.map(({ date }) => date),
datasets: [
{
label: 'Legacy Locations',
data: statsFiltered.map(({ tags: { legacy_elements } }) => legacy_elements),
fill: {
target: 'origin',
above: 'rgba(235, 87, 87, 0.2)'
},
borderColor: 'rgb(235, 87, 87)',
tension: 0.1,
pointStyle: false
}
]
},
options: {
maintainAspectRatio: false,
plugins: {
legend: {
labels: {
font: {
weight: 600
}
}
}
},
scales: {
x: {
ticks: {
maxTicksLimit: 5,
font: {
weight: 600
}
},
grid: {
color: theme === 'dark' ? 'rgba(255, 255, 255, 0.15)' : 'rgba(0, 0, 0, 0.1)'
}
},
y: {
ticks: {
font: {
weight: 600
}
},
grid: {
color: theme === 'dark' ? 'rgba(255, 255, 255, 0.15)' : 'rgba(0, 0, 0, 0.1)'
}
}
},
interaction: {
intersect: false
}
}
});
paymentMethodChart = new Chart(paymentMethodChartCanvas, {
type: 'line',
data: {
Expand Down Expand Up @@ -554,12 +494,6 @@
});
totalChart.update();
legacyChart.data.labels = statsFiltered.map(({ date }) => date);
legacyChart.data.datasets[0].data = statsFiltered.map(
({ tags: { legacy_elements } }) => legacy_elements
);
legacyChart.update();
paymentMethodChart.data.labels = statsFiltered.map(({ date }) => date);
paymentMethodChart.data.datasets[0].data = statsFiltered.map(
({ tags: { total_elements_onchain } }) => total_elements_onchain
Expand All @@ -585,13 +519,12 @@
$: $theme !== undefined &&
chartsLoading === false &&
chartsRendered === true &&
updateChartThemes([upToDateChart, totalChart, legacyChart, paymentMethodChart]);
updateChartThemes([upToDateChart, totalChart, paymentMethodChart]);
onMount(async () => {
if (browser) {
upToDateChartCanvas.getContext('2d');
totalChartCanvas.getContext('2d');
legacyChartCanvas.getContext('2d');
paymentMethodChartCanvas.getContext('2d');
if ($reports && $reports.length) {
Expand Down Expand Up @@ -747,23 +680,6 @@
</p>
</div>

<div>
<div class="relative">
{#if chartsLoading}
<div
class="absolute left-0 top-0 flex h-[400px] w-full animate-pulse items-center justify-center rounded-3xl border border-link/50"
>
<i class="fa-solid fa-chart-area h-24 w-24 animate-pulse text-link/50" />
</div>
{/if}
<canvas bind:this={legacyChartCanvas} width="100%" height="400" />
</div>
<p class="mt-1 text-center text-sm text-body dark:text-white">
*Elements with a <em>payment:bitcoin</em> tag instead of the
<em>currency:XBT</em> tag.
</p>
</div>

<div>
<div class="relative">
{#if chartsLoading}
Expand Down

0 comments on commit 93023e2

Please sign in to comment.