Skip to content

Commit

Permalink
fix: add search by nft and shorten search placehodler (#626)
Browse files Browse the repository at this point in the history
  • Loading branch information
janmichek committed Dec 21, 2023
1 parent 2179075 commit 8f94d04
Show file tree
Hide file tree
Showing 22 changed files with 263 additions and 57 deletions.
38 changes: 19 additions & 19 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title><%- title %></title>
<meta name="description" content="<%- description %>">
<link rel="apple-touch-icon" sizes="180x180" href="/favicon-apple-180.png">
<link rel="icon" type="image/png" sizes="512x512" href="/favicon-512.png">
<link rel="icon" type="image/png" sizes="96x96" href="/favicon-96.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32.png">
<meta property="og:type" content="website"/>
<meta property="og:title" content="<%- title %>"/>
<meta property="og:description" content="<%- description %>"/>
<meta property="og:image" content="<%- url %>/social-cover.png"/>
<meta property="og:image:width" content="1200"/>
<meta property="og:image:height" content="600"/>
<meta property="og:image:alt" content="<%- title %>"/>
<meta property="og:url" content="<%- url %>"/>
<meta name="twitter:card" content="summary_large_image"/>
<meta name="twitter:site" content="<%- creator %>"/>
<meta name="twitter:creator" content="<%- creator %>"/>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title><%- title %></title>
<meta name="description" content="<%- description %>">
<link rel="apple-touch-icon" sizes="180x180" href="/favicon-apple-180.png">
<link rel="icon" type="image/png" sizes="512x512" href="/favicon-512.png">
<link rel="icon" type="image/png" sizes="96x96" href="/favicon-96.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32.png">
<meta property="og:type" content="website"/>
<meta property="og:title" content="<%- title %>"/>
<meta property="og:description" content="<%- description %>"/>
<meta property="og:image" content="<%- url %>/social-cover.png"/>
<meta property="og:image:width" content="1200"/>
<meta property="og:image:height" content="600"/>
<meta property="og:image:alt" content="<%- title %>"/>
<meta property="og:url" content="<%- url %>"/>
<meta name="twitter:card" content="summary_large_image"/>
<meta name="twitter:site" content="<%- creator %>"/>
<meta name="twitter:creator" content="<%- creator %>"/>
</head>
<body>
<div id="app"></div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/AccountDetailsPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ import AppLink from '@/components/AppLink'
import { formatAePrice, formatNullable, formatNumber } from '@/utils/format'
import { useMarketStatsStore } from '@/stores/marketStats'
import HintTooltip from '@/components/HintTooltip'
import AppChip from '~/components/AppChip'
import AppChip from '@/components/AppChip'
const { price } = storeToRefs(useMarketStatsStore())
const { NODE_URL } = useRuntimeConfig().public
Expand Down
2 changes: 1 addition & 1 deletion src/components/NftTransfersTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
</template>
<script setup>
import { nftsHints } from '@/utils/hints/nftHints'
import { nftsHints } from '@/utils/hints/nftsHints'
defineProps({
nftTransfers: {
Expand Down
2 changes: 1 addition & 1 deletion src/components/NftTransfersTableCondensed.vue
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
</template>

<script setup>
import { nftsHints } from '@/utils/hints/nftHints'
import { nftsHints } from '@/utils/hints/nftsHints'
import ValueHashEllipsed from '@/components/ValueHashEllipsed'
defineProps({
Expand Down
2 changes: 1 addition & 1 deletion src/components/NftsDetailsPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@

<script setup>
import AppPanel from '@/components/AppPanel'
import { nftsHints } from '@/utils/hints/nftHints'
import { nftsHints } from '@/utils/hints/nftsHints'
defineProps({
nftDetails: {
Expand Down
2 changes: 1 addition & 1 deletion src/components/NftsInventoryTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
<script setup>
import { storeToRefs } from 'pinia'
import { nftsHints } from '@/utils/hints/nftHints'
import { nftsHints } from '@/utils/hints/nftsHints'
import ValueHashEllipsed from '@/components/ValueHashEllipsed'
import { useNftDetailsStore } from '@/stores/nftDetails'
Expand Down
2 changes: 1 addition & 1 deletion src/components/NftsInventoryTableCondensed.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
</template>
<script setup>
import { storeToRefs } from 'pinia'
import { nftsHints } from '@/utils/hints/nftHints'
import { nftsHints } from '@/utils/hints/nftsHints'
const nftDetailsStore = useNftDetailsStore()
const { nftOwners } = storeToRefs(nftDetailsStore)
Expand Down
2 changes: 1 addition & 1 deletion src/components/NftsOwnersTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
</template>

<script setup>
import { nftsHints } from '@/utils/hints/nftHints'
import { nftsHints } from '@/utils/hints/nftsHints'
defineProps({
owners: {
Expand Down
2 changes: 1 addition & 1 deletion src/components/NftsOwnersTableCondensed.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
</div>
</template>
<script setup>
import { nftsHints } from '@/utils/hints/nftHints'
import { nftsHints } from '@/utils/hints/nftsHints'
defineProps({
owners: {
Expand Down
2 changes: 1 addition & 1 deletion src/components/NftsTemplatesOwnersTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
</template>

<script setup>
import { nftsHints } from '@/utils/hints/nftHints'
import { nftsHints } from '@/utils/hints/nftsHints'
defineProps({
owners: {
Expand Down
2 changes: 1 addition & 1 deletion src/components/NftsTemplatesOwnersTableCondensed.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
</div>
</template>
<script setup>
import { nftsHints } from '@/utils/hints/nftHints'
import { nftsHints } from '@/utils/hints/nftsHints'
defineProps({
owners: {
Expand Down
2 changes: 1 addition & 1 deletion src/components/NftsTransfersTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
</template>

<script setup>
import { nftsHints } from '@/utils/hints/nftHints'
import { nftsHints } from '@/utils/hints/nftsHints'
defineProps({
nftTransfers: {
Expand Down
2 changes: 1 addition & 1 deletion src/components/NftsTransfersTableCondensed.vue
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
</template>

<script setup>
import { nftsHints } from '@/utils/hints/nftHints'
import { nftsHints } from '@/utils/hints/nftsHints'
defineProps({
nftTransfers: {
Expand Down
39 changes: 39 additions & 0 deletions src/components/SearchNftsPanel.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<template>
<app-panel>
<paginated-content
:entities="nftsResults"
:limit="limit"
@prev-clicked="loadPrevNfts"
@next-clicked="loadNextNfts">
<search-nfts-table
:nfts="nftsResults"
class="u-hidden-mobile"/>
<search-nfts-table-condensed
:nfts="nftsResults"
class="u-hidden-desktop"/>
</paginated-content>
</app-panel>
</template>
<script setup>
import { computed } from 'vue'
import { storeToRefs } from 'pinia'
import { isDesktop } from '@/utils/screen'
import { useSearchStore } from '@/stores/search'
const searchStore = useSearchStore()
const { nftsResults } = storeToRefs(searchStore)
const { fetchNftsResults } = searchStore
const limit = computed(() => process.client && isDesktop() ? 10 : 3)
const route = useRoute()
await fetchNftsResults({ query: route.params.id, limit: limit.value })
async function loadPrevNfts() {
await fetchNftsResults({ queryParameters: nftsResults.value.prev })
}
async function loadNextNfts() {
await fetchNftsResults({ queryParameters: nftsResults.value.next })
}
</script>
68 changes: 68 additions & 0 deletions src/components/SearchNftsTable.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<template>
<table class="search-nfts-table">
<thead>
<tr>
<th>
Collection Name
<hint-tooltip>
{{ nftsHints.collectionName }}
</hint-tooltip>
</th>
<th>
Smart Contract ID
<hint-tooltip>
{{ nftsHints.smartContractId }}
</hint-tooltip>
</th>
</tr>
</thead>
<tbody>
<tr
v-for="nft in nfts.data"
:key="nft.contractId">
<td>
<app-link
:to="`/nfts/${nft.contractId}`"
class="search-nfts-table__link">
{{ nft.name }}
</app-link>
</td>
<td>
<value-hash-ellipsed
:link-to="`/contracts/${nft.contractId}`"
:hash="nft.contractId"/>
</td>
</tr>
</tbody>
</table>
</template>

<script setup>
import { nftsHints } from '@/utils/hints/nftsHints'
defineProps({
nfts: {
type: Object,
required: true,
},
})
</script>

<style scoped>
.search-nfts-table {
margin-bottom: var(--space-4);
&__link {
display: inline-flex;
align-items: center;
}
&__icon {
width: 24px;
height: 24px;
margin-right: var(--space-1);
}
}
</style>
88 changes: 88 additions & 0 deletions src/components/SearchNftsTableCondensed.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<template>
<div>
<table
v-for="nft in nfts.data"
:key="nft.contractId"
class="search-nfts-table-condensed__table">
<tbody>
<tr class="search-nfts-table-condensed__row">
<th class="search-nfts-table-condensed__header">
<app-tooltip>
Collection Name
<template #tooltip>
{{ nftsHints.collectionName }}
</template>
</app-tooltip>
</th>
<td class="search-nfts-table-condensed__data">
<app-link
:to="`/nfts/${nft.contractId}`"
class="search-nfts-table-condensed__link">
{{ nft.name }}
</app-link>
</td>
</tr>
<tr class="search-nfts-table-condensed__row">
<th class="search-nfts-table-condensed__header">
<app-tooltip>
Smart Contract ID
<template #tooltip>
{{ nftsHints.smartContractId }}
</template>
</app-tooltip>
</th>
<td class="search-nfts-table-condensed__data">
<value-hash-ellipsed
:link-to="`/contracts/${nft.contractId}`"
:hash="nft.contractId"/>
</td>
</tr>
</tbody>
</table>
</div>
</template>
<script setup>
import AppLink from '@/components/AppLink'
import AppTooltip from '@/components/AppTooltip'
import { nftsHints } from '@/utils/hints/nftsHints'
defineProps({
nfts: {
type: Object,
required: true,
},
})
</script>

<style scoped>
.search-nfts-table-condensed {
&__table {
padding: 0 var(--space-1) var(--space-7);
margin-bottom: var(--space-5);
}
&__header {
border-bottom: 1px solid var(--color-midnight-25);
}
&__row:last-of-type &__header {
border-bottom: 0;
}
&__data {
text-align: right;
}
&__link {
display: inline-flex;
align-items: center;
}
&__icon {
width: 20px;
height: 20px;
margin-right: var(--space-1);
}
}
</style>
8 changes: 6 additions & 2 deletions src/components/TheSearchBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<input
v-model="query"
class="search-bar__input"
placeholder="Search accounts, transactions, names, contracts, oracles, state channels, keyblocks, and microblocks"
placeholder="Search anything on aeScan"
type="search"
autofocus
@keyup.enter="search">
Expand Down Expand Up @@ -131,10 +131,14 @@ function isMicroblockId(query) {
border: none;
background-color: var(--color-white);
margin-right: var(--space-1);
font-size: 14px;
font-size: 16px;
appearance: none;
font-family: var(--font-monospaced);
@media (--desktop) {
font-size: 14px;
}
&:focus {
outline: none;
}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/nfts/[id].vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

<script setup>
import { storeToRefs } from 'pinia'
import { nftsHints } from '@/utils/hints/nftHints'
import { nftsHints } from '@/utils/hints/nftsHints'
import PageHeader from '@/components/PageHeader'
import { useNftDetailsStore } from '@/stores/nftDetails'
import NftDetailsPanel from '@/components/NftsDetailsPanel'
Expand Down

0 comments on commit 8f94d04

Please sign in to comment.