Skip to content

Commit 9f52356

Browse files
committed
feat: added locks to extra destinations on unsubscribed users
1 parent 2a12503 commit 9f52356

File tree

6 files changed

+33
-12
lines changed

6 files changed

+33
-12
lines changed

src/components/CardElement.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ defineProps({
4646
:is="to ? 'router-link' : 'vue:template'"
4747
:to="to ? to : undefined"
4848
>
49-
<article>
49+
<article v-bind="$attrs">
5050
<div class="images overflow-auto" v-if="images" tabindex="0">
5151
<img
5252
v-for="image in images"
@@ -78,7 +78,7 @@ defineProps({
7878
</footer>
7979
</article>
8080
</component>
81-
<article v-else>
81+
<article v-else v-bind="$attrs">
8282
<div class="images" v-if="images?.length">
8383
<div class="gl-animate-skeleton-loader" style="height: 100%"></div>
8484
</div>

src/components/QR/QRAnalytics.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ defineProps({
3333
required: false,
3434
default: null,
3535
},
36-
hasBillableRedirects: {
36+
subscribed: {
3737
type: Boolean,
3838
required: false,
3939
default: false,
@@ -62,7 +62,7 @@ defineProps({
6262
</hgroup>
6363
</card-element>
6464
</div>
65-
<template v-if="hasBillableRedirects">
65+
<template v-if="subscribed">
6666
<card-element v-if="bestEndpoint">
6767
<hgroup>
6868
<h3 class="gl-animate-skeleton-loader" v-if="isLoading"></h3>

src/components/QR/QRDestinations.vue

+23-5
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import BaseButton from "@/components/BaseButton.vue";
66
import type { PropType } from "vue";
77
import type { Endpoint } from "@/types/redirect";
88
import { parseRuleGroup } from "@/useRules";
9+
import ConfirmsSubscriptionStart from "@/components/modals/ConfirmsSubscriptionStart.vue";
910
1011
defineProps({
1112
redirectId: {
@@ -17,7 +18,7 @@ defineProps({
1718
required: false,
1819
default: () => [],
1920
},
20-
hasBillableRedirects: {
21+
subscribed: {
2122
type: Boolean,
2223
required: false,
2324
default: false,
@@ -43,22 +44,27 @@ defineProps({
4344
<h3>{{ $t("No destinations yet") }}</h3>
4445
<p>
4546
{{
46-
hasBillableRedirects
47+
subscribed
4748
? $t("Add free destinations")
4849
: $t("Add more destinations to same code")
4950
}}
5051
</p>
5152
</hgroup>
5253
</card-element>
5354
</template>
54-
<template v-else v-for="endpoint in endpoints" :key="endpoint.id">
55+
<template v-else v-for="(endpoint, index) in endpoints" :key="endpoint.id">
5556
<edit-endpoint
5657
v-if="endpoint.id && endpoint.redirect_uuid"
5758
:redirectId="endpoint.redirect_uuid"
5859
:endpointId="endpoint.id"
5960
:currentUrl="endpoint.endpoint"
6061
>
61-
<card-element :loading="isLoading">
62+
<card-element
63+
:loading="isLoading"
64+
:class="{
65+
disabled: !subscribed && index > 0,
66+
}"
67+
>
6268
<hgroup>
6369
<h3>{{ removeProtocol(endpoint.endpoint) }}</h3>
6470
<p v-if="endpoint.rule_groups?.[0]">
@@ -70,6 +76,18 @@ defineProps({
7076
</hgroup>
7177
</card-element>
7278
</edit-endpoint>
79+
80+
<!-- IF we have more than 1 endpoint, and the others are locked due to unsub, show subsctibe button -->
81+
<confirms-subscription-start
82+
v-if="redirectId && !subscribed && index === 0 && endpoints.length > 1"
83+
:redirectId="redirectId"
84+
:title="$t('Activate other destinations')"
85+
:submitText="$t('Activate other destinations')"
86+
>
87+
<base-button class="full-width">{{
88+
$t("Activate other destinations")
89+
}}</base-button>
90+
</confirms-subscription-start>
7391
</template>
7492
<base-button
7593
v-if="redirectId"
@@ -79,7 +97,7 @@ defineProps({
7997
}"
8098
:loading="isLoading"
8199
>{{
82-
hasBillableRedirects
100+
subscribed
83101
? $t("Add more free destinations")
84102
: $t("Add more destinations to same code")
85103
}}</base-button

src/components/screens/SingleQR.vue

+2-1
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ const QRDestinations = defineAsyncComponent(
304304
:clicksAllTime="clicksAllTime"
305305
:bestEndpoint="bestEndpoint"
306306
:isLoading="isLoading || loading"
307-
:hasBillableRedirects="subscribed"
307+
:subscribed="subscribed"
308308
/>
309309
</div>
310310

@@ -313,6 +313,7 @@ const QRDestinations = defineAsyncComponent(
313313
:redirectId="redirectId"
314314
:endpoints="endpoints"
315315
:isLoading="isLoading || loading"
316+
:subscribed="subscribed"
316317
/>
317318
</div>
318319

src/locales/en.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -277,5 +277,6 @@
277277
"Edit destination": "Edit destination",
278278
"No data available": "No data available",
279279
"No destinations yet": "No destinations yet",
280-
"You have been unsubscribed.": "You have been unsubscribed."
280+
"You have been unsubscribed.": "You have been unsubscribed.",
281+
"Activate other destinations": "Activate other destinations"
281282
}

src/locales/fr.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -277,5 +277,6 @@
277277
"Edit destination": "Modifier la destination",
278278
"No data available": "Pas de données disponibles",
279279
"No destinations yet": "Pas encore de destinations",
280-
"You have been unsubscribed.": "Vous avez été désabonné."
280+
"You have been unsubscribed.": "Vous avez été désabonné.",
281+
"Activate other destinations": "Activer d'autres destinations"
281282
}

0 commit comments

Comments
 (0)