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

🐛 Fix book titles in entity cards #412

Merged
merged 1 commit into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 apps/expo/src/components/book/BookListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const BookListItem = React.memo(({ book, navigate }: BookListItemProps) =
style={{ height: 50, objectFit: 'scale-down', width: 50 / (3 / 2) }}
/>
<View className="flex-1">
<Text size="sm">{book.name}</Text>
<Text size="sm">{book.metadata?.title || book.name}</Text>
</View>
</TouchableOpacity>
))
Expand Down
2 changes: 1 addition & 1 deletion packages/browser/src/components/book/BookCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export default function BookCard({
return (
<EntityCard
key={media.id}
title={media.name}
title={media.metadata?.title || media.name}
href={href}
fullWidth={fullWidth}
imageUrl={getMediaThumbnail(media.id)}
Expand Down
4 changes: 2 additions & 2 deletions packages/browser/src/scenes/book/BookOverviewScene.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export default function BookOverviewScene() {
const renderHeader = () => {
return (
<div className="flex flex-col items-center text-center md:items-start md:text-left">
<Heading size="sm">{media.name}</Heading>
<Heading size="sm">{media.metadata?.title || media.name}</Heading>

<BookLibrarySeriesLinks
libraryId={media.series?.library_id}
Expand All @@ -88,7 +88,7 @@ export default function BookOverviewScene() {
<SceneContainer>
<Suspense>
<Helmet>
<title>Stump | {media.name || ''}</title>
<title>Stump | {media.metadata?.title || media.name || ''}</title>
</Helmet>

<div className="flex h-full w-full flex-col gap-4">
Expand Down
6 changes: 4 additions & 2 deletions packages/browser/src/scenes/book/DownloadMediaButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,18 @@ type Props = {
export default function DownloadMediaButton({ media }: Props) {
const isAtLeastMedium = useMediaMatch('(min-width: 768px)')

const bookTitle = media.metadata?.title || media.name

const renderButton = () => {
if (isAtLeastMedium) {
return (
<IconButton size="sm" variant="ghost" title={`Download ${media.name}`}>
<IconButton size="sm" variant="ghost" title={`Download ${bookTitle}`}>
<DownloadCloud size="1.25rem" />
</IconButton>
)
} else {
return (
<Button className="w-full" variant="ghost" title={`Download ${media.name}`}>
<Button className="w-full" variant="ghost" title={`Download ${bookTitle}`}>
<DownloadCloud size="1.25rem" className="mr-2" /> Download Book
</Button>
)
Expand Down
Loading