Skip to content

Commit b783c22

Browse files
committed
Fix stats mobile view
1 parent 383e7de commit b783c22

4 files changed

Lines changed: 51 additions & 67 deletions

File tree

components/modules/stats/HighlightCard.vue

Lines changed: 11 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,6 @@
11
<script setup>
2-
/** Vendor */
3-
// import { DateTime } from "luxon"
4-
5-
/** UI */
6-
// import Button from "@/components/ui/Button.vue"
7-
// import Tooltip from "@/components/ui/Tooltip.vue"
8-
92
/** Services */
10-
import { abbreviate, capitilize, comma, formatBytes, shortHex, tia } from "@/services/utils"
11-
12-
/** API */
13-
import { fetchNetworks, fetchCommitments, fetchCommitmentsByNetwork } from "@/services/api/blobstream";
3+
import { abbreviate, comma, formatBytes, tia } from "@/services/utils"
144
155
/** Stats Components */
166
import DiffChip from "@/components/modules/stats/DiffChip.vue"
@@ -72,28 +62,20 @@ const value = computed(() => {
7262
7363
.card {
7464
min-height: 80px;
75-
width: 240px;
65+
min-width: 240px;
7666
7767
background: var(--card-background);
7868
border-radius: 12px;
7969
8070
padding: 16px 16px 16px 0px;
8171
8272
box-shadow: inset 0 0 0 1px var(--op-3);
83-
84-
/* &:hover {
85-
opacity: 0.8;
86-
}
87-
88-
&:active {
89-
scale: 0.95;
90-
} */
9173
}
74+
9275
.left_border {
9376
height: 40px;
9477
width: 4px;
9578
border-radius: 8px;
96-
/* background: var(--txt-tertiary); */
9779
background: var(--op-10);
9880
}
9981
@@ -128,17 +110,15 @@ const value = computed(() => {
128110
padding: 16px 0;
129111
}
130112
131-
/* @media (max-width: 500px) {
132-
.wrapper {
133-
padding: 32px 12px;
113+
@media (max-width: 530px) {
114+
.card_wrapper {
115+
margin: 8px 0px 8px 0px;
116+
min-width: 100%;
134117
}
135118
136-
.header {
137-
gap: 16px;
138-
139-
height: initial;
140-
141-
padding: 16px;
119+
.card {
120+
height: 100px;
121+
min-width: 100%;
142122
}
143-
} */
123+
}
144124
</style>

components/modules/stats/SquareSizeCard.vue

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ import { abbreviate, comma, formatBytes } from "@/services/utils"
1313
import { fetchSquareSize } from "@/services/api/stats"
1414
1515
const props = defineProps({
16-
// series: {
17-
// type: Object,
18-
// required: true,
19-
// },
2016
period: {
2117
type: Object,
2218
required: true,
@@ -52,7 +48,7 @@ const getSquareSizes = async () => {
5248
item.color = color(index)
5349
5450
if (index !== squareSize.value.length - 1) {
55-
let share = Math.max(Math.round((item.value / total.value * 100)), 1)
51+
let share = Math.min(Math.round((item.value / total.value * 100)), 1)
5652
totalShare += share
5753
item.share = share
5854
} else {
@@ -97,14 +93,6 @@ onMounted(async () => {
9793
9894
await getSquareSizes()
9995
})
100-
101-
// watch(
102-
// () => props.period,
103-
// async () => {
104-
// await drawChart()
105-
// },
106-
// )
107-
10896
</script>
10997
11098
<template>
@@ -173,7 +161,7 @@ onMounted(async () => {
173161
<Text size="12" weight="600" color="primary"> {{ `${s.size} x ${s.size}` }} </Text>
174162
</Flex>
175163
176-
<Text size="12" weight="600" color="tertiary" style="text-align: right; flex: 1"> {{ `${s.share}%` }} </Text>
164+
<Text size="12" weight="600" color="tertiary" style="text-align: right; flex: 1"> {{ `${s.share === 0 ? '<1' : s.share}%` }} </Text>
177165
<Text size="12" weight="600" color="primary" style="text-align: right; flex: 1"> {{ comma(s.value) }} </Text>
178166
</Flex>
179167
</Flex>

components/modules/stats/tabs/BlocksTab.vue

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,6 @@ const selectedPeriod = ref(periods.value[0])
3636
/>
3737
</Flex>
3838
</Flex>
39-
40-
<!-- <Flex align="center" direction="column" gap="12" wide>
41-
<Flex align="center" justify="between" wide :class="$style.section">
42-
<Text size="16" weight="600" color="primary" justify="start">Square Size Distribution</Text>
43-
</Flex>
44-
45-
<SquareSizeChart />
46-
</Flex> -->
47-
48-
<!-- block time (avg) | bytes in block (cumulative) | square size current day like insights -->
4939
</Flex>
5040
</template>
5141

@@ -97,4 +87,22 @@ const selectedPeriod = ref(periods.value[0])
9787
height: 380px;
9888
}
9989
}
90+
91+
@media (max-width: 420px) {
92+
.wrapper {
93+
padding: 32px 0px;
94+
}
95+
96+
.chart_card {
97+
flex: 1;
98+
min-width: 340px;
99+
height: 380px;
100+
}
101+
102+
.square_size_chart_card {
103+
flex: 1;
104+
min-width: 340px;
105+
height: 380px;
106+
}
107+
}
100108
</style>

components/modules/stats/tabs/GeneralTab.vue

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
<script setup>
22
/** UI */
3-
import AmountInCurrency from "@/components/AmountInCurrency.vue"
43
import Button from "@/components/ui/Button.vue"
54
import { Dropdown, DropdownItem } from "@/components/ui/Dropdown"
6-
import Tooltip from "@/components/ui/Tooltip.vue"
75
86
97
/** Stats Components */
@@ -15,9 +13,6 @@ import InsightCard from "@/components/modules/stats/InsightCard.vue"
1513
/** Constants */
1614
import { getInsightsByGroup, getSeriesByGroupAndType, STATS_PERIODS } from "@/services/constants/stats.js"
1715
18-
/** Services */
19-
import { comma, tia } from "@/services/utils"
20-
2116
/** API */
2217
import { fetch24hDiffs } from "@/services/api/stats.js"
2318
@@ -80,7 +75,10 @@ await get24hDiffs()
8075
<Flex direction="column" gap="24" wide :class="$style.wrapper">
8176
<Flex align="center" direction="column" gap="10">
8277
<Flex justify="between" wide :class="$style.highlights_wrapper">
83-
<HighlightCard v-for="h in highlights" :highlight="h" />
78+
<HighlightCard
79+
v-for="h in highlights"
80+
:highlight="h"
81+
/>
8482
</Flex>
8583

8684
<Flex align="center" justify="start" wide>
@@ -137,18 +135,16 @@ await get24hDiffs()
137135
<style module>
138136
.wrapper {
139137
max-width: calc(var(--base-width) + 48px);
140-
141-
/* padding: 40px 24px 60px 24px; */
142-
}
143-
144-
.highlights_wrapper{
145-
flex-wrap: wrap;
146138
}
147139
148140
.section {
149141
margin-top: 20px;
150142
}
151143
144+
.highlights_wrapper {
145+
flex-wrap: wrap;
146+
}
147+
152148
.charts_wrapper {
153149
flex-wrap: wrap;
154150
}
@@ -178,4 +174,16 @@ await get24hDiffs()
178174
padding: 32px 12px;
179175
}
180176
}
177+
178+
@media (max-width: 420px) {
179+
.wrapper {
180+
padding: 32px 0px;
181+
}
182+
183+
.chart_card {
184+
flex: 1;
185+
min-width: 340px;
186+
height: 280px;
187+
}
188+
}
181189
</style>

0 commit comments

Comments
 (0)