Skip to content

Commit

Permalink
stats/topics adjustment and renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
thepiwo committed Mar 24, 2021
1 parent c1c5b32 commit 11496ad
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export default {
] = await Promise.all([
Backend.getCacheChainNames(),
Backend.getOracleCache(),
Backend.getTopicsCache(),
Backend.getTopics(),
Backend.getVerifiedUrls(),
Backend.getGrayListedUrls(),
Backend.getTokenInfo(),
Expand Down
7 changes: 4 additions & 3 deletions src/components/TipInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ export default {
...mapGetters('backend', ['minTipAmount']),
...mapState('backend', {
tipUrlStats({ stats }) {
const urlStats = stats && stats.by_url.find(({ url }) => url === this.tipUrl);
// const urlStats = stats && stats.by_url.find(({ url }) => url === this.tipUrl);
const urlStats = null; // TODO url stats
return {
isTipped: urlStats ? urlStats.senders.includes(this.address) : false,
totalAmountAe: urlStats ? urlStats.total_amount_ae : '0',
Expand All @@ -122,15 +123,15 @@ export default {
},
}),
largestFtTipAmount() {
return this.tip.Aggregation.totaltokenamount.length
return this.tip && this.tip.Aggregation.totaltokenamount.length
? this.tip.Aggregation.totaltokenamount.reduce(
(a, b) => (a.amount > b.amount ? a : b),
this.tip.Aggregation.totaltokenamount[0],
)
: null;
},
tipAmount() {
return +this.tip.Aggregation.totalurlamount !== 0
return this.tip && this.tip.Aggregation.totalurlamount !== 0
? {
value: this.tip.Aggregation.totalurlamount,
token: null,
Expand Down
8 changes: 4 additions & 4 deletions src/components/layout/Overview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
class="overview"
>
<div class="value">
{{ stats.total_tips_length }}
{{ stats.tipslength }}
</div>
<div class="label">
{{ $t('components.layout.Overview.TipsAggregated') }}
Expand All @@ -18,22 +18,22 @@
</div>

<div class="value">
{{ stats.senders_length }}
{{ stats.senderslength }}
</div>
<div class="label">
{{ $t('components.layout.Overview.UniqueTipSenders') }}
</div>

<AeAmountFiat
:amount="stats.total_amount_ae"
:amount="stats.totalamount"
class="value"
/>
<div class="label">
{{ $t('components.layout.Overview.TotalTipsValue') }}
</div>

<AeAmountFiat
:amount="stats.total_claimed_amount_ae"
:amount="stats.totalclaimedamount"
class="value"
/>
<div class="label">
Expand Down
2 changes: 1 addition & 1 deletion src/components/layout/RightSectionTopics.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
class="text-ellipsis"
:topic="topic"
/>
<AeAmountFiat :amount="data.amount_ae" />
<AeAmountFiat :amount="data.amount" />
</div>
</div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions src/store/modules/backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,14 @@ export default {
if (tipsReloading[args]) return;
commit('tipsReloading', args);
const value = (await Promise.all(
times(tipsPageCount[args], (p) => Backend.getCacheFeed(p + 1, ...args)),
times(tipsPageCount[args], (p) => Backend.getFeed(p + 1, ...args)),
)).flat().filter((p) => p);
commit('setTips', { args, value });
},
async loadNextPageOfTips({ commit, state }, args) {
if (state.tipsEndReached[args] || state.tipsNextPageLoading[args]) return;
commit('tipsNextPageLoading', args);
const value = await Backend.getCacheFeed(state.tipsPageCount[args] + 1, ...args);
const value = await Backend.getFeed(state.tipsPageCount[args] + 1, ...args);
commit('addTips', { args, value });
},
async reloadUserComments({ commit }, address) {
Expand Down Expand Up @@ -103,7 +103,7 @@ export default {
},
async reloadStats({ commit, rootState: { aeternity: { sdk } } }) {
const [stats1, stats2, height] = await Promise.all([
Backend.getCacheStats(),
Backend.getTipStats(),
Backend.getStats(),
sdk.height(),
]);
Expand Down
6 changes: 3 additions & 3 deletions src/utils/backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export default class Backend {

static getCacheUserStats = async (address) => backendFetch(`cache/userStats?address=${address}`);

static getCacheFeed = async (
static getFeed = async (
page,
ordering,
address = null,
Expand All @@ -99,15 +99,15 @@ export default class Backend {
headers: { 'Content-Type': 'application/json' },
});

static getCacheStats = async () => backendFetch('cache/stats');
static getTipStats = async () => backendFetch('stats');

static getCacheChainNames = async () => backendFetch('cache/chainnames');

static getPrice = async () => backendFetch('cache/price');

static getOracleCache = async () => backendFetch('cache/oracle');

static getTopicsCache = async () => backendFetch('cache/topics');
static getTopics = async () => backendFetch('tips/topics');

static getTokenInfo = async () => backendFetch('tokenCache/tokenInfo');

Expand Down

0 comments on commit 11496ad

Please sign in to comment.