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

[5.x] Improve addons listing #10812

Merged
merged 9 commits into from
Sep 19, 2024
78 changes: 37 additions & 41 deletions resources/js/components/AddonDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,48 +2,48 @@
<div>
<div class="flex items-center mb-6">
<h1 class="flex-1" v-text="addon.name" />
<a :href="addon.url" target="_blank" class="btn rtl:ml-4 ltr:mr-4" v-text="__('View on Marketplace')" />
<button v-if="addon.installed" class="btn" @click="showComposerInstructions" v-text="__('Uninstall')" />
<button v-else class="btn btn-primary" @click="showComposerInstructions" v-text="__('Install')" />
<a :href="addon.url" target="_blank" class="btn">
<svg-icon name="light/external-link" class="w-3 h-3 rtl:ml-2 ltr:mr-2 shrink-0" />
{{ __('View on Marketplace') }}
</a>
</div>
<confirmation-modal
v-if="modalOpen"
:cancellable="false"
:button-text="__('OK')"
@confirm="modalOpen = false"
>
<div class="prose">
<template v-if="addon.installed">
<p v-text="`${__('messages.addon_uninstall_command')}:`" />
<code-block copyable :text="`composer remove ${package}`" />
</template>
<template v-else>
<p v-text="`${__('messages.addon_install_command')}:`" />
<code-block copyable :text="installCommand" />
</template>
<p v-html="link"></p>
<div class="lg:grid lg:grid-cols-3 gap-6">
<div class="lg:col-span-2">
<div class="card prose max-w-full p-6" v-html="description" />
</div>
</confirmation-modal>
<div>
<div class="card mb-6 flex items-center">
<div class="flex-1 text-lg">
<div class="little-heading p-0 mb-2 text-gray-700" v-text="__('Price')" />
<div class="font-bold" v-text="priceRange" />
<div class="lg:col-span-1 flex flex-col space-y-6">
<div class="card flex flex-col space-y-6">
<div class="flex-1 text-lg">
<div class="little-heading p-0 mb-2 text-gray-700" v-text="__('Seller')" />
<a :href="addon.seller.website" target="_blank" class="relative flex items-center">
<img :src="addon.seller.avatar" :alt="addon.seller.name" class="rounded-full w-6 rtl:ml-2 ltr:mr-2">
<span class="font-bold">{{ addon.seller.name }}</span>
</a>
</div>
<div class="flex-1 text-lg">
<div class="little-heading p-0 mb-2 text-gray-700" v-text="__('Price')" />
<div class="font-bold" v-text="priceRange" />
</div>
<div class="flex-1 text-lg" v-if="downloads">
<div class="little-heading p-0 mb-2 text-gray-700" v-text="__('Downloads')" />
<div class="font-bold">{{ downloads }}</div>
</div>
</div>
<div class="flex-1 text-lg">
<div class="little-heading p-0 mb-2 text-gray-700" v-text="__('Seller')" />
<a :href="addon.seller.website" class="relative flex items-center">
<img :src="addon.seller.avatar" :alt="addon.seller.name" class="rounded-full w-6 rtl:ml-2 ltr:mr-2">
<span class="font-bold">{{ addon.seller.name }}</span>
</a>
</div>
<div class="flex-1 text-lg" v-if="downloads">
<div class="little-heading p-0 mb-2 text-gray-700" v-text="__('Downloads')" />
<div class="font-bold">{{ downloads }}</div>
<div class="card">
<div class="prose">
<template v-if="addon.installed">
<p v-text="`${__('messages.addon_uninstall_command')}:`" />
<code-block copyable :text="`composer remove ${package}`" />
</template>
<template v-else>
<p v-text="`${__('messages.addon_install_command')}:`" />
<code-block copyable :text="installCommand" />
</template>
<p v-html="link"></p>
</div>
</div>
<addon-editions v-if="addon.editions.length" :addon="addon" />
</div>
<addon-editions v-if="addon.editions.length" :addon="addon" />
<div class="card content p-8" v-html="description" />
</div>
</div>
</template>
Expand Down Expand Up @@ -121,10 +121,6 @@ import AddonEditions from './addons/Editions.vue';
this.downloads = response.data.package.downloads.total;
});
},

showComposerInstructions() {
this.modalOpen = true;
},
}
}
</script>
1 change: 1 addition & 0 deletions resources/views/addons/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

@extends('statamic::layout')
@section('title', __('Addons'))
@section('wrapper_class', 'max-w-full')
jasonvarga marked this conversation as resolved.
Show resolved Hide resolved

@section('content')

Expand Down
3 changes: 2 additions & 1 deletion src/Marketplace/AddonsQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ public function get()
$params = [
'page' => $this->page,
'search' => $this->search,
'filter' => ['statamic' => '3,4'],
'filter' => ['statamic' => '3,4,5'],
'sort' => 'most-popular',
];

if ($this->installed) {
Expand Down
Loading