From 9af04d5a46be1887525a42d515d204f62bc94385 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 e9385e93e9b4601c87d1f5d6b8ddfd815f7aedcb 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 000000000..9ec1460fc --- /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 2adee62d6..a57e014e9 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; + } + } } }