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

Ana/add no proposal history #3198

Merged
merged 9 commits into from
Nov 28, 2019
Merged
Show file tree
Hide file tree
Changes from 8 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
1 change: 1 addition & 0 deletions changes/ana_add-no-proposal-history
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[Fixed] Now the proposals page behaves properly, displaying a banner in case there are no proposals in the network saying "No Governance Proposals". Also removed PageContainer from PageProposals @Bitcoinera
73 changes: 31 additions & 42 deletions src/components/governance/PageProposals.vue
Original file line number Diff line number Diff line change
@@ -1,56 +1,45 @@
<template>
<PageContainer
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what was PageContainer doing?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what was PageContainer doing?

It was intended to replace TmPage and some of the internals we don't need there anymore.

I assume we will still need TmPage to be present?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so true. I think it should be like:

<TmPage
  data-title="Proposals"
  :managed="false">
...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I am going to change it

<TmPage
data-title="Proposals"
:managed="true"
:loading="
$apollo.queries.proposals.loading && $apollo.queries.parameters.loading
"
:error="$apollo.queries.proposals.error || $apollo.queries.parameters.error"
hide-header
>
<template slot="no-data">
<!-- duplicated, I have no proper way of refactoring this -->
<div class="button-container">
<TmBtn
id="propose-btn"
value="Create Proposal"
type="secondary"
@click.native="onPropose"
/>
</div>
<TmDataMsg
title="No Governance Proposals"
subtitle="There are currently no governance proposals to display.
Click the 'Create Proposal' button to submit a proposal."
icon="gavel"
:managed="false">
<div class="button-container">
<TmBtn
id="propose-btn"
value="Create Proposal"
type="secondary"
@click.native="onPropose"
/>
</template>
<template slot="managed-body">
<!-- duplicated, I have no proper way of refactoring this -->
<div class="button-container">
<TmBtn
id="propose-btn"
value="Create Proposal"
type="secondary"
@click.native="onPropose"
/>
</div>
<ModalPropose
ref="modalPropose"
:denom="parameters.depositDenom"
@success="() => afterPropose()"
/>
<div v-if="!$apollo.loading && proposals.length === 0">
<div>
<TmDataMsg icon="gavel">
<div slot="title">
No Governance Proposals
</div>
<div slot="subtitle">
There are currently no governance proposals to display.
Click the 'Create Proposal' button to submit the first network proposal!
</div>
</TmDataMsg>
</div>
</div>
<div v-else-if="!$apollo.loading && proposals.length > 0">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<div v-else-if="!$apollo.loading && proposals.length > 0">
<div v-else>

<TmDataLoading v-if="$apollo.loading" />
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this contradicts line 31

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can move it up and use a v-else-if

<TableProposals v-else :proposals="proposals" />
<ModalPropose
ref="modalPropose"
:denom="parameters.depositDenom"
@success="() => afterPropose()"
/>
</template>
</PageContainer>
</div>
</TmPage>
</template>

<script>
import ModalPropose from "src/ActionModal/components/ModalPropose"
import TableProposals from "governance/TableProposals"
import TmPage from "common/TmPage"
import TmBtn from "common/TmBtn"
import PageContainer from "common/PageContainer"
import TmDataMsg from "common/TmDataMsg"
import TmDataLoading from "common/TmDataLoading"
import { mapGetters } from "vuex"
Expand All @@ -65,7 +54,7 @@ export default {
TmDataMsg,
TmDataLoading,
TmBtn,
PageContainer
TmPage
},
data: () => ({
proposals: [],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,148 +1,115 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`PageProposals shows a message if still loading 1`] = `
<pagecontainer-stub
<tmpage-stub
data-title="Proposals"
hideheader="true"
managed="true"
subtitle=""
title=""
>
<template>
<div
class="button-container"
>
<tmbtn-stub
id="propose-btn"
type="secondary"
value="Create Proposal"
/>
</div>

<tmdatamsg-stub
icon="gavel"
subtitle="There are currently no governance proposals to display.
Click the 'Create Proposal' button to submit a proposal."
title="No Governance Proposals"
<div
class="button-container"
>
<tmbtn-stub
id="propose-btn"
type="secondary"
value="Create Proposal"
/>
</template>
</div>

<modalpropose-stub
denom="xxx"
/>

<template>
<div
class="button-container"
>
<tmbtn-stub
id="propose-btn"
type="secondary"
value="Create Proposal"
/>
<div>
<div>
<tmdatamsg-stub
icon="gavel"
>
<div>

No Governance Proposals

</div>

<div>

There are currently no governance proposals to display.
Click the 'Create Proposal' button to submit the first network proposal!

</div>
</tmdatamsg-stub>
</div>

<tableproposals-stub
proposals=""
/>

<modalpropose-stub
denom="xxx"
/>
</template>
</pagecontainer-stub>
</div>
</tmpage-stub>
`;

exports[`PageProposals shows a message if there is nothing to display 1`] = `
<pagecontainer-stub
<tmpage-stub
data-title="Proposals"
hideheader="true"
managed="true"
subtitle=""
title=""
>
<template>
<div
class="button-container"
>
<tmbtn-stub
id="propose-btn"
type="secondary"
value="Create Proposal"
/>
</div>

<tmdatamsg-stub
icon="gavel"
subtitle="There are currently no governance proposals to display.
Click the 'Create Proposal' button to submit a proposal."
title="No Governance Proposals"
<div
class="button-container"
>
<tmbtn-stub
id="propose-btn"
type="secondary"
value="Create Proposal"
/>
</template>
</div>

<modalpropose-stub
denom="xxx"
/>

<template>
<div
class="button-container"
>
<tmbtn-stub
id="propose-btn"
type="secondary"
value="Create Proposal"
/>
<div>
<div>
<tmdatamsg-stub
icon="gavel"
>
<div>

No Governance Proposals

</div>

<div>

There are currently no governance proposals to display.
Click the 'Create Proposal' button to submit the first network proposal!

</div>
</tmdatamsg-stub>
</div>

<tableproposals-stub
proposals=""
/>

<modalpropose-stub
denom="xxx"
/>
</template>
</pagecontainer-stub>
</div>
</tmpage-stub>
`;

exports[`PageProposals shows a proposals table 1`] = `
<pagecontainer-stub
<tmpage-stub
data-title="Proposals"
hideheader="true"
managed="true"
subtitle=""
title=""
>
<template>
<div
class="button-container"
>
<tmbtn-stub
id="propose-btn"
type="secondary"
value="Create Proposal"
/>
</div>

<tmdatamsg-stub
icon="gavel"
subtitle="There are currently no governance proposals to display.
Click the 'Create Proposal' button to submit a proposal."
title="No Governance Proposals"
<div
class="button-container"
>
<tmbtn-stub
id="propose-btn"
type="secondary"
value="Create Proposal"
/>
</template>
</div>

<template>
<div
class="button-container"
>
<tmbtn-stub
id="propose-btn"
type="secondary"
value="Create Proposal"
/>
</div>

<modalpropose-stub
denom="lunies"
/>

<div>
<tableproposals-stub
proposals="[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]"
/>

<modalpropose-stub
denom="lunies"
/>
</template>
</pagecontainer-stub>
</div>
</tmpage-stub>
`;