-
Notifications
You must be signed in to change notification settings - Fork 638
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '4.x' of https://github.com/craftcms/cms into 5.x
# Conflicts: # src/translations/en/app.php # src/web/assets/pluginstore/PluginStoreAsset.php # src/web/assets/pluginstore/dist/css/app.css # src/web/assets/pluginstore/dist/css/app.css.map # src/web/assets/pluginstore/dist/js/app.js # src/web/assets/pluginstore/dist/js/app.js.map
- Loading branch information
Showing
22 changed files
with
982 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
105 changes: 105 additions & 0 deletions
105
src/web/assets/pluginstore/src/js/components/PluginRatingStat.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
<script> | ||
/* global Craft */ | ||
import {defineComponent} from 'vue'; | ||
import Stat from './Stat.vue'; | ||
import RatingStars from './RatingStars.vue'; | ||
export default defineComponent({ | ||
components: { | ||
RatingStars, | ||
Stat, | ||
}, | ||
name: 'PluginRatingStat', | ||
methods: { | ||
getPluginReviewUrl(handle) { | ||
if (!handle) { | ||
return ''; | ||
} | ||
return `https://console.craftcms.com/accounts/me/plugin-store/reviews/${this.plugin.handle}`; | ||
}, | ||
}, | ||
computed: { | ||
headingText() { | ||
return Craft.t( | ||
'app', | ||
'{totalReviews, plural, =1{# Review} other{# Reviews}}', | ||
{ | ||
totalReviews: this.stats.totalReviews, | ||
} | ||
); | ||
}, | ||
}, | ||
props: { | ||
stats: Object, | ||
plugin: Object, | ||
}, | ||
}); | ||
</script> | ||
|
||
<template> | ||
<div> | ||
<div v-if="stats"> | ||
<Stat> | ||
<template #title> | ||
<div class="tw-flex tw-items-baseline tw-justify-between"> | ||
{{ headingText }} | ||
<router-link | ||
v-if="stats.totalReviews > 0" | ||
:to="`${plugin?.handle}/reviews`" | ||
class="tw-text-xs" | ||
> | ||
{{ 'All reviews' | t('app') }} | ||
</router-link> | ||
</div> | ||
</template> | ||
<template #content> | ||
<div v-if="stats.totalReviews > 0"> | ||
<div class="tw-flex tw-items-center tw-gap-3 tw-mt-2"> | ||
<div class="tw-flex tw-items-baseline tw-gap-1 tw-relative"> | ||
<span class="tw-text-3xl tw-font-normal">{{ | ||
stats.ratingAvg | ||
}}</span> | ||
<span class="tw-text-sm tw-text-gray-500 dark:tw-text-gray-400" | ||
>/ 5</span | ||
> | ||
</div> | ||
<div class="tw-flex tw-items-center tw-gap-1"> | ||
<RatingStars size="lg" :rating="stats.ratingAvg" /> | ||
</div> | ||
</div> | ||
<div | ||
class="tw-flex tw-items-baseline tw-text-sm tw-mt-4 tw-gap-4 tw-text-gray-300" | ||
> | ||
<a :href="getPluginReviewUrl(plugin?.handle)">{{ | ||
'Leave a review' | t('app') | ||
}}</a> | ||
</div> | ||
</div> | ||
</template> | ||
</Stat> | ||
</div> | ||
<div v-else> | ||
<Stat> | ||
<template #title>Reviews</template> | ||
<template #content> | ||
<p class="tw-font-normal"> | ||
{{ 'This plugin doesn’t have any reviews.' | t('app') }} | ||
</p> | ||
|
||
<div class="tw-mt-2"> | ||
<c-btn | ||
block | ||
target="_blank" | ||
:href="getPluginReviewUrl(plugin?.handle)" | ||
> | ||
{{ 'Leave a review' | t('app') }} | ||
</c-btn> | ||
</div> | ||
</template> | ||
</Stat> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<style scoped lang="scss"></style> |
Oops, something went wrong.