-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Improve search results page (#458)
Co-authored-by: Michele Franchi <michele.franchi933@gmail.com>
- Loading branch information
1 parent
7a29bd6
commit c0f7f10
Showing
41 changed files
with
563 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<template> | ||
<app-panel> | ||
<paginated-content | ||
:entities="namesResults" | ||
:limit="limit" | ||
@prev-clicked="loadPrevNames" | ||
@next-clicked="loadNextNames"> | ||
<search-names-table | ||
:names="namesResults" | ||
class="search-names-panel__search-names-table"/> | ||
<search-names-table-condensed | ||
:names="namesResults" | ||
class="search-names-panel__search-names-table-condensed"/> | ||
</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 { namesResults } = storeToRefs(searchStore) | ||
const { fetchNamesResults } = searchStore | ||
const limit = computed(() => process.client && isDesktop() ? 10 : 3) | ||
const route = useRoute() | ||
await fetchNamesResults({ query: route.params.id, limit: limit.value }) | ||
async function loadPrevNames() { | ||
await fetchNamesResults({ queryParameters: namesResults.value.prev }) | ||
} | ||
async function loadNextNames() { | ||
await fetchNamesResults({ queryParameters: namesResults.value.next }) | ||
} | ||
</script> | ||
|
||
<style scoped> | ||
.search-names-panel { | ||
&__search-names-table { | ||
display: none; | ||
@media (--desktop) { | ||
display: revert; | ||
} | ||
} | ||
&__search-names-table-condensed { | ||
@media (--desktop) { | ||
display: none; | ||
} | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<template> | ||
<table class="search-names-table"> | ||
<thead> | ||
<tr> | ||
<th> | ||
Name | ||
<hint-tooltip> | ||
{{ namesHints.name }} | ||
</hint-tooltip> | ||
</th> | ||
<th> | ||
Status | ||
<hint-tooltip> | ||
{{ namesHints.status }} | ||
</hint-tooltip> | ||
</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr | ||
v-for="name in names.data" | ||
:key="name.name"> | ||
<td> | ||
<app-link :to="`/names/${name.name}`"> | ||
{{ name.name }} | ||
</app-link> | ||
</td> | ||
<td>{{ name.status }}</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</template> | ||
|
||
<script setup> | ||
import { namesHints } from '@/utils/hints/namesHints' | ||
defineProps({ | ||
names: { | ||
type: Object, | ||
required: true, | ||
}, | ||
}) | ||
</script> | ||
|
||
<style scoped> | ||
.search-names-table { | ||
margin-bottom: var(--space-4); | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<template> | ||
<div> | ||
<table | ||
v-for="name in names.data" | ||
:key="name.name" | ||
class="search-names-table-condensed__table"> | ||
<tbody> | ||
<tr class="search-names-table-condensed__row"> | ||
<th class="search-names-table-condensed__header"> | ||
<app-tooltip> | ||
Name | ||
<template #tooltip> | ||
{{ namesHints.name }} | ||
</template> | ||
</app-tooltip> | ||
</th> | ||
<td class="search-names-table-condensed__data"> | ||
<app-link :to="`/names/${name.name}`"> | ||
{{ name.name }} | ||
</app-link> | ||
</td> | ||
</tr> | ||
<tr class="search-names-table-condensed__row"> | ||
<th class="search-names-table-condensed__header"> | ||
<app-tooltip> | ||
Status | ||
<template #tooltip> | ||
{{ namesHints.status }} | ||
</template> | ||
</app-tooltip> | ||
</th> | ||
<td class="search-names-table-condensed__data"> | ||
{{ name.status }} | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</div> | ||
</template> | ||
|
||
<script setup> | ||
import { namesHints } from '@/utils/hints/namesHints' | ||
import AppLink from '@/components/AppLink' | ||
import AppTooltip from '@/components/AppTooltip' | ||
defineProps({ | ||
names: { | ||
type: Object, | ||
required: true, | ||
}, | ||
}) | ||
</script> | ||
|
||
<style scoped> | ||
.search-names-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; | ||
} | ||
} | ||
</style> |
Oops, something went wrong.