Skip to content

Commit

Permalink
Merge branch 'master' of github.com:allora-network/explorer
Browse files Browse the repository at this point in the history
  • Loading branch information
vladupshot committed Jul 8, 2024
2 parents a0f05ad + a5d213d commit ed2e075
Show file tree
Hide file tree
Showing 92 changed files with 3,931 additions and 2,976 deletions.
2 changes: 1 addition & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
"bracketSpacing": true,
"TrailingCooma": true,
"arrowParens": "always"
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"@vitejs/plugin-vue": "^4.0.0",
"@vue/tsconfig": "^0.1.3",
"npm-run-all": "^4.1.5",
"prettier": "^2.7.1",
"prettier": "^3.3.2",
"sass": "^1.58.0",
"shiki": "^1.0.0-beta.0",
"typescript": "~4.9.5",
Expand Down
12 changes: 7 additions & 5 deletions src/components/CardParameter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ function calculateValue(value: any) {
if (Array.isArray(value)) {
return (value[0] && value[0].amount) || '-';
}
if(String(value).search(/^\d+s$/g) > -1) {
return formatSeconds(value)
if (String(value).search(/^\d+s$/g) > -1) {
return formatSeconds(value);
}
const newValue = Number(value);
if (`${newValue}` === 'NaN' || typeof value === 'boolean') {
Expand All @@ -28,8 +28,8 @@ function calculateValue(value: any) {
}
function formatTitle(v: string) {
if(!v) return ""
return v.replace(/_/g, " ")
if (!v) return '';
return v.replace(/_/g, ' ');
}
</script>
<template>
Expand All @@ -46,7 +46,9 @@ function formatTitle(v: string) {
:key="index"
class="rounded-sm bg-active px-4 py-2"
>
<div class="text-xs mb-2 text-secondary capitalize">{{ formatTitle(item?.subtitle) }}</div>
<div class="text-xs mb-2 text-secondary capitalize">
{{ formatTitle(item?.subtitle) }}
</div>
<div class="text-base text-main">{{ calculateValue(item?.value) }}</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/CardStatisticsVertical.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const props = withDefaults(defineProps<Props>(), {
const isPositive = controlledComputed(
() => props.change,
() => Math.sign(props.change || 0) === 1
() => Math.sign(props.change || 0) === 1,
);
</script>

Expand Down
2 changes: 1 addition & 1 deletion src/components/ChainSummary.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const addFavor = (e: Event) => {
!dashboardStore?.favoriteMap?.[props.name];
window.localStorage.setItem(
'favoriteMap',
JSON.stringify(dashboardStore.favoriteMap)
JSON.stringify(dashboardStore.favoriteMap),
);
};
</script>
Expand Down
27 changes: 13 additions & 14 deletions src/components/Countdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,26 @@ const props = defineProps({
css: { type: String },
});
const s = ref(0)
const s = ref(0);
</script>
<template>
<Countdown
v-if="time"
:time="time > 0 ? time : 0"
v-slot="{ days, hours, minutes, seconds }"
class="countdown-container justify-items-center "
class="countdown-container justify-items-center"
>
<span class="text-primary font-bold " :class="css">{{ days }}</span> days
<span class="text-primary font-bold" :class="css">{{ hours }}</span> hours
<span class="text-primary font-bold" :class="css">{{ minutes }}</span> minutes
<span class="text-primary font-bold w-40" :class="css">
<Transition name="slide-up">
<span v-if="seconds % 2 === 0" class="countdown">{{ seconds }}</span>
<span v-else="seconds % 2 === 1" class="countdown">{{ seconds }}</span>
</Transition>
</span>
<span class="ml-10">seconds</span>
<span class="text-primary font-bold" :class="css">{{ days }}</span> days
<span class="text-primary font-bold" :class="css">{{ hours }}</span> hours
<span class="text-primary font-bold" :class="css">{{ minutes }}</span>
minutes
<span class="text-primary font-bold w-40" :class="css">
<Transition name="slide-up">
<span v-if="seconds % 2 === 0" class="countdown">{{ seconds }}</span>
<span v-else="seconds % 2 === 1" class="countdown">{{ seconds }}</span>
</Transition>
</span>
<span class="ml-10">seconds</span>
</Countdown>
</template>

Expand All @@ -42,5 +42,4 @@ const s = ref(0)
text-align: right;
float: right;
}
</style>
78 changes: 43 additions & 35 deletions src/components/PaginationBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,49 +2,57 @@
import { computed, ref } from 'vue';
const props = defineProps({
total: { type: String },
limit: { type: Number },
callback: { type: Function, required: true },
total: { type: String },
limit: { type: Number },
callback: { type: Function, required: true },
});
const current = ref(1)
const showSize = 3
const current = ref(1);
const showSize = 3;
const pages = computed(() => {
const pages: { color: string, page: number }[] = []
const total = Number(props.total || 0)
if (total > 0 && props.limit && total > props.limit) {
let page = 0
while (true) {
if (page * props.limit >= total) break
page += 1
if (total / props.limit > 10 && page > showSize && page < (total / props.limit - showSize + 1)) {
if (!(page >= current.value - 1 && page <= current.value + 1)) {
continue
}
}
pages.push({
color: page === current.value ? 'btn-primary' : '',
page: page,
})
const pages: { color: string; page: number }[] = [];
const total = Number(props.total || 0);
if (total > 0 && props.limit && total > props.limit) {
let page = 0;
while (true) {
if (page * props.limit >= total) break;
page += 1;
if (
total / props.limit > 10 &&
page > showSize &&
page < total / props.limit - showSize + 1
) {
if (!(page >= current.value - 1 && page <= current.value + 1)) {
continue;
}
}
pages.push({
color: page === current.value ? 'btn-primary' : '',
page: page,
});
}
return pages
})
}
return pages;
});
function gotoPage(pageNum: number) {
current.value = pageNum
props.callback(pageNum)
current.value = pageNum;
props.callback(pageNum);
}
</script>
<template>
<div class="my-5 text-center">
<div v-if="total && limit" class="btn-group">
<button v-for="{ page, color } in pages" :key="page"
class="btn bg-gray-100 text-gray-500 hover:text-white border-none dark:bg-gray-800 dark:text-white" :class="{
'!btn-primary': color === 'btn-primary',
}" @click="gotoPage(page)">
{{ page }}
</button>
</div>
<div class="my-5 text-center">
<div v-if="total && limit" class="btn-group">
<button
v-for="{ page, color } in pages"
:key="page"
class="btn bg-gray-100 text-gray-500 hover:text-white border-none dark:bg-gray-800 dark:text-white"
:class="{
'!btn-primary': color === 'btn-primary',
}"
@click="gotoPage(page)"
>
{{ page }}
</button>
</div>
</div>
</template>
18 changes: 9 additions & 9 deletions src/components/ProposalListItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ function metaItem(metadata: string | undefined): {
statusMap?.[item?.status] === 'PASSED'
? 'text-yes'
: statusMap?.[item?.status] === 'REJECTED'
? 'text-no'
: 'text-info'
? 'text-no'
: 'text-info'
"
>
<div
Expand All @@ -104,8 +104,8 @@ function metaItem(metadata: string | undefined): {
statusMap?.[item?.status] === 'PASSED'
? 'bg-yes'
: statusMap?.[item?.status] === 'REJECTED'
? 'bg-no'
: 'bg-info'
? 'bg-no'
: 'bg-info'
"
></div>
<div class="text-xs">
Expand Down Expand Up @@ -202,8 +202,8 @@ function metaItem(metadata: string | undefined): {
statusMap?.[item?.status] === 'PASSED'
? 'text-yes'
: statusMap?.[item?.status] === 'REJECTED'
? 'text-no'
: 'text-info'
? 'text-no'
: 'text-info'
"
>
<div
Expand All @@ -212,8 +212,8 @@ function metaItem(metadata: string | undefined): {
statusMap?.[item?.status] === 'PASSED'
? 'bg-yes'
: statusMap?.[item?.status] === 'REJECTED'
? 'bg-no'
: 'bg-info'
? 'bg-no'
: 'bg-info'
"
></div>
<div class="text-xs flex items-center">
Expand Down Expand Up @@ -261,7 +261,7 @@ function metaItem(metadata: string | undefined): {
proposalInfo?.content?.description ||
proposalInfo?.summary ||
metaItem(proposalInfo?.metadata)?.summary,
'horizontal'
'horizontal',
)
"
:value="
Expand Down
8 changes: 4 additions & 4 deletions src/components/ProposalProcess.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ const props = defineProps({
const total = computed(() => props.pool?.bonded_tokens);
const format = useFormatter();
const yes = computed(() =>
format.calculatePercent(props.tally?.yes, total.value)
format.calculatePercent(props.tally?.yes, total.value),
);
const no = computed(() =>
format.calculatePercent(props.tally?.no, total.value)
format.calculatePercent(props.tally?.no, total.value),
);
const abstain = computed(() =>
format.calculatePercent(props.tally?.abstain, total.value)
format.calculatePercent(props.tally?.abstain, total.value),
);
const veto = computed(() =>
format.calculatePercent(props.tally?.no_with_veto, total.value)
format.calculatePercent(props.tally?.no_with_veto, total.value),
);
</script>

Expand Down
4 changes: 2 additions & 2 deletions src/components/TxDialog.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<script lang="ts" setup>
import { useTxDialog, useBlockchain } from '@/stores';
const store = useTxDialog();
const chainStore = useBlockchain()
const chainStore = useBlockchain();
</script>
<template>
<ping-tx-dialog
:type="store.type"
:sender="store.sender"
:endpoint="store.endpoint"
:params='store.params'
:params="store.params"
:hd-path="store.hdPaths"
:registry-name="chainStore.current?.prettyName || chainStore.chainName"
@view="store.view"
Expand Down
17 changes: 8 additions & 9 deletions src/components/UptimeBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ const props = defineProps({
const bars = computed(() => {
const uptime = Array(50).fill({ height: 0, color: 'bg-secondary' });
if(!props.blocks) return uptime
if (!props.blocks) return uptime;
props.blocks.forEach((element) => {
const has = element.signatures?.findIndex(
(sig) => sig.validator_address === props.validator
(sig) => sig.validator_address === props.validator,
);
// console.log(has, props.validato, element)
uptime.push({
Expand All @@ -27,17 +27,16 @@ const bars = computed(() => {
<template>
<div class="flex items-center justify-evenly gap-0.5">
<div class="cursor-default" v-for="(item, index) in bars" :key="index">
<div class="tooltip"
:data-tip="item.height"
:class="item.color"
style="width: 4px;"
<div
class="tooltip"
:data-tip="item.height"
:class="item.color"
style="width: 4px"
>
&nbsp;
</div>
</div>
</div>
</template>

<style>
</style>
<style></style>
Loading

0 comments on commit ed2e075

Please sign in to comment.