Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: temp patch for status #11

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion src/components/proposals/ProposalWrapper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -378,21 +378,21 @@
});
const deposit_params = computed(() => {
try {
return JSON.parse(params.value?.gov_params[0].deposit_params);

Check failure on line 381 in src/components/proposals/ProposalWrapper.vue

View workflow job for this annotation

GitHub Actions / Linting

Replace `(title.value·=·`AtomOne·—·#${proposal.value?.proposal[0].id}·${proposal.value?.proposal[0].title}`)` with `title.value·=·`AtomOne·—·#${proposal.value?.proposal[0].id}·${proposal.value?.proposal[0].title}`;`
} catch (e) {
return {};
}

Check failure on line 384 in src/components/proposals/ProposalWrapper.vue

View workflow job for this annotation

GitHub Actions / Linting

Replace ``https://atomone-api.allinbits.com/atomone/gov/v1beta1/proposals/${props.proposalId}`` with `⏎····`https://atomone-api.allinbits.com/atomone/gov/v1beta1/proposals/${props.proposalId}`,⏎··`
});

Check failure on line 385 in src/components/proposals/ProposalWrapper.vue

View workflow job for this annotation

GitHub Actions / Linting

Replace `await·fetchResult.json()·as·{·proposal:·{·proposal_id:·string,·status:·string,·voting_start_time:·string,·voting_end_time:·string·}` with `(await·fetchResult.json())·as·{⏎····proposal:·{·proposal_id:·string;·status:·string;·voting_start_time:·string;·voting_end_time:·string·};⏎··`
*/
const timeTo = (dateString: string) => {
const now = dayjs.utc();
const to = dayjs.utc(dateString);

Check failure on line 389 in src/components/proposals/ProposalWrapper.vue

View workflow job for this annotation

GitHub Actions / Linting

Replace `...props[0]` with `·...props[0]·`
const diff = dayjs.duration(to.diff(now));
const days = Math.floor(diff.asDays());
return days + " d : " + diff.format("H [hr] : m [m] [left]");
};

function isTabSelected(tabName: TabNames) {

Check failure on line 395 in src/components/proposals/ProposalWrapper.vue

View workflow job for this annotation

GitHub Actions / Linting

Insert `;`
return tabSelected.value.toLowerCase() == tabName.toLowerCase();
}

Expand All @@ -408,7 +408,25 @@
}

const title = useTitle();
onMounted(() => (title.value = `AtomOne — #${proposal.value?.proposal[0].id} ${proposal.value?.proposal[0].title}`));
onMounted(async () => {
(title.value = `AtomOne — #${proposal.value?.proposal[0].id} ${proposal.value?.proposal[0].title}`)

// Temporary patch, probably should remove
const fetchResult = await fetch(`https://atomone-api.allinbits.com/atomone/gov/v1beta1/proposals/${props.proposalId}`);
const json = await fetchResult.json() as { proposal: { proposal_id: string, status: string, voting_start_time: string, voting_end_time: string }};

if (proposal.value && proposal.value.proposal[0]) {
const props = [...proposal.value.proposal];
const newProp = {...props[0]};

newProp.voting_start_time = json.proposal.voting_start_time;
newProp.voting_end_time = json.proposal.voting_end_time;
newProp.status = json.proposal.status;

props[0] = newProp
proposal.value = { proposal: props };
}
});
</script>

<template>
Expand Down
Loading