Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tweak category buttons #268

Closed
wants to merge 4 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 25 additions & 21 deletions src/components/searchViewComponents/BaseList.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup>
import { mdiMagnifyExpand, mdiPlaylistPlay, mdiPlaylistPlus } from "@mdi/js";
import { mdiMagnifyExpand, mdiPlaylistPlay, mdiPlaylistPlus, mdiDotsHorizontal } from "@mdi/js";
import CardContent from "@/components/searchViewComponents/subcomponents/genericCardContent.vue";
import HoverCard from "./subcomponents/HoverCard.vue";
import { Types, TypeListNames, TypeIcons } from "@/helpers/typeHelper";
Expand Down Expand Up @@ -48,6 +48,12 @@ const pageCount = computed(
maxPages
);

const viewAllTo = computed(() => {
return { ...route, query: { ...route.query, type: props.fileType } };
});

const hasResults = computed(() => resultsTotal.value !== 0);

/**
* scroll down to the page from the query
*/
Expand Down Expand Up @@ -114,26 +120,18 @@ const queryPage = computed({
class="justify-space-between d-flex mb-3"
style="gap: 5px"
>
<hyperlink
:disabled="!anyFileType"
:to="{ ...route, query: { ...route.query, type: fileType } }"
class="flex-grow-1"
>
<div
class="w-100 d-flex justify-start align-center text-ipfsPrimary-lighten-1 v-btn v-btn--density-default v-btn--size-default v-btn--variant-outlined"
color="ipfsPrimary"
<hyperlink :disabled="!anyFileType" :to="viewAllTo" class="flex-grow-1">
<!-- Note: v-btn has a "to" prop as well, which should eliminate the need for hyperlink here. However, it causes the btn to be rendered as 'tonal', overriding the text variant here -->
femans marked this conversation as resolved.
Show resolved Hide resolved
<v-btn
femans marked this conversation as resolved.
Show resolved Hide resolved
class="justify-start"
style="opacity: initial"
block
variant="text"
:prepend-icon="TypeIcons[fileType]"
:disabled="!anyFileType"
>
<div class="mr-auto d-flex flex-row align-center">
<v-icon size="28" :icon="TypeIcons[fileType]" color="ipfsPrimary-lighten-1" />
<span> {{ TypeListNames[fileType] }} ({{ resultsTotal }}) </span>
</div>
<div v-if="anyFileType" class="d-flex flex-row align-center justify-end">
<div class="">
<span>View all</span>
<v-icon size="28" :icon="mdiMagnifyExpand" color="ipfsPrimary-lighten-1" />
</div>
</div>
</div>
{{ TypeListNames[fileType] }} ({{ resultsTotal }})
</v-btn>
</hyperlink>
<div
v-if="fileType === Types.audio && pageHits.length"
Expand Down Expand Up @@ -169,7 +167,7 @@ const queryPage = computed({
</v-col>
</v-row>

<slot v-if="resultsTotal !== 0">
<slot v-if="hasResults">
<v-row dense>
<v-col v-for="(hit, index) in slicedHits(3)" :key="index" cols="12">
<hover-card :hit="hit" :index="index" :file-type="fileType">
Expand All @@ -179,6 +177,12 @@ const queryPage = computed({
</v-row>
</slot>

<v-row v-if="hasResults && anyFileType" justify="center" class="mt-2 mb-1">
<v-col cols="12" sm="2" md="1">
<v-btn block rounded="pill" variant="text" :to="viewAllTo" :icon="mdiDotsHorizontal" />
</v-col>
</v-row>

<v-row v-if="loading" dense justify="center">
<v-progress-circular color="ipfsPrimary" indeterminate />
</v-row>
Expand Down