react-icons/md#MdCloudDownload TypeScript Examples

The following examples show how to use react-icons/md#MdCloudDownload. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: statistics.tsx    From frontend with Apache License 2.0 4 votes vote down vote up
Statistics = ({ stats }: { stats: Statistics }): JSX.Element => {
  const { t } = useTranslation()
  let country_data: { country: string; value: number }[] = []
  if (stats.countries) {
    for (const [key, value] of Object.entries(stats.countries)) {
      country_data.push({ country: key, value: value })
    }
  }

  let downloads_labels: string[] = []
  let downloads_data: number[] = []
  if (stats.downloads_per_day) {
    for (const [key, value] of Object.entries(stats.downloads_per_day)) {
      downloads_labels.push(key)
      downloads_data.push(value)
    }
  }

  // Remove current day
  downloads_labels.pop()
  downloads_data.pop()

  const data = chartStyle(downloads_labels, downloads_data, t('downloads'))

  const options = chartOptions(i18n.language)

  return (
    <Main>
      <NextSeo title={t('statistics')} description={t('flathub-statistics')} />
      <div className='main-container'>
        <h1>{t('statistics')}</h1>
        <div className={styles.stats}>
          <ListBox
            items={[
              {
                icon: <MdCloudDownload />,
                header: t('count-downloads'),
                content: {
                  type: 'text',
                  text: stats.downloads?.toLocaleString(),
                },
              },
            ]}
          />
          <ListBox
            items={[
              {
                icon: <MdFormatListNumbered />,
                header: t('count-applications'),
                content: {
                  type: 'text',
                  text: stats.number_of_apps?.toLocaleString(),
                },
              },
            ]}
          />
          <ListBox
            items={[
              {
                icon: <MdCalendarToday />,
                header: t('since'),
                content: {
                  type: 'text',
                  text: new Date(2018, 3, 29).toLocaleDateString(i18n.language.substring(0, 2)),
                },
              },
            ]}
          />
        </div>
        <div className={styles.downloadStats}>{ }</div>
        <h3>{t('downloads-per-country')}</h3>
        <div className={styles.map}>
          <WorldMap
            color='var(--color-primary)'
            backgroundColor='var(--bg-color-secondary)'
            borderColor='var(--text-primary)'
            valueSuffix='downloads'
            size='responsive'
            data={country_data}
          />
        </div>
        <h3>{t('downloads-over-time')}</h3>
        <div className={styles.downloadsOverTime}>
          <Line data={data} options={options} />
        </div>
      </div>
    </Main>
  )
}
Example #2
Source File: AdditionalInfo.tsx    From frontend with Apache License 2.0 4 votes vote down vote up
AdditionalInfo = ({
  data,
  summary,
  appId,
  stats,
}: {
  data: Appstream
  summary?: Summary
  appId: string
  stats: AppStats
}) => {
  const { t } = useTranslation()
  const license = getLicense(data.project_license, t)

  const licenseIsLink = data.project_license?.startsWith(
    'LicenseRef-proprietary='
  )

  return (
    <div className={styles.additionalInfo}>
      <ListBox
        appId={appId}
        items={[
          {
            icon: <BsHddFill />,
            header: t('installed-size'),
            content: {
              type: 'text',
              text: summary ? `~${calculateHumanReadableSize(summary.installed_size)}` : t('unknown'),
            },
          },
        ]}
      ></ListBox>
      <ListBox
        appId={appId}
        items={[
          {
            icon: <MdDownload />,
            header: t('download-size'),
            content: {
              type: 'text',
              text: summary ? calculateHumanReadableSize(summary.download_size) : t('unknown'),
            },
          },
        ]}
      ></ListBox>
      {/* {data.content_rating} */}
      <ListBox
        appId={appId}
        items={[
          {
            icon: <MdLaptop />,
            header: t('available-architectures'),
            content: { type: 'text', text: summary ? summary.arches.join(', ') : t('unknown') },
          },
        ]}
      ></ListBox>
      <ListBox
        appId={appId}
        items={[
          {
            icon: <MdCloudDownload />,
            header: t('downloads'),
            content: {
              type: 'text',
              text: stats.downloads_total.toLocaleString(),
            },
          },
        ]}
      ></ListBox>
      {license && (
        <ListBox
          appId={appId}
          items={[
            {
              icon: <BsTextParagraph />,
              header: t('license'),
              content: {
                type: licenseIsLink ? 'url' : 'text',
                text: license,
                trackAsEvent: 'License',
              },
            },
          ]}
        ></ListBox>
      )}
      {data.urls?.homepage && (
        <ListBox
          appId={appId}
          items={[
            data.urls.homepage
              ? {
                content: {
                  type: 'url',
                  text: data.urls.homepage,
                  trackAsEvent: 'Homepage',
                },
                icon: <MdWeb />,
                header: t('project-website'),
              }
              : undefined,
          ]}
        />
      )}
      {data.urls?.contact && (
        <ListBox
          appId={appId}
          items={[
            data.urls.contact
              ? {
                content: {
                  type: 'url',
                  text: data.urls.contact,
                  trackAsEvent: 'Contact',
                },
                icon: <MdContactPage />,
                header: t('contact'),
              }
              : undefined,
          ]}
        />
      )}
      {data.urls?.help && (
        <ListBox
          appId={appId}
          items={[
            data.urls.help
              ? {
                content: {
                  type: 'url',
                  text: data.urls.help,
                  trackAsEvent: 'Help',
                },
                icon: <MdHelp />,
                header: t('help'),
              }
              : undefined,
          ]}
        />
      )}
      {data.urls?.faq && (
        <ListBox
          appId={appId}
          items={[
            data.urls.faq
              ? {
                content: {
                  type: 'url',
                  text: data.urls.faq,
                  trackAsEvent: 'Faq',
                },
                icon: <MdQuestionAnswer />,
                header: t('frequently-asked-questions'),
              }
              : undefined,
          ]}
        />
      )}
      {data.urls?.translate && (
        <ListBox
          appId={appId}
          items={[
            data.urls.translate
              ? {
                icon: <MdTranslate />,
                header: t('contribute-translations'),
                content: {
                  type: 'url',
                  text: data.urls.translate,
                  trackAsEvent: 'Translate',
                },
              }
              : undefined,
          ]}
        />
      )}
      {data.urls?.bugtracker && (
        <ListBox
          appId={appId}
          items={[
            data.urls.bugtracker
              ? {
                icon: <MdOutlineBugReport />,
                header: t('report-an-issue'),
                content: {
                  type: 'url',
                  text: data.urls.bugtracker,
                  trackAsEvent: 'Bugtracker',
                },
              }
              : undefined,
          ]}
        />
      )}
      <ListBox
        appId={appId}
        items={[
          {
            icon: <MdCloudDownload />,
            header: t('manifest'),
            content: {
              type: 'url',
              text: data.metadata?.['Flathub::manifest'] ?? `https://github.com/flathub/${appId}`,
              trackAsEvent: "Manifest"
            },
          },
        ]}
      ></ListBox>
    </div>
  )
}