Compare commits
2 commits
af44880f59
...
e80b210c22
Author | SHA1 | Date | |
---|---|---|---|
e80b210c22 | |||
2193064f3a |
4 changed files with 124 additions and 69 deletions
46
src/components/common/navigation/ScrollToTop.vue
Normal file
46
src/components/common/navigation/ScrollToTop.vue
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
<script lang="ts" setup>
|
||||||
|
//const props = defineProps(['show']);
|
||||||
|
const showScroll = ref(false);
|
||||||
|
const updateScrollPosition = () => {
|
||||||
|
showScroll.value = document.documentElement.scrollTop > 1500;
|
||||||
|
};
|
||||||
|
const scrollToTop = () => {
|
||||||
|
window.scrollTo({
|
||||||
|
top: 0,
|
||||||
|
behavior: "smooth",
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
window.addEventListener("scroll", updateScrollPosition);
|
||||||
|
});
|
||||||
|
|
||||||
|
onUnmounted(() => {
|
||||||
|
window.removeEventListener("scroll", updateScrollPosition);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<span v-if="showScroll" class="floater overlay-text" @click="scrollToTop">
|
||||||
|
Scroll To Top
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.floater {
|
||||||
|
display: block;
|
||||||
|
position: fixed;
|
||||||
|
right: 10px;
|
||||||
|
bottom: 10px;
|
||||||
|
z-index: 1000;
|
||||||
|
cursor: pointer;
|
||||||
|
background-color: rgba(112, 128, 144, 0.8);
|
||||||
|
padding: 1rem;
|
||||||
|
border-radius: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.overlay-text {
|
||||||
|
color: white;
|
||||||
|
text-shadow: 1px 1px #6f0b51;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { hasToken } from "~/composables/hasToken";
|
import { hasToken } from "~/composables/hasToken";
|
||||||
|
import ProfileMenu from "~/components/common/menus/ProfileMenu.vue";
|
||||||
|
|
||||||
const authenticated = computed(() => hasToken());
|
const authenticated = computed(() => hasToken());
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,75 +1,81 @@
|
||||||
<template>
|
<template>
|
||||||
<LoadingIcon v-if="loading" show-quote="true" />
|
<div>
|
||||||
<div v-else class="p-5 sm:p-0">
|
<LoadingIcon v-if="loading" show-quote="true" />
|
||||||
<Modal ref="movie_modal">
|
<div v-else class="p-5 sm:p-0">
|
||||||
<ShowMovie
|
<ScrollToTop></ScrollToTop>
|
||||||
v-if="modal_movie"
|
<Modal ref="movie_modal">
|
||||||
:movie="modal_movie"
|
<ShowMovie
|
||||||
:updating="updating"
|
v-if="modal_movie"
|
||||||
@close-modal="closeModal"
|
:movie="modal_movie"
|
||||||
@update-movie="updateMovie(modal_movie)"
|
:updating="updating"
|
||||||
></ShowMovie>
|
@close-modal="closeModal"
|
||||||
</Modal>
|
@update-movie="updateMovie(modal_movie)"
|
||||||
<h2 class="text-xl font-bold pb-5">{{ list.name }}</h2>
|
></ShowMovie>
|
||||||
<div
|
</Modal>
|
||||||
v-if="movies.length > 1 && !loading"
|
<h2 class="text-xl font-bold pb-5">{{ list.name }}</h2>
|
||||||
class="grid grid-cols-2 rounded movie-card neon-border p-5"
|
<div
|
||||||
>
|
v-if="movies.length > 1 && !loading"
|
||||||
<div>
|
class="grid grid-cols-2 rounded movie-card neon-border p-5"
|
||||||
<ul class="flex flex-row">
|
|
||||||
<li>
|
|
||||||
<label class="mr-2" for="hide_scheduled">Hide Scheduled</label>
|
|
||||||
<input
|
|
||||||
id="hide_scheduled"
|
|
||||||
v-model="hide_scheduled"
|
|
||||||
type="checkbox"
|
|
||||||
@change="hideScheduled"
|
|
||||||
/>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<input
|
|
||||||
v-model="movie_query"
|
|
||||||
class="p-1 rounded"
|
|
||||||
placeholder="Filter Movies"
|
|
||||||
type="text"
|
|
||||||
@input="filterMovies"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div v-if="movies.length < 1 && !loading" class="mt-10 flex gap-5 flex-col">
|
|
||||||
No Movies Found
|
|
||||||
<MovieQuote />
|
|
||||||
</div>
|
|
||||||
<!-- MOVIE LIST -->
|
|
||||||
<ul
|
|
||||||
v-else
|
|
||||||
class="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-2 mt-5"
|
|
||||||
>
|
|
||||||
<li
|
|
||||||
v-for="movie in filtered_movies"
|
|
||||||
:key="movie.poster"
|
|
||||||
class="rounded movie-card neon-border flex flex-col overflow-hidden"
|
|
||||||
>
|
>
|
||||||
<!-- POSTER -->
|
<div>
|
||||||
<MoviePoster
|
<ul class="flex flex-row">
|
||||||
:image="movie.poster"
|
<li>
|
||||||
class="flex-shrink-0"
|
<label class="mr-2" for="hide_scheduled">Hide Scheduled</label>
|
||||||
@click="showModal(movie)"
|
<input
|
||||||
/>
|
id="hide_scheduled"
|
||||||
<div class="p-5 flex flex-col justify-between flex-1">
|
v-model="hide_scheduled"
|
||||||
<!-- TITLE -->
|
type="checkbox"
|
||||||
<span class="font-bold text-center mb-1">{{ movie.title }}</span>
|
@change="hideScheduled"
|
||||||
<span
|
/>
|
||||||
v-if="logged_in"
|
</li>
|
||||||
class="text-center hover-pointer"
|
</ul>
|
||||||
@click="removeMovie(movie.imdb_id)"
|
|
||||||
>
|
|
||||||
X
|
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
</li>
|
<input
|
||||||
</ul>
|
v-model="movie_query"
|
||||||
|
class="p-1 rounded"
|
||||||
|
placeholder="Filter Movies"
|
||||||
|
type="text"
|
||||||
|
@input="filterMovies"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
v-if="movies.length < 1 && !loading"
|
||||||
|
class="mt-10 flex gap-5 flex-col"
|
||||||
|
>
|
||||||
|
No Movies Found
|
||||||
|
<MovieQuote />
|
||||||
|
</div>
|
||||||
|
<!-- MOVIE LIST -->
|
||||||
|
<ul
|
||||||
|
v-else
|
||||||
|
class="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-2 mt-5"
|
||||||
|
>
|
||||||
|
<li
|
||||||
|
v-for="movie in filtered_movies"
|
||||||
|
:key="movie.poster"
|
||||||
|
class="rounded movie-card neon-border flex flex-col overflow-hidden"
|
||||||
|
>
|
||||||
|
<!-- POSTER -->
|
||||||
|
<MoviePoster
|
||||||
|
:image="movie.poster"
|
||||||
|
class="flex-shrink-0"
|
||||||
|
@click="showModal(movie)"
|
||||||
|
/>
|
||||||
|
<div class="p-5 flex flex-col justify-between flex-1">
|
||||||
|
<!-- TITLE -->
|
||||||
|
<span class="font-bold text-center mb-1">{{ movie.title }}</span>
|
||||||
|
<span
|
||||||
|
v-if="logged_in"
|
||||||
|
class="text-center hover-pointer"
|
||||||
|
@click="removeMovie(movie.imdb_id)"
|
||||||
|
>
|
||||||
|
X
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -82,6 +88,7 @@ import Modal from "~/components/common/ui/Modal.vue";
|
||||||
import { useCookie } from "#app";
|
import { useCookie } from "#app";
|
||||||
import { $fetch } from "ofetch";
|
import { $fetch } from "ofetch";
|
||||||
import MoviePoster from "~/components/MoviePoster.vue";
|
import MoviePoster from "~/components/MoviePoster.vue";
|
||||||
|
import ScrollToTop from "~/components/common/navigation/ScrollToTop.vue";
|
||||||
|
|
||||||
const list_id = ref(0);
|
const list_id = ref(0);
|
||||||
const list = defineModel<MovieList>("movie_list", { default: [] });
|
const list = defineModel<MovieList>("movie_list", { default: [] });
|
||||||
|
@ -238,6 +245,7 @@ onMounted(() => {
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
if (typeof route.params.id === "string") {
|
if (typeof route.params.id === "string") {
|
||||||
const list_param: string = route.params.id;
|
const list_param: string = route.params.id;
|
||||||
|
|
||||||
list_id.value = parseInt(list_param);
|
list_id.value = parseInt(list_param);
|
||||||
getList(list_id.value);
|
getList(list_id.value);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue