Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge develop to main #13

Merged
merged 67 commits into from
Mar 8, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
c45444f
feat: add app routing
luc-mo Feb 27, 2023
57452e0
Merge pull request #3 from luc-mo/feature/add-app-routing
luc-mo Feb 28, 2023
b147a27
feature/add-home-header
Ch1py7 Feb 28, 2023
944311a
feature/add-body-content
Ch1py7 Feb 28, 2023
01b04ea
fix: modify header component, rename fonts and move background image …
luc-mo Mar 1, 2023
971afbc
fix: header index renaming
Ch1py7 Mar 1, 2023
6cbb817
Merge branch 'develop' into feature/add-home-header
Ch1py7 Mar 1, 2023
d7a289a
Merge pull request #4 from luc-mo/feature/add-home-header
Ch1py7 Mar 1, 2023
609d7e3
feat: ranking title added
Ch1py7 Mar 1, 2023
8b7952b
feat: add ranking item
Ch1py7 Mar 1, 2023
67ff328
fix: rename rank title folder
luc-mo Mar 2, 2023
478a6ad
Merge pull request #6 from luc-mo/feature/add-rank-title
luc-mo Mar 2, 2023
d6b4947
fix: remove ranking item count's extra letter, add string to place an…
luc-mo Mar 2, 2023
f7397bd
Merge pull request #5 from luc-mo/feature/add-ranking-list
luc-mo Mar 2, 2023
bd09d5b
feat: add carousel component, add arrow asset, add components folder …
luc-mo Mar 2, 2023
6fd6b67
Merge pull request #7 from luc-mo/feature/add-carousel-component
luc-mo Mar 2, 2023
75fbb7c
feat: add ranking list component
luc-mo Mar 2, 2023
ff91091
Merge pull request #8 from luc-mo/feature/add-ranking-list-component
Ch1py7 Mar 2, 2023
e1786b5
fix:add container for rankinglistitem, color palette adjust, quotatio…
Ch1py7 Mar 3, 2023
a34e458
Merge pull request #9 from luc-mo/fix/correct-components-styles
Ch1py7 Mar 3, 2023
76bf9e4
chore: add .env to .gitignore, add types folder, add absolute routes
luc-mo Mar 3, 2023
4168efe
feat: add firebase config and home context to switch ranking type
luc-mo Mar 3, 2023
97c449d
fix: correct firebase types (move external types outside namespace)
luc-mo Mar 4, 2023
c1c1f82
feat: add home page, add users global ranking
luc-mo Mar 4, 2023
39059cd
feat: add trophy component
luc-mo Mar 5, 2023
e4812ee
chore: modify firebase types, add ranking types, add hooks to absolut…
luc-mo Mar 5, 2023
486a1cd
build(deps): add dayjs package
luc-mo Mar 5, 2023
b013037
style: add raleway font, remove chantelli antiqua font, change page t…
luc-mo Mar 5, 2023
b6601d9
style: add box, font and title styles modules, add separator styles
luc-mo Mar 5, 2023
b4e8809
style: modify header styles, add users ranking title (user ranking st…
luc-mo Mar 5, 2023
60d8807
feat: add useRanking hook, add transformRanking util function, add in…
luc-mo Mar 5, 2023
9aa32d4
feat: replace local ranking state for useRanking hook, remove ranking…
luc-mo Mar 5, 2023
272a6ca
feat: add subranking component, add subrankings to home page
luc-mo Mar 5, 2023
94977c4
chore: add tab size and end of line to vscode settings, remove semico…
luc-mo Mar 5, 2023
016bfb5
feat: add trophy places, add cut ranking to prevent overflow
luc-mo Mar 6, 2023
b2eef80
feat: add fireflies background animation
luc-mo Mar 6, 2023
1ef4f2f
feat: add loading component
Mar 7, 2023
ed35ed0
feat: add loading component to sub ranking component
Mar 7, 2023
7e41eb9
Merge pull request #10 from luc-mo/feature/add-loading-component
Ch1py7 Mar 7, 2023
0164e88
fix: header width
Ch1py7 Mar 7, 2023
e105be1
feat: add card component
Ch1py7 Mar 7, 2023
e0f44a2
Merge pull request #12 from luc-mo/feature/add-card-component
luc-mo Mar 8, 2023
85ca0ac
feat: add winner image url to sub rankings
luc-mo Mar 8, 2023
0472c4d
Merge branch 'develop' of https://github.com/luc-mo/afordibot-web int…
luc-mo Mar 8, 2023
bca0d05
style: change card, carousel, and home style
Ch1py7 Mar 8, 2023
409df4c
chore: add cards to carousel component
Ch1py7 Mar 8, 2023
afaf33e
style: modify fireflies, header title, and loading styles, modify loa…
luc-mo Mar 8, 2023
257f147
feat: add winner image url to sub ranking
luc-mo Mar 8, 2023
e6f7574
feat: add trophy component to the first three ranking places, modify …
luc-mo Mar 8, 2023
ed8ad1e
feat: add footer component
Ch1py7 Mar 8, 2023
06bb6a0
chore: add footer to index page
Ch1py7 Mar 8, 2023
83cb49f
Merge branch 'develop' of https://github.com/luc-mo/afordibot-web int…
Ch1py7 Mar 8, 2023
7969588
feat: add random aflor and jolin to utils, correct import of jolines …
luc-mo Mar 8, 2023
454ab08
build(deps): add lottie react package
luc-mo Mar 8, 2023
83b5f9d
chore: add lottie json animations, remove unused react asset
luc-mo Mar 8, 2023
f16844c
feat: modify card, home and carousel component, remove gif assets
luc-mo Mar 8, 2023
99bf1e1
fix: correct footer tags
luc-mo Mar 8, 2023
518c7d9
feat: add rain component, add rain keyframes
Ch1py7 Mar 8, 2023
9b1292e
feat: add rain component to home page
Ch1py7 Mar 8, 2023
927cd37
feat: modify rain and fireflies components animation, move get random…
luc-mo Mar 8, 2023
a9b0165
style: modify separator background color
luc-mo Mar 8, 2023
4568ebc
feat: add ranking name to sub ranking to handle react keys
luc-mo Mar 8, 2023
99a6187
feat: modify user ranking list to use specific styles for top users
luc-mo Mar 8, 2023
b5b9a57
feat: add loading component to user ranking
luc-mo Mar 8, 2023
1fe6e89
feat: add ranking toggle button, modify ranking section minimum width
luc-mo Mar 8, 2023
f437b75
feat: add cards texts, modify sub ranking component, footer text, use…
luc-mo Mar 8, 2023
ba1e6b0
fix: modify footer title
luc-mo Mar 8, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/Fireflies/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export * from './Fireflies.component';
export * from './Fireflies.component'
export * as FirefliesStyles from './Fireflies.styles'
11 changes: 11 additions & 0 deletions src/components/Loading/Loading.component.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { FC, ReactElement } from 'react'
import * as S from './Loading.styles'

export const Loading: FC = (): ReactElement => {
return (
<S.Container>
<S.Loading />
<S.invLoading />
</S.Container>
)
}
29 changes: 29 additions & 0 deletions src/components/Loading/Loading.styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import styled from 'styled-components'
import { BoxStyles } from 'styles'

export const Container = styled.div`
position: relative;
${BoxStyles.CenterFlex}
width: 100%;
height: 100%;
`

export const Loading = styled.div`
position: absolute;
height: 40px;
width: 40px;
border: 4px solid;
border-radius: 100%;
border-color: #fff0 #af1155 #af1155 #af1155;
animation: loading 0.5s ease infinite;
`

export const invLoading = styled.div`
position: absolute;
height: 35px;
width: 35px;
border: 4px solid;
border-radius: 100%;
border-color: #fff0 #888 #888 #888;
animation: invLoading 0.5s ease infinite;
`
2 changes: 2 additions & 0 deletions src/components/Loading/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './Loading.component'
export * as LoadingStyles from './Loading.styles'
30 changes: 17 additions & 13 deletions src/components/SubRanking/SubRanking.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as S from './SubRanking.styles'
import { Trophy, TrophyStyles } from 'components/Trophy'
import { FC, ReactElement, useCallback, useMemo } from 'react'
import { Separator } from 'styles'
import { Loading } from 'components/Loading'

export interface SubRankingUser {
name: string
Expand All @@ -12,11 +13,12 @@ export interface SubRankingUser {
export interface SubRankingProps {
title: string
ranking: SubRankingUser[]
isLoaded: boolean
}

const places: TrophyStyles.TrophyPlaces[] = ['first', 'second', 'third']

export const SubRanking: FC<SubRankingProps> = ({ title, ranking }): ReactElement => {
export const SubRanking: FC<SubRankingProps> = ({ title, ranking, isLoaded }): ReactElement => {
const cutRanking = useMemo(() => ranking.slice(0, 3), [ranking])

const renderRanking = useCallback(
Expand All @@ -36,18 +38,20 @@ export const SubRanking: FC<SubRankingProps> = ({ title, ranking }): ReactElemen
return (
<S.SubRanking>
<S.SubRankingContent>
<S.SubRankingSection>
<S.SubRankingTitle>{title}</S.SubRankingTitle>
<Separator />
<S.SubRankingList>{cutRanking.map(renderRanking)}</S.SubRankingList>
</S.SubRankingSection>
<S.SubRankingSection centered>
<S.SubRankingImage
// TODO - add winner image
src='https://static-cdn.jtvnw.net/jtv_user_pictures/e600242f-ca1d-4941-85f2-8849c125dd6e-profile_image-70x70.png'
alt='winner'
/>
</S.SubRankingSection>
{isLoaded ? <>
<S.SubRankingSection>
<S.SubRankingTitle>{title}</S.SubRankingTitle>
<Separator />
<S.SubRankingList>{cutRanking.map(renderRanking)}</S.SubRankingList>
</S.SubRankingSection>
<S.SubRankingSection centered>
<S.SubRankingImage
// TODO - add winner image
src='https://static-cdn.jtvnw.net/jtv_user_pictures/e600242f-ca1d-4941-85f2-8849c125dd6e-profile_image-70x70.png'
alt='winner'
/>
</S.SubRankingSection>
</> : <Loading />}
</S.SubRankingContent>
</S.SubRanking>
)
Expand Down
7 changes: 5 additions & 2 deletions src/hooks/useRanking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,28 @@ import { RankingTypes } from 'types/ranking.types'

export interface UseRanking {
ranking: RankingTypes.User[]
isRankingLoaded: boolean
}

export const useRanking = (dbRef: FirebaseTypes.DatabaseRef): UseRanking => {
const [ranking, setRanking] = useState<RankingTypes.User[]>([])
const [isRankingLoaded, setIsRankingLoaded] = useState<boolean>(false)

const getRanking = useCallback(() => {
const usersRankingRef = ref(FirebaseConfig.database, dbRef)
const unsubscribe = onValue(usersRankingRef, (snapshot) => {
const data = snapshot.val() as FirebaseTypes.UserRanking
const users = Object.entries(data).map(([key, value]) => ({ name: key, ...value }))
if (!isRankingLoaded) setIsRankingLoaded(true)
setRanking(users)
})

return () => {
unsubscribe()
}
}, [dbRef])
}, [dbRef, isRankingLoaded])

useEffect(getRanking, [])

return { ranking }
return { ranking, isRankingLoaded }
}
10 changes: 10 additions & 0 deletions src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,14 @@
100% {
top: 105vh;
}
}

@keyframes loading {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}

@keyframes invLoading {
from { transform: rotate(0deg); }
to { transform: rotate(-360deg); }
}
20 changes: 16 additions & 4 deletions src/pages/Home/Home.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { FC, Fragment, ReactElement, useMemo, useState } from 'react'
import { transformRanking } from 'utils'

export const Home: FC = (): ReactElement => {
const { ranking: channelRanking } = useRanking('channels')
const { ranking: channelRanking, isRankingLoaded: isChannelLoaded } = useRanking('channels')
const { ranking: monthlyRanking } = useRanking('monthly')
const { ranking: weeklyRanking } = useRanking('weekly')
const [rankingType, setRankingType] = useState<HomeContextModule.RankingType>('jolines')
Expand All @@ -23,9 +23,21 @@ export const Home: FC = (): ReactElement => {
<S.RankingSection>
<UsersRanking />
<S.SubRankingSection>
<SubRanking title='Ranking por canales' ranking={transformSubRanking(channelRanking)} />
<SubRanking title='Ranking mensual' ranking={transformSubRanking(monthlyRanking)} />
<SubRanking title='Ranking semanal' ranking={transformSubRanking(weeklyRanking)} />
<SubRanking
title='Ranking por canales'
ranking={transformSubRanking(channelRanking)}
isLoaded={isChannelLoaded}
/>
<SubRanking
title='Ranking mensual'
ranking={transformSubRanking(monthlyRanking)}
isLoaded={isChannelLoaded}
/>
<SubRanking
title='Ranking semanal'
ranking={transformSubRanking(weeklyRanking)}
isLoaded={isChannelLoaded}
/>
</S.SubRankingSection>
</S.RankingSection>
</HomeContextModule.HomeContext.Provider>
Expand Down