web/satellite: don't show CTAs on limit cards if user is not project owner

Hide CTAs on limit cards if user is not the owner of selected project.
We do this because user can't update limits if they are not the owner of the project.

Issue:
https://github.com/storj/storj/issues/6214

Change-Id: Ib6b564cd6afc1b4bed08ee9b26108f803f0ffb89
This commit is contained in:
Vitalii 2023-08-28 14:21:45 +03:00 committed by Storj Robot
parent c010e37374
commit 4964ca5ffb

View File

@ -52,7 +52,7 @@
color="#091c45"
:used-value="projectPricePercentage"
:used-title="`${projectPricePercentage.toFixed(0)}% Used`"
:used-info="`Free tier: ${centsToDollars(coupon?.amountOff)}`"
:used-info="`Free tier: ${centsToDollars(coupon.amountOff)}`"
:available-title="`${remainingCouponAmount}% Available`"
:action-title="freeTierActionTitle"
:on-action="startUpgradeFlow"
@ -68,9 +68,9 @@
color="#091c45"
:used-value="projectPricePercentage"
:used-title="`${projectPricePercentage.toFixed(0)}% Used`"
:used-info="`Coupon: ${centsToDollars(coupon?.amountOff)} monthly`"
:used-info="`Coupon: ${centsToDollars(coupon.amountOff)} monthly`"
:available-title="isPaidTier ?
`${centsToDollars(coupon?.amountOff)} per month` :
`${centsToDollars(coupon.amountOff)} per month` :
`${remainingCouponAmount}% Available`"
action-title="View coupons"
:on-action="navigateToCoupons"
@ -143,6 +143,13 @@ const isPaidTier = computed((): boolean => {
return usersStore.state.user.paidTier;
});
/**
* Indicates if user is project owner.
*/
const isProjectOwner = computed((): boolean => {
return projectsStore.state.selectedProject.ownerId === usersStore.state.user.id;
});
/**
* Returns current project limits from store.
*/
@ -234,6 +241,8 @@ const segmentsAvailable = computed((): number => {
*/
function usageActionTitle(usage: number, isSegment = false): string {
switch (true) {
case !isProjectOwner.value:
return '';
case !isPaidTier.value && usage < EIGHTY_PERCENT:
return 'Need more?';
case !isPaidTier.value && usage >= EIGHTY_PERCENT && usage < HUNDRED_PERCENT: