Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
oien
Clouds - Firebase - Movies
Commits
83edabdd
Commit
83edabdd
authored
Feb 01, 2022
by
erlendoeien
Browse files
Add Wishlist search
parent
004a8759
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/views/Wishlist.vue
View file @
83edabdd
<
template
>
<TableView
title=
"Wishlist"
>
<Table
v-if=
"!isEmpty"
:loading=
"loading"
:data=
"filteredMovies"
:adminFunc=
"deleteWish"
isWishlist
<input
type=
"search"
placeholder=
"Title, year or genre"
v-model=
"searchQuery"
class=
"mb-4 w-1/2 self-center"
/>
<div
v-if=
"!isEmpty"
>
<Table
:loading=
"loading"
:data=
"filteredMovies"
:adminFunc=
"deleteWish"
isWishlist
/>
<Button
v-if=
"hasMore"
class=
"mx-auto"
@
click=
"loadMore"
>
Load more
</Button>
</div>
<div
v-else
>
<h3>
No movies in wishlist
</h3>
<Button
@
click=
"redirect"
>
Add new movies
</Button>
...
...
@@ -15,14 +18,20 @@
</
template
>
<
script
setup
lang=
"ts"
>
import
{
useRouter
}
from
"
vue-router
"
;
import
{
useWishlistMovies
,
useMovies
,
useWishlist
}
from
"
../hooks
"
;
import
{
useWishlistMovies
,
useMovies
,
useWishlist
,
useMatchedMovies
}
from
"
../hooks
"
;
import
Button
from
"
../components/Button.vue
"
;
import
Table
from
"
../components/Table.vue
"
;
import
TableView
from
"
../components/TableView.vue
"
;
const
{
movies
,
loading
}
=
useMovies
();
const
{
wishlist
,
deleteWish
,
isEmpty
}
=
useWishlist
();
const
{
wishlistFilteredMovies
:
filteredMovies
}
=
useWishlistMovies
(
movies
,
wishlist
,
true
);
const
{
wishlistFilteredMovies
}
=
useWishlistMovies
(
movies
,
wishlist
,
true
);
const
{
searchQuery
,
loadMore
,
hasMore
,
moviesMatchingSearchQuery
:
filteredMovies
,
}
=
useMatchedMovies
(
wishlistFilteredMovies
);
const
router
=
useRouter
();
const
redirect
=
()
=>
router
.
push
({
name
:
"
movies
"
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment