Darken expired subscriptions on subscription setup page
This commit is contained in:
parent
2b3e578ee4
commit
04ff50605f
2 changed files with 13 additions and 0 deletions
|
@ -232,6 +232,7 @@ export interface Subscription {
|
||||||
id: number,
|
id: number,
|
||||||
sender: Profile,
|
sender: Profile,
|
||||||
sender_address: string,
|
sender_address: string,
|
||||||
|
expires_at: string,
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getSubscribers(
|
export async function getSubscribers(
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
<div
|
<div
|
||||||
v-for="subscription in subscribers"
|
v-for="subscription in subscribers"
|
||||||
class="subscriber"
|
class="subscriber"
|
||||||
|
:class="{ expired: !isSubscriptionActive(subscription) }"
|
||||||
:key="subscription.id"
|
:key="subscription.id"
|
||||||
@click="onSubscriberSelected(subscription)"
|
@click="onSubscriberSelected(subscription)"
|
||||||
>
|
>
|
||||||
|
@ -69,6 +70,8 @@
|
||||||
import { onMounted, watch } from "vue"
|
import { onMounted, watch } from "vue"
|
||||||
import { $, $$, $ref } from "vue/macros"
|
import { $, $$, $ref } from "vue/macros"
|
||||||
|
|
||||||
|
import { DateTime } from "luxon"
|
||||||
|
|
||||||
import { Profile, ProfileWrapper } from "@/api/users"
|
import { Profile, ProfileWrapper } from "@/api/users"
|
||||||
import {
|
import {
|
||||||
configureSubscriptions,
|
configureSubscriptions,
|
||||||
|
@ -241,6 +244,11 @@ async function onEnableSubscriptions() {
|
||||||
isLoading = false
|
isLoading = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isSubscriptionActive(subscription: Subscription): boolean {
|
||||||
|
const expiresAt = DateTime.fromISO(subscription.expires_at)
|
||||||
|
return expiresAt > DateTime.now()
|
||||||
|
}
|
||||||
|
|
||||||
function onSubscriberSelected(subscription: Subscription) {
|
function onSubscriberSelected(subscription: Subscription) {
|
||||||
subscriberAddress = subscription.sender_address
|
subscriberAddress = subscription.sender_address
|
||||||
subscriptionState = null
|
subscriptionState = null
|
||||||
|
@ -351,6 +359,10 @@ async function onWithdrawReceived() {
|
||||||
input {
|
input {
|
||||||
width: 400px;
|
width: 400px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.subscriber.expired {
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.loader {
|
.loader {
|
||||||
|
|
Loading…
Reference in a new issue