From fd0b9c9881a67d819480086d251bba08d47c3de7 Mon Sep 17 00:00:00 2001 From: Claire Date: Thu, 1 Jun 2023 09:37:38 +0200 Subject: [PATCH] [Glitch] Add a confirmation screen when suspending a domain Port 8ee98cfd2b01d96222c1559f35ef8b82732af620 to glitch-soc Signed-off-by: Claire --- .../glitch/components/admin/ImpactReport.jsx | 91 +++++++++++++++++++ .../flavours/glitch/styles/admin.scss | 9 ++ 2 files changed, 100 insertions(+) create mode 100644 app/javascript/flavours/glitch/components/admin/ImpactReport.jsx diff --git a/app/javascript/flavours/glitch/components/admin/ImpactReport.jsx b/app/javascript/flavours/glitch/components/admin/ImpactReport.jsx new file mode 100644 index 0000000000..9ec1460fcf --- /dev/null +++ b/app/javascript/flavours/glitch/components/admin/ImpactReport.jsx @@ -0,0 +1,91 @@ +import PropTypes from 'prop-types'; +import { PureComponent } from 'react'; + +import { FormattedNumber, FormattedMessage } from 'react-intl'; + +import classNames from 'classnames'; + +import api from 'flavours/glitch/api'; +import { Skeleton } from 'flavours/glitch/components/skeleton'; + +export default class ImpactReport extends PureComponent { + + static propTypes = { + domain: PropTypes.string.isRequired, + }; + + state = { + loading: true, + data: null, + }; + + componentDidMount () { + const { domain } = this.props; + + const params = { + domain: domain, + include_subdomains: true, + }; + + api().post('/api/v1/admin/measures', { + keys: ['instance_accounts', 'instance_follows', 'instance_followers'], + start_at: null, + end_at: null, + instance_accounts: params, + instance_follows: params, + instance_followers: params, + }).then(res => { + this.setState({ + loading: false, + data: res.data, + }); + }).catch(err => { + console.error(err); + }); + } + + render () { + const { loading, data } = this.state; + + return ( +
+

+ + + + + + + + + + 0 })}> + + + + + + 0 })}> + + + + + +
+ + + {loading ? : } +
+ + + {loading ? : } +
+ + + {loading ? : } +
+
+ ); + } + +} diff --git a/app/javascript/flavours/glitch/styles/admin.scss b/app/javascript/flavours/glitch/styles/admin.scss index 2adee62d6b..a57e014e9e 100644 --- a/app/javascript/flavours/glitch/styles/admin.scss +++ b/app/javascript/flavours/glitch/styles/admin.scss @@ -1315,6 +1315,15 @@ a.sparkline { &:last-child { border-bottom: 0; } + + &.negative { + color: $error-value-color; + font-weight: 700; + + .dimension__item__value { + color: $error-value-color; + } + } } }