diff --git a/app/javascript/src/scenes/SettingsPage/scenes/team/index.jsx b/app/javascript/src/scenes/SettingsPage/scenes/team/index.jsx index 61d5e1c02..97cd78734 100644 --- a/app/javascript/src/scenes/SettingsPage/scenes/team/index.jsx +++ b/app/javascript/src/scenes/SettingsPage/scenes/team/index.jsx @@ -5,7 +5,7 @@ import { Breadcrumb, Row, Col, Glyphicon, Well } from "react-bootstrap"; import { LinkContainer } from "react-router-bootstrap"; import { FormattedHTMLMessage, FormattedMessage } from "react-intl"; import moment from "moment"; -import prettysize from "prettysize"; +import { formatBytes } from "../../../../services/helpers/units_converter_helper"; import axios from "../../../../config/axios"; import { SETTINGS_TEAMS_ROUTE } from "../../../../config/routes"; @@ -25,7 +25,9 @@ const Wrapper = styled.div` padding: 16px 15px 50px 15px; `; -const TabTitle = styled.div`padding: 15px;`; +const TabTitle = styled.div` + padding: 15px; +`; const BadgeWrapper = styled.div` font-size: 1.4em; @@ -39,7 +41,8 @@ const StyledWell = styled(Well)` padding: 9px; & > span { padding-left: 5px; - }`; + } +`; const StyledDescriptionWell = styled(Well)` padding: 9px; @@ -59,7 +62,9 @@ const StyledH3 = styled.h3` } `; -const StyledOl = styled.ol`padding: 15px;`; +const StyledOl = styled.ol` + padding: 15px; +`; class SettingsTeam extends Component { constructor(props) { @@ -132,7 +137,7 @@ class SettingsTeam extends Component { renderEditNameModel() { if (this.state.showNameModal) { - return( + return ( @@ -208,9 +213,7 @@ class SettingsTeam extends Component { - - {this.renderDescription()} - + {this.renderDescription()} diff --git a/app/javascript/src/services/helpers/units_converter_helper.js b/app/javascript/src/services/helpers/units_converter_helper.js new file mode 100644 index 000000000..9a0f7ace5 --- /dev/null +++ b/app/javascript/src/services/helpers/units_converter_helper.js @@ -0,0 +1,9 @@ +// @flow + +export function formatBytes(bytes: number) { + if (bytes === 0) return "0 Bytes"; + const k = 1024; + const sizes = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"]; + const i = Math.floor(Math.log(bytes) / Math.log(k)); + return `${parseFloat((bytes / Math.pow(k, i)).toFixed(2))} ${sizes[i]}`; +} diff --git a/package.json b/package.json index 2f6411d81..35dea8538 100644 --- a/package.json +++ b/package.json @@ -63,7 +63,6 @@ "postcss-loader": "^2.0.6", "postcss-smart-import": "^0.7.5", "precss": "^2.0.0", - "prettysize": "^1.1.0", "prop-types": "^15.5.10", "rails-erb-loader": "^5.0.2", "react": "15.6.1", diff --git a/yarn.lock b/yarn.lock index 4dd03a601..1969b94a3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4815,10 +4815,6 @@ prettier@^1.7.0: version "1.7.4" resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.7.4.tgz#5e8624ae9363c80f95ec644584ecdf55d74f93fa" -prettysize@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/prettysize/-/prettysize-1.1.0.tgz#c6c52f87161ff172ea435f375f99831dd9a97bb0" - private@^0.1.6, private@^0.1.7: version "0.1.7" resolved "https://registry.yarnpkg.com/private/-/private-0.1.7.tgz#68ce5e8a1ef0a23bb570cc28537b5332aba63ef1"