|
1 |
| -import React from 'react'; |
| 1 | +import React from "react"; |
2 | 2 | import { connect } from "react-redux";
|
3 | 3 | import "react-dom";
|
4 | 4 |
|
5 | 5 | import Spinner from "react-svg-spinner";
|
6 | 6 |
|
| 7 | +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; |
| 8 | +import { faFile } from "@fortawesome/free-solid-svg-icons"; |
| 9 | +import { faGithub } from "@fortawesome/free-brands-svg-icons"; |
| 10 | +import classNames from "classnames"; |
7 | 11 | import DateRangePicker from "./DateRangePicker";
|
8 |
| -import DownloadButton from './DownloadButton'; |
9 |
| -import RefreshButton from './RefreshButton'; |
10 |
| -import SlackIcon from './SlackIcon'; |
| 12 | +import RefreshButton from "./RefreshButton"; |
| 13 | +import SlackIcon from "./SlackIcon"; |
11 | 14 | import Label from "./Label";
|
12 | 15 | import NameSelector from "./NameSelector";
|
13 | 16 |
|
14 |
| -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; |
15 |
| -import { faFile } from '@fortawesome/free-solid-svg-icons'; |
16 |
| -import { faGithub } from '@fortawesome/free-brands-svg-icons'; |
17 |
| - |
18 |
| -import classNames from "classnames"; |
19 |
| - |
20 | 17 | import { fetchNames } from "../redux/actions";
|
21 | 18 |
|
22 |
| -class Header extends React.Component { |
23 |
| - constructor(props) { |
24 |
| - super(props); |
25 |
| - } |
26 |
| - |
27 |
| - |
28 |
| - |
29 |
| - render() { |
30 |
| - return <div className="navbar"> |
31 |
| - <h1 className="logo"></h1> |
32 |
| - <div className={ |
33 |
| - classNames("labels", { visible: !this.props.areNamesLoading }) |
34 |
| - }> |
35 |
| - <NameSelector/> |
36 |
| - {this.props.labels.filter(x => x.name !== "__name__").map(function(label) { |
37 |
| - return <Label key={label.name} label={label}></Label>; |
| 19 | +function Header(props) { |
| 20 | + const { areNamesLoading, isJSONLoading, labels } = props; |
| 21 | + return ( |
| 22 | + <div className="navbar"> |
| 23 | + <h1 className="logo" /> |
| 24 | + <div |
| 25 | + className={classNames("labels", { |
| 26 | + visible: !areNamesLoading, |
38 | 27 | })}
|
| 28 | + > |
| 29 | + <NameSelector /> |
| 30 | + {labels |
| 31 | + .filter((x) => x.name !== "__name__") |
| 32 | + .map((label) => ( |
| 33 | + <Label key={label.name} label={label} /> |
| 34 | + ))} |
39 | 35 | </div>
|
40 | 36 | {/* <div className={
|
41 |
| - classNames("navbar-spinner-container", { |
42 |
| - visible: this.props.areNamesLoading |
43 |
| - }) |
44 |
| - }> |
45 |
| - <Spinner color="rgba(255,255,255,0.6)" size="20px"/> |
46 |
| - </div> */} |
| 37 | + classNames("navbar-spinner-container", { |
| 38 | + visible: this.props.areNamesLoading |
| 39 | + }) |
| 40 | + }> |
| 41 | + <Spinner color="rgba(255,255,255,0.6)" size="20px"/> |
| 42 | + </div> */} |
47 | 43 | {/* <LabelsFilter /> */}
|
48 |
| - <div className="navbar-space-filler"></div> |
| 44 | + <div className="navbar-space-filler" /> |
49 | 45 | <div className="navbar-links">
|
50 |
| - <span className="navbar-link"><FontAwesomeIcon icon={faFile} /> <a target="_blank" href="https://pyroscope.io/docs">Docs</a></span> |
51 |
| - <span className="navbar-link"><SlackIcon/> <a target="_blank" href="https://pyroscope.io/slack">Slack</a></span> |
52 |
| - <span className="navbar-link"><FontAwesomeIcon icon={faGithub} /> <a target="_blank" href="https://github.com/pyroscope-io/pyroscope">GitHub</a></span> |
| 46 | + <span className="navbar-link"> |
| 47 | + <FontAwesomeIcon icon={faFile} /> |
| 48 | + |
| 49 | + <a rel="noreferrer" target="_blank" href="https://pyroscope.io/docs"> |
| 50 | + Docs |
| 51 | + </a> |
| 52 | + </span> |
| 53 | + <span className="navbar-link"> |
| 54 | + <SlackIcon /> |
| 55 | + |
| 56 | + <a rel="noreferrer" target="_blank" href="https://pyroscope.io/slack"> |
| 57 | + Slack |
| 58 | + </a> |
| 59 | + </span> |
| 60 | + <span className="navbar-link"> |
| 61 | + <FontAwesomeIcon icon={faGithub} /> |
| 62 | + |
| 63 | + <a |
| 64 | + rel="noreferrer" |
| 65 | + target="_blank" |
| 66 | + href="https://github.com/pyroscope-io/pyroscope" |
| 67 | + > |
| 68 | + GitHub |
| 69 | + </a> |
| 70 | + </span> |
53 | 71 | </div>
|
54 |
| - <div className={ |
55 |
| - classNames("navbar-spinner-container", { |
56 |
| - visible: this.props.isJSONLoading |
57 |
| - }) |
58 |
| - }> |
59 |
| - <Spinner color="rgba(255,255,255,0.6)" size="20px"/> |
| 72 | + <div |
| 73 | + className={classNames("navbar-spinner-container", { |
| 74 | + visible: isJSONLoading, |
| 75 | + })} |
| 76 | + > |
| 77 | + <Spinner color="rgba(255,255,255,0.6)" size="20px" /> |
60 | 78 | </div>
|
61 | 79 |
|
62 |
| - <RefreshButton/> |
| 80 | + <RefreshButton /> |
63 | 81 |
|
64 | 82 | <DateRangePicker />
|
65 | 83 | </div>
|
66 |
| - } |
| 84 | + ); |
67 | 85 | }
|
68 | 86 |
|
69 |
| -export default connect( |
70 |
| - (x) => x, |
71 |
| - { fetchNames } |
72 |
| -)(Header); |
| 87 | +export default connect((x) => x, { fetchNames })(Header); |
0 commit comments