feat: rendre le dépôt configurable via variables d'env #2
@@ -28,18 +28,19 @@ import AwtisBiyografi from './awtis-biyografi'
|
|||||||
import MizikLyen from './mizik-lyen'
|
import MizikLyen from './mizik-lyen'
|
||||||
|
|
||||||
const IMAGE_URL = process.env.NEXT_PUBLIC_API_URL_ROOT || 'http://localhost:1337'
|
const IMAGE_URL = process.env.NEXT_PUBLIC_API_URL_ROOT || 'http://localhost:1337'
|
||||||
|
const EXCLUSIVE_LABEL = process.env.NEXT_PUBLIC_EXCLUSIVE_ARTIST_LABEL || 'OKI Exclusif'
|
||||||
const BLUR_DATA_URL = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNsYAAAAAYAAjCB0C8AAAAASUVORK5CYII='
|
const BLUR_DATA_URL = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNsYAAAAAYAAjCB0C8AAAAASUVORK5CYII='
|
||||||
|
|
||||||
const sortTeks = paroles => paroles.sort((a, b) => a.titre.localeCompare(b.titre, 'fr', {sensitivity: 'base'}))
|
const sortTeks = paroles => paroles.sort((a, b) => a.titre.localeCompare(b.titre, 'fr', {sensitivity: 'base'}))
|
||||||
|
|
||||||
export default function AwtisDetay({anAwtis}) {
|
export default function AwtisDetay({anAwtis}) {
|
||||||
const [esByografiOuve, meteEsByografiOuve] = useState(false)
|
const [esByografiOuve, meteEsByografiOuve] = useState(false)
|
||||||
const {alias, biographie, paroles, photo, isOKIAwtis, titrePhare} = anAwtis
|
const {alias, biographie, paroles, photo, isExclusiveArtist, titrePhare} = anAwtis
|
||||||
const sortedTeks = sortTeks(paroles)
|
const sortedTeks = sortTeks(paroles)
|
||||||
const gwanBiyo = biographie && biographie.length > 100
|
const gwanBiyo = biographie && biographie.length > 100
|
||||||
const biyo = gwanBiyo ? `${biographie.slice(0, 100)}...` : biographie
|
const biyo = gwanBiyo ? `${biographie.slice(0, 100)}...` : biographie
|
||||||
|
|
||||||
const hasStreaming = isOKIAwtis && titrePhare?.streamAudio?.length > 0
|
const hasStreaming = isExclusiveArtist && titrePhare?.streamAudio?.length > 0
|
||||||
const coverUrl = titrePhare?.couverture
|
const coverUrl = titrePhare?.couverture
|
||||||
? `${IMAGE_URL}${titrePhare.couverture.formats?.small?.url || titrePhare.couverture.formats?.thumbnail?.url || titrePhare.couverture.url}`
|
? `${IMAGE_URL}${titrePhare.couverture.formats?.small?.url || titrePhare.couverture.formats?.thumbnail?.url || titrePhare.couverture.url}`
|
||||||
: null
|
: null
|
||||||
@@ -81,11 +82,11 @@ export default function AwtisDetay({anAwtis}) {
|
|||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
{isOKIAwtis && (
|
{isExclusiveArtist && (
|
||||||
<Box sx={{display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 0.75, mb: 2}}>
|
<Box sx={{display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 0.75, mb: 2}}>
|
||||||
<Chip
|
<Chip
|
||||||
icon={<VerifiedIcon sx={{fontSize: 16}} />}
|
icon={<VerifiedIcon sx={{fontSize: 16}} />}
|
||||||
label='Artiste OKI Exclusif'
|
label={`Artiste ${EXCLUSIVE_LABEL}`}
|
||||||
size='small'
|
size='small'
|
||||||
sx={{bgcolor: '#FFD700', color: '#000', fontWeight: 700, '& .MuiChip-icon': {color: '#000'}}}
|
sx={{bgcolor: '#FFD700', color: '#000', fontWeight: 700, '& .MuiChip-icon': {color: '#000'}}}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import AwtisBiyografi from './awtis-biyografi'
|
|||||||
const PREFIX = 'awtis-kat'
|
const PREFIX = 'awtis-kat'
|
||||||
const SITE_URL = process.env.NEXT_PUBLIC_SITE_URL || 'http://localhost:3001'
|
const SITE_URL = process.env.NEXT_PUBLIC_SITE_URL || 'http://localhost:3001'
|
||||||
const IMAGE_URL = process.env.NEXT_PUBLIC_API_URL_ROOT || 'http://localhost:1337'
|
const IMAGE_URL = process.env.NEXT_PUBLIC_API_URL_ROOT || 'http://localhost:1337'
|
||||||
|
const EXCLUSIVE_LABEL = process.env.NEXT_PUBLIC_EXCLUSIVE_ARTIST_LABEL || 'OKI Exclusif'
|
||||||
|
|
||||||
const classes = {
|
const classes = {
|
||||||
root: `${PREFIX}-root`,
|
root: `${PREFIX}-root`,
|
||||||
@@ -57,16 +58,16 @@ export default function AwtisKat({artiste}) {
|
|||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const [esByografiOuve, meteEsByografiOuve] = useState(false)
|
const [esByografiOuve, meteEsByografiOuve] = useState(false)
|
||||||
|
|
||||||
const {alias, biographie, paroles, photo, slug, isOKIAwtis} = artiste
|
const {alias, biographie, paroles, photo, slug, isExclusiveArtist} = artiste
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Grid size={{xs: 12, sm: 6, md: 4}}>
|
<Grid size={{xs: 12, sm: 6, md: 4}}>
|
||||||
<Kat>
|
<Kat>
|
||||||
<Card sx={{maxWidth: 340, position: 'relative', ...(isOKIAwtis && {outline: '2px solid #FFD700'})}}>
|
<Card sx={{maxWidth: 340, position: 'relative', ...(isExclusiveArtist && {outline: '2px solid #FFD700'})}}>
|
||||||
{isOKIAwtis && (
|
{isExclusiveArtist && (
|
||||||
<Chip
|
<Chip
|
||||||
icon={<VerifiedIcon sx={{fontSize: 14}} />}
|
icon={<VerifiedIcon sx={{fontSize: 14}} />}
|
||||||
label='OKI Exclusif'
|
label={EXCLUSIVE_LABEL}
|
||||||
size='small'
|
size='small'
|
||||||
sx={{
|
sx={{
|
||||||
position: 'absolute', top: 8, left: 8, zIndex: 1,
|
position: 'absolute', top: 8, left: 8, zIndex: 1,
|
||||||
|
|||||||
+1
-1
@@ -111,7 +111,7 @@ export async function jwennAwtisPajinasyon(paj) {
|
|||||||
const start = AWTIS_POU_CHAK_PAJ * (paj - 1)
|
const start = AWTIS_POU_CHAK_PAJ * (paj - 1)
|
||||||
const query = qs.stringify({
|
const query = qs.stringify({
|
||||||
populate: ['paroles', 'photo'],
|
populate: ['paroles', 'photo'],
|
||||||
sort: ['isOKIAwtis:desc', 'createdAt:desc'],
|
sort: ['isExclusiveArtist:desc', 'createdAt:desc'],
|
||||||
pagination: {
|
pagination: {
|
||||||
start,
|
start,
|
||||||
limit: AWTIS_POU_CHAK_PAJ
|
limit: AWTIS_POU_CHAK_PAJ
|
||||||
|
|||||||
Reference in New Issue
Block a user