[#142] distorted coverimage in global player

This commit is contained in:
amirhouieh 2023-08-30 18:35:49 +02:00
parent 312edca577
commit bcdbde0edb
6 changed files with 35 additions and 12 deletions

View File

@ -25,9 +25,11 @@ const ImageBlock = (props: Props) => {
type={BlockType.IMAGE} type={BlockType.IMAGE}
date={document?.modifiedAt ? new Date(document?.modifiedAt) : null} date={document?.modifiedAt ? new Date(document?.modifiedAt) : null}
/> />
<Typography variant={'body2'} component={'p'}> {data.alt.length > 0 && (
{data.alt} <Typography variant={'body2'} component={'p'}>
</Typography> {data.alt}
</Typography>
)}
<ContentBlockFooter data={document} order={order} /> <ContentBlockFooter data={document} order={order} />
</Container> </Container>
) )
@ -40,6 +42,10 @@ const Container = styled.div`
padding: 0 0; padding: 0 0;
position: relative; position: relative;
> a {
margin-bottom: 8px;
}
figure { figure {
margin: 0; margin: 0;
padding: 0; padding: 0;

View File

@ -108,6 +108,7 @@ const EpisodePlayer = ({
podcast: showTitle, podcast: showTitle,
url: url as string, url: url as string,
coverImage: coverImage ?? null, coverImage: coverImage ?? null,
path: router.asPath,
}) })
}, [title, showTitle, coverImage]) }, [title, showTitle, coverImage])

View File

@ -3,6 +3,7 @@ import { CloseIcon, Typography } from '@acid-info/lsd-react'
import styled from '@emotion/styled' import styled from '@emotion/styled'
import { useHookstate } from '@hookstate/core' import { useHookstate } from '@hookstate/core'
import Image from 'next/image' import Image from 'next/image'
import Link from 'next/link'
import React, { useEffect, useRef } from 'react' import React, { useEffect, useRef } from 'react'
import ReactPlayer from 'react-player' import ReactPlayer from 'react-player'
import { PlayerType } from '../LpePlayer/Controls/Controls' import { PlayerType } from '../LpePlayer/Controls/Controls'
@ -158,12 +159,17 @@ export default function GlobalAudioPlayer() {
<Thumbnail <Thumbnail
src={epState.value.coverImage.url} src={epState.value.coverImage.url}
alt={epState.value.coverImage.alt} alt={epState.value.coverImage.alt}
width={48}
height={48} height={48}
width={
48 *
(epState.value.coverImage.width / epState.value.coverImage.height)
}
/> />
)} )}
<EpisodeData> <EpisodeData href={epState.value.path} title={epState.value.title}>
<Typography variant="body2">{epState.value.title}</Typography> <Typography variant="body2" genericFontFamily={'serif'}>
{epState.value.title}
</Typography>
<Typography variant="body3">{epState.value.podcast}</Typography> <Typography variant="body3">{epState.value.podcast}</Typography>
</EpisodeData> </EpisodeData>
<CloseIconContainer> <CloseIconContainer>
@ -219,7 +225,6 @@ const Container = styled.div<{ visible: boolean }>`
const RightMenu = styled.div` const RightMenu = styled.div`
display: flex; display: flex;
width: 40%;
align-items: center; align-items: center;
justify-content: flex-end; justify-content: flex-end;
margin-left: 32px; margin-left: 32px;
@ -230,10 +235,17 @@ const RightMenu = styled.div`
} }
` `
const EpisodeData = styled.div` const EpisodeData = styled(Link)`
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 4px; text-decoration: none;
> :first-child {
width: 85%;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
@media (max-width: 768px) { @media (max-width: 768px) {
display: none !important; display: none !important;

View File

@ -6,6 +6,7 @@ export type EpisodeState = {
podcast: string podcast: string
url: string url: string
coverImage: LPE.Post.ImageBlock | null coverImage: LPE.Post.ImageBlock | null
path: string
} }
export const defaultEpisodeState: EpisodeState = { export const defaultEpisodeState: EpisodeState = {
@ -13,6 +14,7 @@ export const defaultEpisodeState: EpisodeState = {
podcast: '', podcast: '',
url: '', url: '',
coverImage: null, coverImage: null,
path: '',
} }
export const episodeState = export const episodeState =

View File

@ -11,7 +11,7 @@ export const uiConfigs = {
smallColumn: 2, smallColumn: 2,
}, },
searchResult: { searchResult: {
numberOfParagraphsShowInTopResult: 4, numberOfParagraphsShowInTopResult: 3,
numberOfImagesShowInTopResult: 3, numberOfImagesShowInTopResult: 3,
numberOfTotalBlocksInListView: 20, numberOfTotalBlocksInListView: 20,
}, },

View File

@ -1,8 +1,8 @@
import { siteConfigs } from '@/configs/site.configs'
import { LPE } from '@/types/lpe.types' import { LPE } from '@/types/lpe.types'
import { ImageResponse } from '@vercel/og' import { ImageResponse } from '@vercel/og'
import { handleMethodNotAllowedResponse } from 'next/dist/server/future/route-modules/helpers/response-handlers' import { handleMethodNotAllowedResponse } from 'next/dist/server/future/route-modules/helpers/response-handlers'
import { NextRequest } from 'next/server' import { NextRequest } from 'next/server'
import { siteConfigs } from '@/configs/site.configs'
export const config = { export const config = {
runtime: 'edge', runtime: 'edge',
@ -24,7 +24,9 @@ export default async function handler(request: NextRequest) {
const searchParams = new URL(href).searchParams const searchParams = new URL(href).searchParams
const contentType = searchParams.get('contentType') const contentType = searchParams.get('contentType')
const title = const title =
contentType == null ? 'LOGOS→PRESS ENGINE' : searchParams.get('title') contentType == null
? siteConfigs.heroTitle.join('')
: searchParams.get('title')
const image = searchParams.get('image') || '' const image = searchParams.get('image') || ''
const alt = searchParams.get('alt') || '' const alt = searchParams.get('alt') || ''
const pagePath = searchParams.get('pagePath') || 'press.logos.co' const pagePath = searchParams.get('pagePath') || 'press.logos.co'