mirror of
https://code.castopod.org/adaures/castopod
synced 2025-05-10 16:25:47 +00:00

- configure service-worker using vite-plugin-pwa - refactor Image entity to generate images of different types based on size config - add requirement for webp library for php gd to generate webp images for instance - add action to regenerate all instance images for eventual Images config changes - enhance google lighthouse metrics for pwa
48 lines
2.1 KiB
PHP
48 lines
2.1 KiB
PHP
<?php declare(strict_types=1);
|
|
|
|
if ($preview_card->type === 'image'): ?>
|
|
<a href="<?= $preview_card->url ?>" class="flex flex-col bg-highlight" target="_blank" rel="noopener noreferrer">
|
|
<?php if ($preview_card->image): ?>
|
|
<div class="relative group">
|
|
<?= icon(
|
|
'external-link',
|
|
'absolute inset-0 m-auto text-6xl bg-accent-base bg-opacity-50 group-hover:bg-opacity-100 text-accent-contrast rounded-full p-2',
|
|
) ?>
|
|
<img src="<?= $preview_card->image ?>" alt="<?= $preview_card->title ?>" class="object-cover w-full aspect-video" />
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<div class="flex flex-col flex-1 px-4 py-2">
|
|
<span class="text-xs tracking-wider uppercase text-skin-muted"><?= $preview_card->provider_name ?></span>
|
|
</div>
|
|
</a>
|
|
<?php elseif ($preview_card->type === 'video'): ?>
|
|
<a href="<?= $preview_card->url ?>" class="flex flex-col bg-highlight" target="_blank" rel="noopener noreferrer">
|
|
<?php if ($preview_card->image): ?>
|
|
<div class="relative group">
|
|
<?= icon(
|
|
'play',
|
|
'absolute inset-0 m-auto text-6xl bg-accent-base bg-opacity-50 group-hover:bg-opacity-100 text-accent-contrast rounded-full p-2',
|
|
) ?>
|
|
<img class="object-cover w-full aspect-video" src="<?= $preview_card->image ?>" alt="<?= $preview_card->title ?>" />
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<div class="flex flex-col flex-1 px-4 py-2">
|
|
<span class="text-xs tracking-wider uppercase text-skin-muted"><?= $preview_card->provider_name ?></span>
|
|
<span class="mb-2 font-semibold truncate"><?= $preview_card->title ?></span>
|
|
</div>
|
|
</a>
|
|
<?php else: ?>
|
|
<a href="<?= $preview_card->url ?>" class="flex items-center bg-highlight">
|
|
<?php if ($preview_card->image): ?>
|
|
<img src="<?= $preview_card->image ?>" alt="<?= $preview_card->title ?>" class="object-cover w-20 aspect-square" />
|
|
<?php endif; ?>
|
|
<p class="flex flex-col flex-1 px-4 py-2">
|
|
<span class="text-xs tracking-wider uppercase text-skin-muted"><?= $preview_card->provider_name ?></span>
|
|
<span class="mb-2 font-semibold truncate"><?= $preview_card->title ?></span>
|
|
</p>
|
|
</a>
|
|
<?php endif;
|
|
?>
|