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