feat: new nav
This commit is contained in:
1 parent
5733bc0af0
commit
750d5b12c8
25 files changed
+386
-325
No files matched your search
@@ -6,5 +6,12 @@ import List from '@/components/Movie/List';
|
||||
export default function Container() {
|
||||
const { pages } = useFavorites();
|
||||
|
||||
if (!pages[0]?.results?.length)
|
||||
return (
|
||||
<div className='h-40 w-full flex items-center justify-center text-xl text-muted-foreground'>
|
||||
There are no items in your favorites list
|
||||
</div>
|
||||
);
|
||||
|
||||
return <List pages={pages} />;
|
||||
}
|
||||
@@ -1,5 +1,13 @@
|
||||
import { Metadata } from 'next';
|
||||
|
||||
import Container from './container';
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: 'My Favorite Shows - Movie Advisor',
|
||||
description:
|
||||
'View your favorite shows on Movie Advisor. Keep track of films you’ve added and revisit your top picks anytime.'
|
||||
};
|
||||
|
||||
export default function Favorites() {
|
||||
return <Container />;
|
||||
}
|
||||
@@ -43,4 +43,15 @@ export const useFavoritesMutation = () => {
|
||||
};
|
||||
};
|
||||
|
||||
export const useFavoriteToggle = (movie: Movie) => {
|
||||
const { add, remove } = useFavoritesMutation();
|
||||
const { map } = useFavorites();
|
||||
|
||||
const isFavorite = map.has(movie.id);
|
||||
|
||||
const toggle = () => (isFavorite ? remove(movie.id) : add(movie));
|
||||
|
||||
return { isFavorite, toggle };
|
||||
};
|
||||
|
||||
export default useFavorites;
|
||||
Reference in new issue
Block a user