Skip to content

Commit

Permalink
change date format && add empty template for ref contracts
Browse files Browse the repository at this point in the history
  • Loading branch information
Mi L committed Jul 6, 2022
1 parent 80c2923 commit b264b13
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/utils/tz.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export function shortcutOnly(value, tail = 4) {
export function formatDatetime(timestamp, minDate = {val: 1, unit: "day"}) {
let d = dayjs(timestamp);
if (timestamp) {
if (d.year() < dayjs().year()) return d.format("D MMM'YY HH:mm");
if (d.year()) return d.format("D MMM'YY HH:mm");
if (d.add(minDate.val, minDate.unit).isBefore(dayjs())) return d.format("D MMM HH:mm");
return d.fromNow();
}
Expand Down
2 changes: 1 addition & 1 deletion src/views/constant/ConstantInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</v-list-item-subtitle
>
<v-list-item-title class="body-2">
{{ field.value }}
{{ field.type === 'timestamp' ? helpers.formatDatetime(field.value) : field.value }}
</v-list-item-title>
</v-list-item-content>
</v-list-item>
Expand Down
3 changes: 2 additions & 1 deletion src/views/constant/ConstantTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ export default {
return items.map((item) => {
return {
value: item === 'timestamp' ? this.helpers.formatDatetime(this.constantInfo[item]) : this.constantInfo[item],
value: this.constantInfo[item],
type: item,
label: toTitleCase(item)
}
})
Expand Down
10 changes: 9 additions & 1 deletion src/views/constant/ReferenceContract.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<v-skeleton-loader :loading="loading" type="article" transition="fade-transition">
<v-data-table
:items="contracts"
v-if="contracts.length"
hide-default-header
:class="['ba-1 mt-4 avg-gas-consumption', 'hide-pagination-count']"
hide-default-footer
Expand Down Expand Up @@ -53,7 +54,9 @@
</div>
</template>
</v-data-table>

<span v-else class="not-found-text">
There are no references to this constant
</span>
</v-skeleton-loader>
</v-fade-transition>
</div>
Expand Down Expand Up @@ -99,3 +102,8 @@ export default {
}
}
</script>
<style scoped>
.not-found-text {
color: rgba(255, 255, 255, 0.5);
}
</style>

0 comments on commit b264b13

Please sign in to comment.