mirror of
https://github.com/pockethost/pockethost.git
synced 2025-11-24 14:35:49 +00:00
add flouner stats
This commit is contained in:
parent
cc74a73b4e
commit
6ef7b73edd
@ -1,8 +1,10 @@
|
||||
<script lang="ts">
|
||||
import { PLAN_NAMES, SubscriptionType } from 'pockethost'
|
||||
import { userStore } from '$util/stores'
|
||||
import { stats, userStore } from '$util/stores'
|
||||
import { onMount } from 'svelte'
|
||||
import PricingCard from '$src/routes/(static)/pricing/PricingCard.svelte'
|
||||
import { client } from '$src/pocketbase-client'
|
||||
import { writable } from 'svelte/store'
|
||||
|
||||
export let priceMonthly: [number, string?, number?] = [
|
||||
359,
|
||||
@ -21,7 +23,7 @@
|
||||
|
||||
<PricingCard
|
||||
name={`${PLAN_NAMES[SubscriptionType.Flounder]}`}
|
||||
qtyRemaining={999}
|
||||
qtyRemaining={1000 - $stats.total_flounder_subscribers}
|
||||
qtyMax={1000}
|
||||
{comingSoonText}
|
||||
{comingSoon}
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
export let fundingGoals: string[] = []
|
||||
export let startDate: Date | null = null
|
||||
|
||||
const qtySold = qtyMax - qtyRemaining
|
||||
$: qtySold = qtyMax - qtyRemaining
|
||||
|
||||
let countdown = ''
|
||||
let countdownInterval: ReturnType<typeof setInterval>
|
||||
|
||||
@ -34,9 +34,22 @@ export const globalInstancesStore = writable<{
|
||||
[_: InstanceId]: InstanceFields
|
||||
}>({})
|
||||
export const globalInstancesStoreReady = writable(false)
|
||||
export const stats = writable<{
|
||||
total_flounder_subscribers: number
|
||||
}>({
|
||||
total_flounder_subscribers: 0,
|
||||
})
|
||||
|
||||
export const init = () => {
|
||||
const { onAuthChange } = client()
|
||||
|
||||
client()
|
||||
.client.send(`/api/stats`, {})
|
||||
.then((res) => {
|
||||
stats.set(res)
|
||||
})
|
||||
.catch(console.error)
|
||||
|
||||
onAuthChange((authStoreProps) => {
|
||||
const isLoggedIn = authStoreProps.isValid
|
||||
isUserLoggedIn.set(isLoggedIn)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user