Skip to content

Commit

Permalink
revert
Browse files Browse the repository at this point in the history
  • Loading branch information
femans committed Sep 23, 2022
1 parent 82ddcaf commit d7b33fb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 31 deletions.
12 changes: 4 additions & 8 deletions src/composables/footer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,6 @@ import { useRoute } from "vue-router";
import { playlistVisible, audioPlayer, audioDetailPopup } from "@/composables/audioControls";
export const _footerVisible = ref(true);

const coveringPanel = computed(
() => audioPlayer.value.file || playlistVisible.value || audioDetailPopup.value
);

const hideFooter = () => {
_footerVisible.value = false;
};

export const useFooter = () => {
const route = useRoute();

Expand All @@ -21,6 +13,10 @@ export const useFooter = () => {
return _footerVisible.value && route.name === "Search";
});

const hideFooter = () => {
_footerVisible.value = false;
};

const adjustFooterPadding = computed(() => {
if (audioPlayer.value.file) return "100px";
if (footerVisible.value) return "120px";
Expand Down
30 changes: 7 additions & 23 deletions src/composables/useFileListComposable.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ import durationToColor from "@/helpers/durationToColor";
import mime from "mime";
import { Types } from "@/helpers/typeHelper";
import getResourceURL from "@/helpers/resourceURL";
import { enterSearchQuery } from "@/router";

const infiniteScrollMargin = 200;

export const useFileListComposable = ({ fileType }) => {
const route = useRoute();
Expand Down Expand Up @@ -48,32 +45,19 @@ export const useFileListComposable = ({ fileType }) => {
return pageHits.value;
}

/**
* See if the the page scrolled so far down that empty space opens up at the bottom.
* Also update the url
* used by ImageList
*/
const infiniteScroll = () => {
const { scrollTop, scrollHeight } = document.getElementById("search-view");
// calculate, which page is currently in view
const scrollPage = Math.floor(loadedPages.value * (scrollTop / scrollHeight)) + 1;
// if needed, change the page in the URL
if (store.state.query.page !== scrollPage) {
enterSearchQuery(route.query, scrollPage, "replace");
}
const nearBottom = window.innerHeight + infiniteScrollMargin > scrollHeight - scrollTop;
if (nearBottom && !loading.value) {
return store.dispatch(`results/${fileType}/fetchPage`, { page: loadedPages.value + 1 });
}
};

return {
pageHits,
loading,
anyFileType,
infinite,
loadedPages,
slicedHits,
infiniteScroll,
};
};

export const imports = {
mime,
durationToColor,
prettyBytes,
getResourceURL,
};

0 comments on commit d7b33fb

Please sign in to comment.