Skip to content

Commit

Permalink
feat(#176): add general ending card for rewind
Browse files Browse the repository at this point in the history
resolves #176
  • Loading branch information
RaunoT committed Jul 30, 2024
1 parent ec4ffa9 commit e2c79d6
Show file tree
Hide file tree
Showing 11 changed files with 121 additions and 40 deletions.
4 changes: 2 additions & 2 deletions src/app/_components/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export default function Home({ settings }: Props) {
</div>
)}

<h1 className='animate-fade-up animation-delay-300 mb-6 text-[2.5rem] font-bold leading-none'>
<h1 className='animate-fade-up mb-6 text-[2.5rem] font-bold leading-none animation-delay-300'>
<Image
src={plexSvg}
className='mb-0.5 mr-3 inline h-[2.25rem] w-auto'
Expand All @@ -128,7 +128,7 @@ export default function Home({ settings }: Props) {
<span>rewind</span>
</h1>

<div className='animate-fade-in animation-delay-600'>
<div className='animate-fade-in animation-delay-700'>
{!isLoggedIn && (
<button
className='button button-sm button--plex mx-auto'
Expand Down
4 changes: 2 additions & 2 deletions src/app/rewind/_components/RewindStat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ function Loader() {
animate='show'
>
<span className='size-1 animate-pulse rounded-full bg-white'></span>
<span className='animation-delay-300 size-1 animate-pulse rounded-full bg-white'></span>
<span className='animation-delay-600 size-1 animate-pulse rounded-full bg-white'></span>
<span className='size-1 animate-pulse rounded-full bg-white animation-delay-300'></span>
<span className='size-1 animate-pulse rounded-full bg-white animation-delay-700'></span>
</motion.div>
)
}
2 changes: 2 additions & 0 deletions src/app/rewind/_components/RewindStories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import Stories from 'stories-react'
import 'stories-react/dist/index.css'
import StoryAudio from './Stories/Audio'
import StoryAudioTop from './Stories/AudioTop'
import StoryGoodbye from './Stories/Goodbye'
import StoryLibraries from './Stories/Libraries'
import StoryMovies from './Stories/Movies'
import StoryMoviesTop from './Stories/MoviesTop'
Expand Down Expand Up @@ -88,6 +89,7 @@ export default function RewindStories({ userRewind, settings }: Props) {
...(userRewind.audio.count && hasAudioLibraries
? [createStory(StoryAudioTop, 8000)]
: []),
createStory(StoryGoodbye, 11000),
]

return (
Expand Down
3 changes: 1 addition & 2 deletions src/app/rewind/_components/Stories/Audio.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default function StoryAudio({
Audio
<MusicalNoteIcon />
</span>{' '}
on <span className='gradient-plex'>Plex</span>.
on <span className='gradient-plex'>Plex.</span>
</p>
</RewindStat>

Expand All @@ -49,7 +49,6 @@ export default function StoryAudio({
<span className='rewind-cat'>
{userRewind.audio.top[0].title}
</span>
!
</p>

<div className='text-base not-italic'>
Expand Down
77 changes: 77 additions & 0 deletions src/app/rewind/_components/Stories/Goodbye.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import { RewindStory } from '@/types'
import {
FilmIcon,
MusicalNoteIcon,
PlayCircleIcon,
} from '@heroicons/react/24/outline'
import RewindStat from '../RewindStat'
import StoryWrapper from '../StoryWrapper'

export default function StoryGoodbye({
userRewind,
isPaused,
pause,
resume,
}: RewindStory) {
return (
<StoryWrapper isPaused={isPaused} pause={pause} resume={resume}>
<RewindStat scaleDelay={2} isPaused={isPaused}>
<p>
Thanks for tuning into your{' '}
<span className='whitespace-nowrap'>
<span className='gradient-plex'>Plex Rewind</span>,
</span>{' '}
<span className='whitespace-nowrap'>
<span className='rewind-cat'>{userRewind.user.name}!</span>
</span>
</p>
</RewindStat>
<RewindStat renderDelay={2} scaleDelay={4} isPaused={isPaused}>
<p>
From your favorite{' '}
{userRewind.movies.duration && (
<span className='rewind-cat'>
Movies
<FilmIcon />
</span>
)}{' '}
to the most entertaining{' '}
{userRewind.shows.duration && (
<span className='rewind-cat'>
Shows
<PlayCircleIcon />
</span>
)}
{userRewind.audio.duration && (
<>
{' '}
and memorable{' '}
<span className='rewind-cat'>
Tracks
<MusicalNoteIcon />
</span>
</>
)}
, it&apos;s been a year to remember.
</p>
</RewindStat>
<RewindStat
renderDelay={6}
scaleDelay={3}
loaderDelay={2}
isPaused={isPaused}
>
<p>
We&apos;ll be back next year with even more{' '}
<span className='rewind-cat'>insights and stats.</span>
</p>
</RewindStat>
<RewindStat renderDelay={9} loaderDelay={6} isPaused={isPaused} noScale>
<p>
Until then, keep exploring and enjoying all that{' '}
<span className='gradient-plex'>Plex</span> has to offer.
</p>
</RewindStat>
</StoryWrapper>
)
}
3 changes: 1 addition & 2 deletions src/app/rewind/_components/Stories/Libraries.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@ export default function StoryLibraries({
<span className='gradient-plex'>Plex</span> is{' '}
<span className='whitespace-nowrap'>
<span className='rewind-stat'>
{bytesToSize(userRewind.libraries_total_size)}
{bytesToSize(userRewind.libraries_total_size)}!
</span>
!
</span>
</p>
</RewindStat>
Expand Down
3 changes: 1 addition & 2 deletions src/app/rewind/_components/Stories/Movies.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default function StoryMovies({
Movies
<FilmIcon />
</span>{' '}
on <span className='gradient-plex'>Plex</span>.
on <span className='gradient-plex'>Plex.</span>
</p>
</RewindStat>

Expand All @@ -46,7 +46,6 @@ export default function StoryMovies({
<span className='rewind-cat'>
{userRewind.movies.top[0].title}
</span>
!
</p>

<div className='text-base not-italic'>
Expand Down
3 changes: 1 addition & 2 deletions src/app/rewind/_components/Stories/Shows.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default function StoryShows({
<span className='rewind-stat'>
{userRewind.shows.duration}
</span>{' '}
of your time on <span className='gradient-plex'>Plex</span>.
of your time on <span className='gradient-plex'>Plex.</span>
</p>
</RewindStat>

Expand All @@ -48,7 +48,6 @@ export default function StoryShows({
<span className='rewind-cat'>
{userRewind.shows.top[0].title}
</span>
!
</p>

<div className='text-base not-italic'>
Expand Down
7 changes: 3 additions & 4 deletions src/app/rewind/_components/Stories/Welcome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,16 @@ export default function StoryWelcome({
priority
/>
</div>
<p className='animate-fade-up animation-delay-600 mb-4'>
<p className='animate-fade-up mb-4 animation-delay-500'>
Welcome to your{' '}
<span className='whitespace-nowrap'>
<span className='gradient-plex'>Plex Rewind</span>,
</span>{' '}
<span className='whitespace-nowrap'>
<span className='rewind-cat'>{userRewind.user.name}</span>!
<span className='rewind-cat'>{userRewind.user.name}!</span>
</span>
</p>
{/* TODO: animate in a second later */}
<p className='animate-fade-up animation-delay-2000'>
<p className='animate-fade-up animation-delay-[2000ms]'>
Let&apos;s get started!
</p>
</RewindStat>
Expand Down
17 changes: 4 additions & 13 deletions src/styles/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,10 @@
.animate-fade-up {
@apply opacity-0;

animation: fade-up 0.5s ease forwards;
animation-name: fade-up;
animation-duration: 0.5s;
animation-timing-function: ease;
animation-fill-mode: forwards;

@keyframes fade-up {
from {
Expand Down Expand Up @@ -297,18 +300,6 @@
}
}
}

.animation-delay-300 {
animation-delay: 0.3s;
}

.animation-delay-600 {
animation-delay: 0.6s;
}

.animation-delay-2000 {
animation-delay: 2s;
}
}

input::-webkit-outer-spin-button,
Expand Down
38 changes: 27 additions & 11 deletions tailwind.config.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,31 @@
/** @type {import('tailwindcss').Config} */
import plugin from 'tailwindcss/plugin'

/** https://tailwindcss.com/docs/configuration */
module.exports = {
content: [
'./src/components/**/*.{js,ts,jsx,tsx,mdx}',
'./src/app/**/*.{js,ts,jsx,tsx,mdx}',
],
theme: {
container: {
center: true,
padding: '1rem',
},
export const content = [
'./src/components/**/*.{js,ts,jsx,tsx,mdx}',
'./src/app/**/*.{js,ts,jsx,tsx,mdx}',
]
export const theme = {
container: {
center: true,
padding: '1rem',
},
plugins: [require('@tailwindcss/forms')],
}
export const plugins = [
require('@tailwindcss/forms'),
plugin(({ matchUtilities, theme }) => {
matchUtilities(
{
'animation-delay': (value) => {
return {
'animation-delay': value,
}
},
},
{
values: theme('transitionDelay'),
},
)
}),
]

0 comments on commit e2c79d6

Please sign in to comment.