Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"date-fns": "^4.1.0",
"primeicons": "^7.0.0",
"primevue": "^4.3.9",
"text-title-case": "^1.2.9",
"vue": "^3.5.18",
"vue-router": "^4.5.1"
},
Expand Down
1 change: 0 additions & 1 deletion frontend/src/assets/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
width: 100%;
}
.title {
font-size: 1.1em;
font-weight: bold;
margin-bottom: 10px;
}
Expand Down
13 changes: 12 additions & 1 deletion frontend/src/components/user-stats/IndexerStatsEvolutions.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<template>
<div id="indexer-stats-detail">
<div class="wrapper-center title">Evolution on the selected period</div>
<h2 class="wrapper-center title">Evolution on the selected period</h2>
<div class="charts">
<ContentContainer v-for="value in selectedValues" :key="value">
<h3 class="chart-heading">{{ titleCase(value) }}</h3>
<Chart type="line" :data="chartData(value)" :options="chartOptions(value)" />
</ContentContainer>
</div>
Expand All @@ -12,6 +13,7 @@
import type { UserProfileVec, UserProfileScrapedVec } from '@/services/api/userStatsService'
import Chart from 'primevue/chart'
import ContentContainer from '../ContentContainer.vue'
import { titleCase } from 'text-title-case'
import 'chartjs-adapter-date-fns'

const props = defineProps<{
Expand All @@ -32,6 +34,11 @@ const chartOptions = (value: keyof UserProfileScrapedVec) => {
break
}
return {
plugins: {
legend: {
display: false,
},
},
scales: {
x: {
type: 'time',
Expand Down Expand Up @@ -89,4 +96,8 @@ const chartData = (value: keyof UserProfileScrapedVec) => {
height: auto;
}
}

.chart-heading {
text-align: center;
}
</style>
13 changes: 9 additions & 4 deletions frontend/src/components/user-stats/IndexerStatsIncreases.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<template>
<div>
<div class="wrapper-center title">Increase on the selected period</div>
<h2 class="wrapper-center title">Increase on the selected period</h2>
<div class="items">
<ContentContainer v-for="name in selectedValues" :key="name" class="item">
<span class="value">{{ postProcessStat(name) }}</span>
<span class="name">{{ name }}</span>
<span class="name">{{ titleCase(name) }}</span>
</ContentContainer>
</div>
</div>
Expand All @@ -13,6 +13,7 @@
import type { UserProfileScrapedVec, UserProfileVec } from '@/services/api/userStatsService'
import ContentContainer from '../ContentContainer.vue'
import { bytesToReadable } from '@/services/helpers'
import { titleCase } from 'text-title-case'

const props = defineProps<{
userStats: UserProfileVec
Expand All @@ -28,10 +29,14 @@ const postProcessStat = (value: keyof UserProfileScrapedVec) => {
case 'seed_size':
case 'uploaded_real':
case 'downloaded_real':
result = bytesToReadable(result)
return bytesToReadable(result)
break
}
return result

if (Number.isInteger(result)) {
return result
}
return parseFloat(result).toFixed(2)
}
</script>
<style scoped>
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/components/user-stats/SearchForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
@update:modelValue="(val) => emit('selectedValuesUpdated', val)"
filter
display="chip"
:optionLabel="titleCase"
placeholder="Charts to display"
/>
</div>
Expand All @@ -31,6 +32,7 @@ import { getUserStats, type GetUserStatsQuery, type UserProfileScrapedVec, type
import { DatePicker, Select, MultiSelect, Button } from 'primevue'
import { onMounted, ref } from 'vue'
import { startOfMonth, endOfMonth } from 'date-fns'
import { titleCase } from 'text-title-case'
import { getIndexersEnriched, type IndexerEnriched } from '@/services/api/indexerService'
import { showToast } from '@/main'

Expand Down