-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
37 changed files
with
2,744 additions
and
135 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
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
56 changes: 56 additions & 0 deletions
56
apps/web/src/app/(core)/[repo]/[id]/AudioPlayerSection/EpisodeProcessingBanner.tsx
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,56 @@ | ||
import stylex from "@stylexjs/stylex"; | ||
|
||
import { colours } from "@/styles/colours.stylex"; | ||
import { fontSizes, fontWeights, lineHeights } from "@/styles/fonts.stylex"; | ||
import { rounded } from "@/styles/rounded.stylex"; | ||
import { sizes } from "@/styles/sizes.stylex"; | ||
|
||
export function EpisodeProcessingBanner() { | ||
return ( | ||
<div {...stylex.props(styles.container)}> | ||
<p {...stylex.props(styles.title)}>Episode still processing</p> | ||
<p {...stylex.props(styles.description)}> | ||
Unfortunately you can't play this audio right now as | ||
we're still processing the episode. Please check back | ||
later! | ||
</p> | ||
</div> | ||
); | ||
} | ||
|
||
const DARK = "@media (prefers-color-scheme: dark)"; | ||
|
||
const styles = stylex.create({ | ||
container: { | ||
display: "flex", | ||
flexDirection: "column", | ||
padding: sizes.spacing4, | ||
borderRadius: rounded.lg, | ||
backgroundColor: { | ||
default: colours.violet200, | ||
[DARK]: colours.indigo900, | ||
}, | ||
border: 1, | ||
borderStyle: "solid", | ||
borderColor: { | ||
default: colours.violet400, | ||
[DARK]: colours.indigo500, | ||
}, | ||
}, | ||
|
||
title: { | ||
fontSize: fontSizes.lg, | ||
lineHeight: lineHeights.lg, | ||
fontWeight: fontWeights.semibold, | ||
}, | ||
|
||
description: { | ||
fontSize: fontSizes.base, | ||
lineHeight: lineHeights.base, | ||
|
||
color: { | ||
default: colours.gray700, | ||
[DARK]: colours.gray300, | ||
}, | ||
}, | ||
}); |
29 changes: 29 additions & 0 deletions
29
apps/web/src/app/(core)/[repo]/[id]/AudioPlayerSection/index.tsx
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,29 @@ | ||
import { AtUri } from "@atproto/api"; | ||
|
||
import { Episode, User, db } from "@atcast/models"; | ||
|
||
import { EpisodeProcessingBanner } from "@/app/(core)/[repo]/[id]/AudioPlayerSection/EpisodeProcessingBanner"; | ||
|
||
export async function AudioPlayerSection({ | ||
uri, | ||
user, | ||
internalEpisode: _, | ||
}: { | ||
uri: AtUri; | ||
user: User; | ||
internalEpisode: Episode; | ||
}) { | ||
const processRequests = await db.query.audioProcessRequests.findMany({ | ||
where: (audioProcessRequests, { and, eq }) => | ||
and( | ||
eq(audioProcessRequests.episodeId, uri.rkey), | ||
eq(audioProcessRequests.userId, user.id), | ||
), | ||
}); | ||
|
||
if (processRequests.length > 0) { | ||
return <EpisodeProcessingBanner />; | ||
} | ||
|
||
return null; | ||
} |
43 changes: 43 additions & 0 deletions
43
apps/web/src/app/(core)/[repo]/[id]/AudioPlayerSection/loading.tsx
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,43 @@ | ||
import stylex from "@stylexjs/stylex"; | ||
|
||
import { colours } from "@/styles/colours.stylex"; | ||
import { rounded } from "@/styles/rounded.stylex"; | ||
import { sizes } from "@/styles/sizes.stylex"; | ||
|
||
export function EpisodeTitleSectionLoading() { | ||
return ( | ||
<section {...stylex.props(styles.container)}> | ||
<div {...stylex.props(styles.audioPlayerSkeleton)} /> | ||
</section> | ||
); | ||
} | ||
|
||
const pulseAnimation = stylex.keyframes({ | ||
"0%, 100%": { | ||
opacity: 0.5, | ||
}, | ||
"50%": { | ||
opacity: 1, | ||
}, | ||
}); | ||
|
||
const DARK = "@media (prefers-color-scheme: dark)"; | ||
|
||
const styles = stylex.create({ | ||
container: { | ||
display: "flex", | ||
flexDirection: "column", | ||
gap: sizes.spacing4, | ||
}, | ||
|
||
audioPlayerSkeleton: { | ||
backgroundColor: { | ||
default: colours.gray100, | ||
[DARK]: colours.gray900, | ||
}, | ||
animation: `${pulseAnimation} 4s cubic-bezier(0.4, 0, 0.6, 1) infinite`, | ||
width: "100%", | ||
height: sizes.spacing40, | ||
borderRadius: rounded.lg, | ||
}, | ||
}); |
79 changes: 79 additions & 0 deletions
79
apps/web/src/app/(core)/[repo]/[id]/EpisodeTitleSection/index.tsx
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,79 @@ | ||
import { AtUri } from "@atproto/api"; | ||
import stylex from "@stylexjs/stylex"; | ||
|
||
import { LiveAtcastShowEpisode } from "@atcast/atproto"; | ||
|
||
import { createBskyClient } from "@/lib/api/bskyClient"; | ||
import { colours } from "@/styles/colours.stylex"; | ||
import { fontSizes, fontWeights, lineHeights } from "@/styles/fonts.stylex"; | ||
import { sizes } from "@/styles/sizes.stylex"; | ||
|
||
export async function EpisodeTitleSection({ | ||
uri, | ||
episode, | ||
}: { | ||
uri: AtUri; | ||
episode: LiveAtcastShowEpisode.Record; | ||
}) { | ||
await new Promise((resolve) => setTimeout(resolve, 5000)); | ||
|
||
const atprotoClient = createBskyClient(); | ||
|
||
const profileRecord = await atprotoClient.app.bsky.actor.getProfile({ | ||
actor: uri.host, | ||
}); | ||
|
||
return ( | ||
<section {...stylex.props(styles.container)}> | ||
<div {...stylex.props(styles.titleLine)}> | ||
<h2 {...stylex.props(styles.title)}>{episode.title}</h2> | ||
<p {...stylex.props(styles.authorSubtitle)}> | ||
On {profileRecord.data.displayName} | ||
</p> | ||
</div> | ||
|
||
{episode.description && ( | ||
<p {...stylex.props(styles.description)}> | ||
{episode.description} | ||
</p> | ||
)} | ||
</section> | ||
); | ||
} | ||
|
||
const DARK = "@media (prefers-color-scheme: dark)"; | ||
|
||
const styles = stylex.create({ | ||
container: { | ||
display: "flex", | ||
flexDirection: "column", | ||
gap: sizes.spacing4, | ||
}, | ||
|
||
titleLine: { | ||
display: "flex", | ||
gap: sizes.spacing2, | ||
alignItems: "center", | ||
}, | ||
|
||
title: { | ||
fontSize: fontSizes.xl, | ||
lineHeight: fontSizes.xl, | ||
}, | ||
|
||
authorSubtitle: { | ||
fontSize: fontSizes.sm, | ||
lineHeight: lineHeights.sm, | ||
color: colours.gray500, | ||
fontWeight: fontWeights.semibold, | ||
}, | ||
|
||
description: { | ||
fontSize: fontSizes.base, | ||
lineHeight: lineHeights.base, | ||
color: { | ||
default: colours.gray700, | ||
[DARK]: colours.gray300, | ||
}, | ||
}, | ||
}); |
57 changes: 57 additions & 0 deletions
57
apps/web/src/app/(core)/[repo]/[id]/EpisodeTitleSection/loading.tsx
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,57 @@ | ||
import stylex from "@stylexjs/stylex"; | ||
|
||
import { colours } from "@/styles/colours.stylex"; | ||
import { fontSizes } from "@/styles/fonts.stylex"; | ||
import { rounded } from "@/styles/rounded.stylex"; | ||
import { sizes } from "@/styles/sizes.stylex"; | ||
|
||
export function EpisodeTitleSectionLoading() { | ||
return ( | ||
<section {...stylex.props(styles.container)}> | ||
<div {...stylex.props(styles.titleSkeleton)} /> | ||
<div {...stylex.props(styles.descriptionSkeleton)} /> | ||
</section> | ||
); | ||
} | ||
|
||
const pulseAnimation = stylex.keyframes({ | ||
"0%, 100%": { | ||
opacity: 0.5, | ||
}, | ||
"50%": { | ||
opacity: 1, | ||
}, | ||
}); | ||
|
||
const DARK = "@media (prefers-color-scheme: dark)"; | ||
|
||
const styles = stylex.create({ | ||
container: { | ||
display: "flex", | ||
flexDirection: "column", | ||
gap: sizes.spacing4, | ||
}, | ||
|
||
titleSkeleton: { | ||
backgroundColor: { | ||
default: colours.gray100, | ||
[DARK]: colours.gray900, | ||
}, | ||
animation: `${pulseAnimation} 4s cubic-bezier(0.4, 0, 0.6, 1) infinite`, | ||
width: sizes.spacing40, | ||
height: fontSizes.xl, | ||
borderRadius: rounded.lg, | ||
}, | ||
|
||
descriptionSkeleton: { | ||
backgroundColor: { | ||
default: colours.gray100, | ||
[DARK]: colours.gray900, | ||
}, | ||
animation: `${pulseAnimation} 4s cubic-bezier(0.4, 0, 0.6, 1) infinite`, | ||
width: "100%", | ||
maxWidth: sizes.spacing96, | ||
height: sizes.spacing40, | ||
borderRadius: rounded.lg, | ||
}, | ||
}); |
Oops, something went wrong.