-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
### What's New - Player Replaced - Change User Photo and Username - "Keep Watching" Section on Home Page - History/Latests Watched Page ### Fixes - Minor Fixes on Css - Manga Page not Showing Error Message
- Loading branch information
Showing
37 changed files
with
1,677 additions
and
168 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
app/components/HomePage/KeepWatchingSection/component.module.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* KEEP WATCHING */ | ||
#keep_watching_container { | ||
width: 96%; | ||
|
||
margin: auto; | ||
|
||
margin-bottom: 32px; | ||
|
||
padding-top: 32px; | ||
|
||
justify-items: center; | ||
justify-content: center; | ||
|
||
} | ||
|
||
@media((min-width: 576px) and (max-width: 768px)) { | ||
#keep_watching_container { | ||
width: var(--breakpoint-sm); | ||
} | ||
} | ||
|
||
@media((min-width: 992px) and (max-width: 1200px)) { | ||
#keep_watching_container { | ||
width: var(--breakpoint-md); | ||
} | ||
} | ||
|
||
@media((min-width: 1201px) and (max-width: 1400px)) { | ||
#keep_watching_container { | ||
width: var(--breakpoint-xl); | ||
} | ||
} | ||
|
||
@media((min-width: 1441px)) { | ||
#keep_watching_container { | ||
width: var(--breakpoint-xxl); | ||
} | ||
} | ||
|
||
#keep_watching_container>h2 { | ||
font-size: var(--font-size--h3); | ||
|
||
color: var(--white-100); | ||
|
||
margin-bottom: 24px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
"use client" | ||
import React, { useEffect, useState } from 'react' | ||
import SwiperListContainer from '../../SwiperListContainer' | ||
import styles from "./component.module.css" | ||
import { AnimatePresence, motion } from 'framer-motion' | ||
import { getAuth } from 'firebase/auth' | ||
import { useAuthState } from 'react-firebase-hooks/auth' | ||
import { doc, getDoc, getFirestore } from 'firebase/firestore' | ||
import { initFirebase } from '@/firebase/firebaseApp' | ||
|
||
function KeepWatchingSection() { | ||
|
||
const auth = getAuth() | ||
|
||
const [user] = useAuthState(auth) | ||
|
||
const db = getFirestore(initFirebase()); | ||
|
||
const [watchingList, setWatchingList] = useState<KeepWatchingItem[]>([]) | ||
|
||
const motionVariants = { | ||
initial: { | ||
opacity: 0, | ||
height: 0 | ||
}, | ||
animate: { | ||
opacity: 1, | ||
height: "auto", | ||
transition: { | ||
staggerChildren: 0.1, | ||
}, | ||
} | ||
} | ||
|
||
async function getWatchingList() { | ||
|
||
const userDoc = await getDoc(doc(db, "users", user!.uid)) | ||
|
||
const watchingList = userDoc.get("keepWatching") | ||
|
||
let listFromObjectToArray = Object.keys(watchingList).map(key => { | ||
|
||
return watchingList[key] | ||
|
||
}) | ||
|
||
// removes any empty object | ||
listFromObjectToArray = listFromObjectToArray.filter(item => item.length != 0 && item) | ||
|
||
// sort by update date | ||
listFromObjectToArray = listFromObjectToArray.sort(function (x: KeepWatchingItem, y: KeepWatchingItem) { | ||
return x.updatedAt - y.updatedAt | ||
}).reverse() | ||
|
||
setWatchingList(listFromObjectToArray || null) | ||
|
||
} | ||
|
||
useEffect(() => { | ||
|
||
if (user) getWatchingList() | ||
|
||
}, [user]) | ||
|
||
return ( | ||
<AnimatePresence | ||
initial={false} | ||
> | ||
{(user && watchingList!.length > 0) && ( | ||
<motion.section | ||
id={styles.keep_watching_container} | ||
variants={motionVariants} | ||
initial={"initial"} | ||
animate={"animate"} | ||
> | ||
|
||
<h2>Keep Watching</h2> | ||
|
||
<div> | ||
|
||
<SwiperListContainer | ||
keepWatchingVariant={true} | ||
data={watchingList} | ||
/> | ||
|
||
</div> | ||
|
||
</motion.section> | ||
)} | ||
</AnimatePresence> | ||
) | ||
} | ||
|
||
export default KeepWatchingSection |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.