Commit 57a62f7e authored by Nicolas Frandeboeuf's avatar Nicolas Frandeboeuf Committed by Nicolas Frandeboeuf
Browse files

Dashboard: hide frequency selector (fix #1000)

parent a4a12086
Pipeline #339341 passed with stage
in 9 minutes and 40 seconds
......@@ -301,14 +301,16 @@ class InOutChart extends React.Component {
<DiscoveryMessage message={$t('client.charts.differences_all_desc')} />
</DisplayIf>
<p>
<label htmlFor="frequency">{$t('client.charts.frequency')}</label>
<FrequencySelect
defaultValue={this.state.frequency}
onChange={this.handleChangeFrequency}
htmlId="frequency"
/>
</p>
<DisplayIf condition={!this.props.hideFrequencySelector}>
<p>
<label htmlFor="frequency">{$t('client.charts.frequency')}</label>
<FrequencySelect
defaultValue={this.state.frequency}
onChange={this.handleChangeFrequency}
htmlId="frequency"
/>
</p>
</DisplayIf>
<DisplayIf condition={currenciesOptions.length > 1}>
<p>
......@@ -353,6 +355,9 @@ InOutChart.propTypes = {
// The default frequency to display.
defaultFrequency: PropTypes.oneOf(['monthly', 'yearly']).isRequired,
// Whether to hide the frequency selector.
hideFrequencySelector: PropTypes.bool.isRequired,
};
InOutChart.defaultProps = {
......@@ -363,10 +368,11 @@ InOutChart.defaultProps = {
chartIdPrefix: 'barchart',
hideDiscoveryMessages: false,
defaultFrequency: 'monthly',
hideFrequencySelector: false,
};
const Export = connect((state, ownProps) => {
let defaultFrequency = get.setting(state, 'default-chart-frequency');
let defaultFrequency = ownProps.forceFrequency || get.setting(state, 'default-chart-frequency');
let currentAccountIds = get.accountIdsByAccessId(state, ownProps.accessId);
let currencyToTransactions = new Map();
......@@ -402,7 +408,14 @@ const Export = connect((state, ownProps) => {
defaultFrequency,
currencyToTransactions,
initialView,
hideFrequencySelector: ownProps.hasOwnProperty('forceFrequency'),
};
})(InOutChart);
Export.propTypes = {
// If provided the default frequency will be ignored in favor of this frequency and the
// frequency selector will be hidden.
forceFrequency: PropTypes.PropTypes.oneOf(['monthly', 'yearly']),
};
export default Export;
......@@ -82,6 +82,7 @@ const Access = props => {
fromDate={fromDate}
toDate={toDate}
hideDiscoveryMessages={true}
forceFrequency="monthly"
/>
</div>
</div>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment