mirror of
https://github.com/acid-info/Kurate.git
synced 2025-02-14 08:46:45 +00:00
feat: remove graph and graph data (#308)
This commit is contained in:
parent
bc0cdd97ec
commit
b328e4c67f
@ -15,7 +15,7 @@ import {
|
||||
VOTE_GO_PRICE,
|
||||
VOTE_REP_WIN,
|
||||
} from '$lib/constants'
|
||||
import { tokens, type TokenData } from '$lib/stores/tokens'
|
||||
import { tokens } from '$lib/stores/tokens'
|
||||
import { posts, type Post } from '$lib/stores/post'
|
||||
import { transaction, type TransactionRecord } from '$lib/stores/transaction'
|
||||
|
||||
@ -200,42 +200,6 @@ export class InMemoryAndIPFS implements Adapter {
|
||||
transaction.set({ transactions: storedTransactions })
|
||||
|
||||
tokens.set(storedTokens)
|
||||
this.subscriptions.push(
|
||||
tokens.subscribe((state) => {
|
||||
let newState: TokenData | undefined = undefined
|
||||
if (
|
||||
state.goHistoricalValues.length === 0 ||
|
||||
state.go !== state.goHistoricalValues[state.goHistoricalValues.length - 1].value
|
||||
) {
|
||||
newState = { ...state }
|
||||
newState.goHistoricalValues.push({ timestamp: Date.now(), value: state.go })
|
||||
}
|
||||
if (
|
||||
state.repStakedHistoricalValues.length === 0 ||
|
||||
state.repStaked !==
|
||||
state.repStakedHistoricalValues[state.repStakedHistoricalValues.length - 1].value
|
||||
) {
|
||||
if (newState === undefined) {
|
||||
newState = { ...state }
|
||||
}
|
||||
newState.repStakedHistoricalValues.push({ timestamp: Date.now(), value: state.repStaked })
|
||||
}
|
||||
if (
|
||||
state.repTotalHistoricalValues.length === 0 ||
|
||||
state.repTotal !==
|
||||
state.repTotalHistoricalValues[state.repTotalHistoricalValues.length - 1].value
|
||||
) {
|
||||
if (newState === undefined) {
|
||||
newState = { ...state }
|
||||
}
|
||||
newState.repTotalHistoricalValues.push({ timestamp: Date.now(), value: state.repTotal })
|
||||
}
|
||||
if (newState !== undefined) {
|
||||
tokens.update(() => state)
|
||||
saveToLocalStorage('tokens', state)
|
||||
}
|
||||
}),
|
||||
)
|
||||
|
||||
this.subscriptions.push(
|
||||
transaction.subscribe(({ transactions }) => {
|
||||
|
@ -1,24 +0,0 @@
|
||||
<script lang="ts">
|
||||
let cls: string | undefined = undefined
|
||||
export { cls as class }
|
||||
|
||||
interface GraphRecord {
|
||||
timestamp: number
|
||||
value: number
|
||||
}
|
||||
|
||||
export let minX: number
|
||||
export let maxX: number
|
||||
export let minY = 0
|
||||
export let maxY: number
|
||||
export let values: GraphRecord[]
|
||||
</script>
|
||||
|
||||
<div class={`root ${cls}`}>
|
||||
x axis scale: {minX} - {maxX}
|
||||
y axis scale: {minY} - {maxY}
|
||||
values length: {values.length}
|
||||
</div>
|
||||
|
||||
<style lang="scss">
|
||||
</style>
|
@ -1,19 +1,11 @@
|
||||
import { DEFAULT_GO_AMOUNT } from '$lib/constants'
|
||||
import { writable, type Writable } from 'svelte/store'
|
||||
|
||||
interface TokenValues {
|
||||
timestamp: number
|
||||
value: number
|
||||
}
|
||||
|
||||
export interface TokenData {
|
||||
go: number
|
||||
repTotal: number
|
||||
repStaked: number
|
||||
loading: boolean
|
||||
goHistoricalValues: TokenValues[]
|
||||
repStakedHistoricalValues: TokenValues[]
|
||||
repTotalHistoricalValues: TokenValues[]
|
||||
epochDuration: number
|
||||
timeToEpoch: number
|
||||
}
|
||||
@ -27,9 +19,6 @@ function createTokenStore(): TokenStore {
|
||||
repTotal: 55,
|
||||
repStaked: 0,
|
||||
loading: false,
|
||||
goHistoricalValues: [],
|
||||
repStakedHistoricalValues: [],
|
||||
repTotalHistoricalValues: [],
|
||||
epochDuration,
|
||||
timeToEpoch: epochDuration - (Date.now() % epochDuration),
|
||||
})
|
||||
|
@ -11,7 +11,6 @@
|
||||
import Select from '$lib/components/select.svelte'
|
||||
import { saveToLocalStorage } from '$lib/utils'
|
||||
import { startNewEpoch } from '$lib/adapters/in-memory-and-ipfs'
|
||||
import { formatDateAndTime } from '$lib/utils/format'
|
||||
|
||||
let goTokenValue = $tokens.go.toFixed()
|
||||
let repTokenValue = $tokens.repTotal.toFixed()
|
||||
@ -59,35 +58,6 @@
|
||||
<Button label="Update" on:click={updateTokens} />
|
||||
</section>
|
||||
<Divider />
|
||||
<section>
|
||||
<h2>GO historical values</h2>
|
||||
{#each $tokens.goHistoricalValues as transaction}
|
||||
<section>
|
||||
{formatDateAndTime(transaction.timestamp)} |
|
||||
{transaction.value} GO
|
||||
</section>
|
||||
{/each}
|
||||
</section>
|
||||
<Divider />
|
||||
<section>
|
||||
<h2>REP staked historical values</h2>
|
||||
{#each $tokens.repStakedHistoricalValues as transaction}
|
||||
<section>
|
||||
{formatDateAndTime(transaction.timestamp)} |
|
||||
{transaction.value} REP
|
||||
</section>
|
||||
{/each}
|
||||
</section>
|
||||
<Divider />
|
||||
<section>
|
||||
<h2>REP total historical values</h2>
|
||||
{#each $tokens.repTotalHistoricalValues as transaction}
|
||||
<section>
|
||||
{formatDateAndTime(transaction.timestamp)} |
|
||||
{transaction.value} REP
|
||||
</section>
|
||||
{/each}
|
||||
</section>
|
||||
{/if}
|
||||
</Container>
|
||||
|
||||
|
@ -20,7 +20,6 @@
|
||||
import { personas } from '$lib/stores/persona'
|
||||
import ProgressCircular from '$lib/components/progress-circular.svelte'
|
||||
import ProgressLinear from '$lib/components/progress-linear.svelte'
|
||||
import Graph from '$lib/components/graph.svelte'
|
||||
import SingleColumn from '$lib/components/single-column.svelte'
|
||||
import Spacer from '$lib/components/spacer.svelte'
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user