2024-05-16 15:53:42 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use Modules\Plugins\Core\PluginStatus;
|
|
|
|
|
|
|
|
?>
|
|
|
|
<article class="flex flex-col p-4 rounded-xl relative bg-elevated border-3 <?= $plugin->getStatus() === PluginStatus::ACTIVE ? 'border-accent-base' : 'border-subtle' ?>">
|
2024-05-09 17:55:41 +00:00
|
|
|
<div class="self-end -mb-6">
|
2024-05-16 15:53:42 +00:00
|
|
|
<?php if($plugin->getStatus() === PluginStatus::ACTIVE): ?>
|
|
|
|
<?php // @icon('check-fill')?>
|
2024-05-09 17:55:41 +00:00
|
|
|
<x-Pill variant="success" icon="check-fill" class="lowercase" size="small"><?= lang('Plugins.active') ?></x-Pill>
|
2024-05-16 15:53:42 +00:00
|
|
|
<?php elseif($plugin->getStatus() === PluginStatus::INACTIVE): ?>
|
|
|
|
<?php // @icon('close-fill')?>
|
2024-05-09 17:55:41 +00:00
|
|
|
<x-Pill variant="default" icon="close-fill" class="lowercase" size="small"><?= lang('Plugins.inactive') ?></x-Pill>
|
2024-05-16 15:53:42 +00:00
|
|
|
<?php elseif($plugin->getStatus() === PluginStatus::INVALID): ?>
|
|
|
|
<?php // @icon('alert-fill')?>
|
|
|
|
<x-Pill variant="warning" icon="alert-fill" class="lowercase" size="small"><?= lang('Plugins.invalid') ?></x-Pill>
|
2024-05-02 15:32:27 +00:00
|
|
|
<?php endif; ?>
|
2024-05-09 17:55:41 +00:00
|
|
|
</div>
|
2024-05-06 16:00:47 +00:00
|
|
|
<img class="rounded-full min-w-16 max-w-16 aspect-square" src="<?= $plugin->getIconSrc() ?>">
|
2024-05-15 18:30:56 +00:00
|
|
|
<div class="flex flex-col items-start mt-2 mb-6">
|
2024-06-08 18:30:36 +00:00
|
|
|
<h2 class="flex items-center text-xl font-bold font-display gap-x-2" title="<?= $plugin->getTitle() ?>"><a class="line-clamp-1" href="<?= route_to('plugins-view', $plugin->getVendor(), $plugin->getPackage()) ?>" class="hover:underline decoration-accent"><?= $plugin->getTitle() ?></a></h2>
|
2024-05-09 17:55:41 +00:00
|
|
|
<p class="inline-flex font-mono text-xs">
|
|
|
|
<span class="inline-flex tracking-wide bg-gray-100">
|
|
|
|
<a href="<?= route_to('plugins-vendor', $plugin->getVendor()) ?>" class="underline underline-offset-2 decoration-2 decoration-dotted hover:decoration-solid decoration-accent"><?= $plugin->getVendor() ?></a>
|
|
|
|
<span>/</span>
|
2024-05-13 16:17:18 +00:00
|
|
|
<a class="underline underline-offset-2 decoration-2 decoration-dotted hover:decoration-solid decoration-accent" href="<?= route_to('plugins-view', $plugin->getVendor(), $plugin->getPackage()) ?>"><?= $plugin->getPackage() ?></a></span>
|
2024-05-09 17:55:41 +00:00
|
|
|
<span class="mx-1">•</span><span class="px-1 font-mono text-xs"><?= $plugin->getVersion() ?></span>
|
|
|
|
</p>
|
2024-05-15 18:30:56 +00:00
|
|
|
<p class="relative w-full max-w-sm mt-2 text-skin-muted line-clamp-3"><?= $plugin->getDescription() ?? '<span class="absolute inset-0 px-2 m-auto text-sm lowercase shadow-sm w-fit h-fit bg-elevated">' . lang('Plugins.noDescription') . '</span><span class="block w-full h-4 mt-1 bg-gray-100"></span><span class="block w-full h-4 mt-1 bg-gray-100"></span><span class="block w-4/5 h-4 mt-1 bg-gray-100"></span>' ?></p>
|
2024-05-01 14:48:05 +00:00
|
|
|
</div>
|
2024-05-15 18:30:56 +00:00
|
|
|
<footer class="flex items-center justify-between mt-auto">
|
2024-05-09 17:55:41 +00:00
|
|
|
<div class="flex gap-x-2">
|
|
|
|
<?php if ($plugin->getHomepage()): ?>
|
|
|
|
<?php // @icon('earth-fill')?>
|
|
|
|
<x-IconButton glyph="earth-fill" uri="<?= $plugin->getHomepage() ?>" isExternal="true"><?= lang('Plugins.website') ?></x-IconButton>
|
|
|
|
<?php endif; ?>
|
|
|
|
<?php if ($plugin->getRepository()): ?>
|
|
|
|
<?php // @icon('git-repository-fill')?>
|
|
|
|
<x-IconButton glyph="git-repository-fill" uri="<?= $plugin->getRepository()->url ?>" isExternal="true"><?= lang('Plugins.repository') ?></x-IconButton>
|
|
|
|
<?php endif; ?>
|
|
|
|
</div>
|
2024-05-05 09:14:30 +00:00
|
|
|
<div class="flex gap-x-2">
|
2024-05-16 15:53:42 +00:00
|
|
|
<?php if($plugin->getStatus() === PluginStatus::ACTIVE): ?>
|
2024-05-13 16:17:18 +00:00
|
|
|
<form class="flex justify-end" method="POST" action="<?= route_to('plugins-deactivate', $plugin->getVendor(), $plugin->getPackage()) ?>">
|
2024-05-09 17:55:41 +00:00
|
|
|
<?= csrf_field() ?>
|
|
|
|
<x-Button type="submit" variant="danger" size="small"><?= lang('Plugins.deactivate') ?></x-Button>
|
|
|
|
</form>
|
2024-05-16 15:53:42 +00:00
|
|
|
<?php elseif($plugin->getStatus() === PluginStatus::INACTIVE): ?>
|
2024-05-13 16:17:18 +00:00
|
|
|
<form class="flex flex-col items-end justify-end gap-2" method="POST" action="<?= route_to('plugins-activate', $plugin->getVendor(), $plugin->getPackage()) ?>">
|
2024-05-09 17:55:41 +00:00
|
|
|
<?= csrf_field() ?>
|
|
|
|
<x-Button type="submit" variant="secondary" size="small"><?= lang('Plugins.activate') ?></x-Button>
|
|
|
|
</form>
|
|
|
|
<?php endif; ?>
|
2024-05-15 18:30:56 +00:00
|
|
|
<?php if ($plugin->getSettingsFields('general') !== []): ?>
|
2024-05-09 17:55:41 +00:00
|
|
|
<?php // @icon('equalizer-fill')?>
|
2024-05-15 18:30:56 +00:00
|
|
|
<x-IconButton uri="<?= route_to('plugins-settings-general', $plugin->getVendor(), $plugin->getPackage()) ?>" glyph="equalizer-fill"><?= lang('Plugins.settings') ?></x-IconButton>
|
2024-05-05 09:14:30 +00:00
|
|
|
<?php endif; ?>
|
|
|
|
<button class="p-2 rounded-full" id="more-dropdown-<?= $plugin->getKey() ?>" data-dropdown="button" data-dropdown-target="more-dropdown-<?= $plugin->getKey() ?>-menu" aria-haspopup="true" aria-expanded="false" title="<?= lang('Common.more') ?>"><?= icon('more-2-fill') ?></button>
|
2024-05-09 17:55:41 +00:00
|
|
|
<?php $items = [
|
|
|
|
[
|
|
|
|
'type' => 'link',
|
|
|
|
'title' => lang('Plugins.view'),
|
2024-05-13 16:17:18 +00:00
|
|
|
'uri' => route_to('plugins-view', $plugin->getVendor(), $plugin->getPackage()),
|
2024-05-09 17:55:41 +00:00
|
|
|
],
|
|
|
|
[
|
|
|
|
'type' => 'separator',
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'type' => 'link',
|
|
|
|
'title' => icon('delete-bin-fill', [
|
|
|
|
'class' => 'text-gray-500',
|
|
|
|
]) . lang('Plugins.uninstall'),
|
2024-05-13 16:17:18 +00:00
|
|
|
'uri' => route_to('plugins-uninstall', $plugin->getVendor(), $plugin->getPackage()),
|
2024-05-09 17:55:41 +00:00
|
|
|
'class' => 'font-semibold text-red-600',
|
|
|
|
],
|
|
|
|
]; ?>
|
|
|
|
<x-DropdownMenu id="more-dropdown-<?= $plugin->getKey() ?>-menu" labelledby="more-dropdown-<?= $plugin->getKey() ?>" placement="bottom-end" offsetY="-32" items="<?= esc(json_encode($items)) ?>" />
|
2024-05-05 09:14:30 +00:00
|
|
|
</div>
|
2024-05-01 14:48:05 +00:00
|
|
|
</footer>
|
|
|
|
</article>
|