IntroduceRow.tsx 5.32 KB
Newer Older
duanledexianxianxian's avatar
duanledexianxianxian committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
import { Col, Icon, Row, Tooltip } from 'antd';

import { FormattedMessage } from 'umi-plugin-react/locale';
import React from 'react';
import numeral from 'numeral';
import { ChartCard, MiniArea, MiniBar, MiniProgress, Field } from './Charts';
import { VisitDataType } from '../data.d';
import Trend from './Trend';
import Yuan from '../utils/Yuan';
import styles from '../style.less';

const topColResponsiveProps = {
  xs: 24,
  sm: 12,
  md: 12,
  lg: 12,
  xl: 6,
  style: { marginBottom: 24 },
};

const IntroduceRow = ({ loading, visitData }: { loading: boolean; visitData: VisitDataType[] }) => (
  <Row gutter={24} type="flex">
    <Col {...topColResponsiveProps}>
      <ChartCard
        bordered={false}
        title={
27 28 29 30
          <FormattedMessage
            id="dashboard-analysis.analysis.total-sales"
            defaultMessage="Total Sales"
          />
duanledexianxianxian's avatar
duanledexianxianxian committed
31 32 33 34
        }
        action={
          <Tooltip
            title={
35 36 37 38
              <FormattedMessage
                id="dashboard-analysis.analysis.introduce"
                defaultMessage="Introduce"
              />
duanledexianxianxian's avatar
duanledexianxianxian committed
39 40 41 42 43 44 45 46 47 48
            }
          >
            <Icon type="info-circle-o" />
          </Tooltip>
        }
        loading={loading}
        total={() => <Yuan>126560</Yuan>}
        footer={
          <Field
            label={
49 50 51 52
              <FormattedMessage
                id="dashboard-analysis.analysis.day-sales"
                defaultMessage="Daily Sales"
              />
duanledexianxianxian's avatar
duanledexianxianxian committed
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
            }
            value={`οΏ₯${numeral(12423).format('0,0')}`}
          />
        }
        contentHeight={46}
      >
        <Trend flag="up" style={{ marginRight: 16 }}>
          <FormattedMessage id="dashboard-analysis.analysis.week" defaultMessage="Weekly Changes" />
          <span className={styles.trendText}>12%</span>
        </Trend>
        <Trend flag="down">
          <FormattedMessage id="dashboard-analysis.analysis.day" defaultMessage="Daily Changes" />
          <span className={styles.trendText}>11%</span>
        </Trend>
      </ChartCard>
    </Col>

    <Col {...topColResponsiveProps}>
      <ChartCard
        bordered={false}
        loading={loading}
        title={<FormattedMessage id="dashboard-analysis.analysis.visits" defaultMessage="Visits" />}
        action={
          <Tooltip
            title={
78 79 80 81
              <FormattedMessage
                id="dashboard-analysis.analysis.introduce"
                defaultMessage="Introduce"
              />
duanledexianxianxian's avatar
duanledexianxianxian committed
82 83 84 85 86 87 88 89 90
            }
          >
            <Icon type="info-circle-o" />
          </Tooltip>
        }
        total={numeral(8846).format('0,0')}
        footer={
          <Field
            label={
91 92 93 94
              <FormattedMessage
                id="dashboard-analysis.analysis.day-visits"
                defaultMessage="Daily Visits"
              />
duanledexianxianxian's avatar
duanledexianxianxian committed
95 96 97 98 99 100 101 102 103 104 105 106 107
            }
            value={numeral(1234).format('0,0')}
          />
        }
        contentHeight={46}
      >
        <MiniArea color="#975FE4" data={visitData} />
      </ChartCard>
    </Col>
    <Col {...topColResponsiveProps}>
      <ChartCard
        bordered={false}
        loading={loading}
108 109 110
        title={
          <FormattedMessage id="dashboard-analysis.analysis.payments" defaultMessage="Payments" />
        }
duanledexianxianxian's avatar
duanledexianxianxian committed
111 112 113
        action={
          <Tooltip
            title={
114 115 116 117
              <FormattedMessage
                id="dashboard-analysis.analysis.introduce"
                defaultMessage="Introduce"
              />
duanledexianxianxian's avatar
duanledexianxianxian committed
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
            }
          >
            <Icon type="info-circle-o" />
          </Tooltip>
        }
        total={numeral(6560).format('0,0')}
        footer={
          <Field
            label={
              <FormattedMessage
                id="dashboard-analysis.analysis.conversion-rate"
                defaultMessage="Conversion Rate"
              />
            }
            value="60%"
          />
        }
        contentHeight={46}
      >
        <MiniBar data={visitData} />
      </ChartCard>
    </Col>
    <Col {...topColResponsiveProps}>
      <ChartCard
        loading={loading}
        bordered={false}
        title={
          <FormattedMessage
            id="dashboard-analysis.analysis.operational-effect"
            defaultMessage="Operational Effect"
          />
        }
        action={
          <Tooltip
            title={
153 154 155 156
              <FormattedMessage
                id="dashboard-analysis.analysis.introduce"
                defaultMessage="Introduce"
              />
duanledexianxianxian's avatar
duanledexianxianxian committed
157 158 159 160 161 162 163 164 165
            }
          >
            <Icon type="info-circle-o" />
          </Tooltip>
        }
        total="78%"
        footer={
          <div style={{ whiteSpace: 'nowrap', overflow: 'hidden' }}>
            <Trend flag="up" style={{ marginRight: 16 }}>
166 167 168 169
              <FormattedMessage
                id="dashboard-analysis.analysis.week"
                defaultMessage="Weekly Changes"
              />
duanledexianxianxian's avatar
duanledexianxianxian committed
170 171 172
              <span className={styles.trendText}>12%</span>
            </Trend>
            <Trend flag="down">
173 174 175 176
              <FormattedMessage
                id="dashboard-analysis.analysis.day"
                defaultMessage="Weekly Changes"
              />
duanledexianxianxian's avatar
duanledexianxianxian committed
177 178 179 180 181 182 183 184 185 186 187 188 189
              <span className={styles.trendText}>11%</span>
            </Trend>
          </div>
        }
        contentHeight={46}
      >
        <MiniProgress percent={78} strokeWidth={8} target={80} color="#13C2C2" />
      </ChartCard>
    </Col>
  </Row>
);

export default IntroduceRow;