Skip to content

Commit

Permalink
Remove unused imports
Browse files Browse the repository at this point in the history
  • Loading branch information
kyle-ssg committed May 13, 2024
1 parent a56e6cc commit df93e46
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 69 deletions.
20 changes: 17 additions & 3 deletions frontend/common/utils/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,6 @@ const Utils = Object.assign({}, require('./base/_utils'), {
)
return !!found
},

getProjectColour(index: number) {
return Constants.projectColors[index % (Constants.projectColors.length - 1)]
},
Expand All @@ -409,6 +408,7 @@ const Utils = Object.assign({}, require('./base/_utils'), {
}
return Project.api
},

getShouldHideIdentityOverridesTab(_project: ProjectType) {
const project = _project || ProjectStore.model
if (!Utils.getIsEdge()) {
Expand All @@ -422,7 +422,6 @@ const Utils = Object.assign({}, require('./base/_utils'), {
!project.show_edge_identity_overrides_for_feature)
)
},

getShouldSendIdentityToTraits(_project: ProjectType) {
const project = _project || ProjectStore.model
if (project && project.use_edge_identities) {
Expand Down Expand Up @@ -519,6 +518,7 @@ const Utils = Object.assign({}, require('./base/_utils'), {
},

isSaas: () => global.flagsmithVersion?.backend?.is_saas,

isValidNumber(value: any) {
return /^-?\d*\.?\d+$/.test(`${value}`)
},
Expand Down Expand Up @@ -553,7 +553,6 @@ const Utils = Object.assign({}, require('./base/_utils'), {
zE('messenger', 'open')
}
},

removeElementFromArray(array: any[], index: number) {
return array.slice(0, index).concat(array.slice(index + 1))
},
Expand All @@ -567,12 +566,27 @@ const Utils = Object.assign({}, require('./base/_utils'), {
</Tooltip>
)
},

sanitiseDiffString: (value: FlagsmithValue) => {
if (value === undefined || value == null) {
return ''
}
return `${value}`
},
setClipboard: (
message: string,
successString = 'Clipboard set',
errorString = 'Could not set clipboard',
) => {
navigator.clipboard
.writeText(message)
.then((res) => {
toast(successString)
})
.catch((res) => {
toast(errorString, 'danger')
})
},
tagDisabled: (tag: Tag | undefined) => {
const hasStaleFlagsPermission = Utils.getPlansPermission('STALE_FLAGS')
return tag?.type === 'STALE' && !hasStaleFlagsPermission
Expand Down
49 changes: 0 additions & 49 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@
"node-fetch": "2.6.7",
"node-sass": "^9.0.0",
"pipedrive": "^20.3.0",
"polyfill-react-native": "1.0.5",
"postcss-loader": "4.3.0",
"prettier": "^2.5.1",
"prismjs": "^1.29.0",
Expand Down
7 changes: 1 addition & 6 deletions frontend/web/components/CodeHelp.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React, { Component } from 'react'
import Highlight from './Highlight'
import ConfigProvider from 'common/providers/ConfigProvider'
import Constants from 'common/constants'
import { Clipboard } from 'polyfill-react-native'
import Icon from './Icon'
import { logoGithub, document } from 'ionicons/icons'
import { IonIcon } from '@ionic/react'
Expand Down Expand Up @@ -93,11 +92,7 @@ const CodeHelp = class extends Component {
}

copy = (s) => {
const res = Clipboard.setString(s)
toast(
res ? 'Clipboard set' : 'Could not set clipboard :(',
res ? '' : 'danger',
)
Utils.setClipboard(s)
}

render() {
Expand Down
7 changes: 1 addition & 6 deletions frontend/web/components/ValueEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React, { Component } from 'react'
import cx from 'classnames'
import Highlight from './Highlight'
import ConfigProvider from 'common/providers/ConfigProvider'
import { Clipboard } from 'polyfill-react-native'
import Icon from './Icon'

const toml = require('toml')
Expand Down Expand Up @@ -197,11 +196,7 @@ class ValueEditor extends Component {
</span>
<span
onMouseDown={() => {
const res = Clipboard.setString(this.props.value)
toast(
res ? 'Clipboard set' : 'Could not set clipboard :(',
res ? '' : 'danger',
)
Utils.setClipboard(this.props.value)
}}
className={cx('txt primary')}
>
Expand Down
4 changes: 0 additions & 4 deletions frontend/web/project/polyfil.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import Promise from 'promise-polyfill'
import 'whatwg-fetch'
import { AppState, Clipboard, NetInfo } from 'polyfill-react-native'
import Switch from 'components/Switch'

window.AppState = AppState
window.NetInfo = NetInfo
window.Clipboard = Clipboard
window.Switch = Switch

// To add to window
Expand Down

0 comments on commit df93e46

Please sign in to comment.