Skip to content

Commit 3286534

Browse files
authored
New Notifications System, Broken URL redirects, and more
Merge pull request #51 from ErickLimaS/dev
2 parents 990cd83 + c436fae commit 3286534

File tree

29 files changed

+1142
-434
lines changed

29 files changed

+1142
-434
lines changed

README.md

Lines changed: 66 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,20 @@ Project of animes and mangas website, utilizing the AniList, Consumet and Aniwat
66

77
<p align="center">You can access this website on <a href='https://aniproject-dev.vercel.app/'>Vercel</a> or <a href='https://aniproject-website.onrender.com'>Render (really slow)</a>.</p>
88

9+
## Navigation
10+
11+
- [Features](#hammer-features)
12+
- [Under Development](#pushpin-under-development)
13+
- [Tecnologies Used](#heavy_check_mark-tecnologies-used)
14+
- [How Can i Run It](#computer-how-can-i-run-it)
15+
- [How Fireabase is Organized](#open_file_folder-how-firebase-is-organized)
16+
- [Authentication](#authentication)
17+
- [Collections and Documents](#collections-and-documents)
18+
- [Users](#users)
19+
- [Comments](#comments)
20+
- [Notifications](#notifications)
21+
- [Previews/Screenshots](#camera-previewscreenshots)
22+
923
## :hammer: Features
1024

1125
- [x] `Search`: Get a list of all animes and mangas you want using filters.
@@ -95,7 +109,57 @@ npm run dev
95109

96110
5. That's it! It should be running.
97111

98-
## :computer: Preview/Screenshots
112+
## :open_file_folder: How Firebase is Organized
113+
114+
### Authentication
115+
116+
With Firebase Authentication, theres 4 methods of Login/Signup:
117+
118+
- Email
119+
- Google
120+
- GitHub
121+
- Anonymous
122+
123+
It is used to store on User Document things like:
124+
125+
- User Profile Photo
126+
- Username
127+
- Preferences (media source, adult content, subtitles and more)
128+
- Comments
129+
- Notifications
130+
- Bookmarked Medias
131+
- Currently Watching Medias
132+
- Episodes Watched/Chapters Read
133+
134+
### Collections and Documents
135+
136+
With Firebase Database, we have 3 Collections:
137+
138+
#### Users
139+
140+
Stores only Users Documents after a successfull signup.
141+
142+
#### Comments
143+
144+
Stores comments made on episodes or on its main page.
145+
146+
Its separated based on Anilist API Media IDs Documents, and after that, a Collection that holds all comments to this media and other related to a episode where that comment was made.
147+
148+
It strongly depends on Users Collection, due to each comment needs its user (owner). Each comment has a referer to its owner and stores its interactions, with Likes and Dislikes.
149+
150+
When a Comment is made, it saves sort of a log on User Document, with infos like interactions with other comment or written on a episode.
151+
152+
#### Notifications
153+
154+
The Notifications Collections stores a document for each Media ID related to Anilist API every time a user assigned himself to be notified about a new episode release.
155+
156+
Each document has a Collection that holds every user assigned to receive a notification.
157+
158+
In this document, has info of all episodes already notified to any user and the next to be notified, cover art, if is complete, status and last update date.
159+
160+
- User Document Relation: After a successfull notification is deliveried to user, it stores the last episode info on User Document, so it can be notified again and the next one is released.
161+
162+
## :camera: Preview/Screenshots
99163

100164
### Home
101165

@@ -119,6 +183,7 @@ npm run dev
119183
![Watch Episode Page 2](https://github.com/ErickLimaS/anime-website/assets/69987890/62c3d7d0-809b-4e09-871e-6c9d2e809f71)
120184

121185
### Read Page
186+
122187
![Read Chapter Page 1](https://github.com/ErickLimaS/anime-website/assets/69987890/c1b07318-2923-49d6-a615-d80bd213f30e)
123188

124189
### Search/Filter Page

app/components/ButtonMarkChapterAsRead/index.tsx

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,13 @@ import styles from "./component.module.css"
1515
import { AnimatePresence, motion } from 'framer-motion'
1616

1717
type BtnTypes = {
18-
chapterId: string,
18+
chapterNumber: number,
1919
chapterTitle: string,
2020
mediaId: number,
21-
source: "mangadex",
2221
hasText?: boolean
2322
}
2423

25-
function ButtonMarkChapterAsRead({ chapterId, chapterTitle, mediaId, source, hasText }: BtnTypes) {
24+
function ButtonMarkChapterAsRead({ chapterNumber, chapterTitle, mediaId, hasText }: BtnTypes) {
2625

2726
const [wasChapterRead, setWasChapterRead] = useState<boolean>(false)
2827
const [isLoading, setIsLoading] = useState<boolean>(false)
@@ -40,12 +39,12 @@ function ButtonMarkChapterAsRead({ chapterId, chapterTitle, mediaId, source, has
4039

4140
if (!userDoc) return
4241

43-
const isOnChaptersList = userDoc.get("chaptersReadBySource")?.[source]
42+
const isOnChaptersList = userDoc.get("chaptersRead")
4443

4544
if (!isOnChaptersList) return
4645

4746
const chapterRead = isOnChaptersList[mediaId]?.find(
48-
(item: { chapterId: string }) => item.chapterId == chapterId
47+
(item: { chapterNumber: number }) => item.chapterNumber == chapterNumber
4948
)
5049

5150
if (chapterRead) setWasChapterRead(true)
@@ -62,17 +61,15 @@ function ButtonMarkChapterAsRead({ chapterId, chapterTitle, mediaId, source, has
6261
const episodeData = {
6362

6463
mediaId: mediaId,
65-
chapterId: chapterId,
64+
chapterNumber: chapterNumber,
6665
chapterTitle: chapterTitle
6766

6867
}
6968

7069
await setDoc(doc(db, 'users', user.uid),
7170
{
72-
chaptersReadBySource: {
73-
[source]: {
74-
[mediaId]: !wasChapterRead ? arrayUnion(...[episodeData]) : arrayRemove(...[episodeData])
75-
}
71+
chaptersRead: {
72+
[mediaId]: !wasChapterRead ? arrayUnion(...[episodeData]) : arrayRemove(...[episodeData])
7673
}
7774
} as unknown as FieldPath,
7875
{ merge: true }
@@ -90,7 +87,7 @@ function ButtonMarkChapterAsRead({ chapterId, chapterTitle, mediaId, source, has
9087

9188
checkChapterMarkedAsRead()
9289

93-
}, [user, source, chapterId])
90+
}, [user, chapterNumber])
9491

9592
return (
9693

app/components/ButtonMarkEpisodeAsWatched/index.tsx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,14 @@ import { AnimatePresence, motion } from 'framer-motion'
1414
import { SourceType } from '@/app/ts/interfaces/episodesSourceInterface'
1515

1616
type BtnTypes = {
17-
episodeId: string,
17+
episodeNumber: number,
1818
episodeTitle: string,
1919
mediaId: number,
20-
source: SourceType["source"],
2120
hasText?: boolean,
2221
wasWatched?: boolean
2322
}
2423

25-
function ButtonMarkEpisodeAsWatched({ episodeId, episodeTitle, mediaId, source, wasWatched, hasText }: BtnTypes) {
24+
function ButtonMarkEpisodeAsWatched({ episodeNumber, episodeTitle, mediaId, wasWatched, hasText }: BtnTypes) {
2625

2726
const [wasEpisodeWatched, setWasEpisodeWatched] = useState<boolean>(wasWatched || false)
2827
const [isLoading, setIsLoading] = useState<boolean>(false)
@@ -43,18 +42,17 @@ function ButtonMarkEpisodeAsWatched({ episodeId, episodeTitle, mediaId, source,
4342
const episodeData = {
4443

4544
mediaId: mediaId,
46-
episodeId: episodeId, // crunchyroll has no ID for episodes, so it will be used its title
45+
episodeNumber: episodeNumber,
4746
episodeTitle: episodeTitle
4847

4948
}
5049

5150
await setDoc(doc(db, 'users', user.uid),
5251
{
53-
episodesWatchedBySource: {
54-
[source]: {
55-
[mediaId]: wasEpisodeWatched ? arrayRemove(...[episodeData]) : arrayUnion(...[episodeData])
56-
}
52+
episodesWatched: {
53+
[mediaId]: wasEpisodeWatched ? arrayRemove(...[episodeData]) : arrayUnion(...[episodeData])
5754
}
55+
5856
} as unknown as FieldPath,
5957
{ merge: true }
6058
).then(() =>

app/components/CardMediaCoverAndDescription/component.module.css

Lines changed: 77 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@
6767

6868
margin: 24px auto;
6969

70+
position: relative;
71+
7072
}
7173

7274
@media(min-width: 580px) {
@@ -80,6 +82,13 @@
8082
}
8183
}
8284

85+
.item_info_container.watch_page_custom_margin {
86+
87+
margin: 24px auto;
88+
89+
}
90+
91+
8392
.item_info_container>small {
8493
display: block;
8594
font-size: var(--font-size--small-2);
@@ -100,7 +109,7 @@
100109
}
101110

102111
.item_info_container>p,
103-
.item_info_container span.paragrath_container {
112+
.item_info_container p.paragrath_container {
104113

105114
color: var(--white-100);
106115

@@ -110,6 +119,73 @@
110119
-webkit-box-orient: vertical;
111120
-webkit-line-clamp: 4;
112121
overflow: hidden;
122+
123+
}
124+
125+
.item_info_container p.paragrath_container.watch_page_custom_line_limit {
126+
127+
color: var(--white-100);
128+
129+
font-size: var(--font-size--small-1);
130+
131+
display: -webkit-box;
132+
-webkit-box-orient: vertical;
133+
-webkit-line-clamp: 6;
134+
overflow: hidden;
135+
136+
}
137+
138+
/* CHECKBOX EXPAND */
139+
input.expand_description {
140+
141+
cursor: pointer;
142+
143+
appearance: none;
144+
145+
position: absolute;
146+
bottom: 0;
147+
148+
padding: 4px;
149+
150+
width: 100%;
151+
152+
background: var(--black-50);
153+
border-radius: 2px;
154+
155+
text-align: center;
156+
color: var(--white-75);
157+
font-family: var(--font-family-sans-sarif);
158+
font-weight: 600;
159+
160+
}
161+
162+
input.expand_description:hover {
163+
164+
color: var(--white-100);
165+
166+
}
167+
168+
input.expand_description::before {
169+
170+
appearance: none;
171+
172+
content: "See More";
173+
174+
}
175+
176+
input.expand_description:checked::before {
177+
178+
content: "See Less";
179+
180+
}
181+
182+
/* EXPAND DESCRIPTION */
183+
.expand_description:checked+p.paragrath_container {
184+
185+
margin-bottom: 36px;
186+
187+
-webkit-line-clamp: initial;
188+
113189
}
114190

115191
.item_info_container .buttons_container {

app/components/CardMediaCoverAndDescription/index.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function CardMediaCoverAndDescription({ data, customDescription, showButtons }:
2121
></Image>
2222
</Link>
2323

24-
<div className={styles.item_info_container}>
24+
<div className={`${styles.item_info_container} ${customDescription ? styles.watch_page_custom_margin : ""}`}>
2525

2626
{(data.seasonYear && (
2727
<small>{data.seasonYear}</small>
@@ -30,9 +30,14 @@ function CardMediaCoverAndDescription({ data, customDescription, showButtons }:
3030
<h4><Link href={`/media/${data.id}`}>{data.title && data.title.romaji || data.title.native}</Link></h4>
3131

3232
{data.description && (
33-
<span className={styles.paragrath_container}>
34-
{customDescription || parse(data?.description) || "Description Not Available"}
35-
</span>
33+
<React.Fragment>
34+
{customDescription && (
35+
<input type='checkbox' className={styles.expand_description} />
36+
)}
37+
<p className={`${styles.paragrath_container} ${customDescription ? styles.watch_page_custom_line_limit : ""}`}>
38+
{customDescription || parse(data?.description) || "Description Not Available"}
39+
</p>
40+
</React.Fragment>
3641
)}
3742

3843
{showButtons == undefined && (

app/components/CommentSectionContainer/component.module.css

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,11 @@
7373

7474
#write_comment_container form label textarea {
7575

76+
resize: vertical;
77+
7678
padding: 8px;
7779

80+
border: 0;
7881
border-radius: 8px;
7982

8083
margin: 8px 0;
@@ -100,9 +103,9 @@
100103

101104
#write_comment_container form label textarea:focus {
102105

103-
border-radius: 4px;
104-
outline-width: 1px;
105-
outline-style: inset;
106+
border-radius: 8px;
107+
outline-width: 2px;
108+
outline-style: outset;
106109
outline-color: var(--brand-color);
107110

108111
}

app/components/CommentSectionContainer/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ function CommentSectionContainer({ media, onWatchPage, episodeId, episodeNumber
333333
{(comments.length == 0 && !isLoading) && (
334334
<div id={styles.no_comments_container}>
335335

336-
<p>No Comments Yet.</p>
336+
<p>No Comments Yet</p>
337337

338338
</div>
339339
)}

0 commit comments

Comments
 (0)