Browse Source

Merge pull request #551 from gre/drop-role

remove this concept of data-role
master
Meriadec Pillet 7 years ago
committed by GitHub
parent
commit
87d990fa27
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      src/components/base/SideBar/SideBarListItem.js
  2. 18
      src/logger.js
  3. 22
      src/renderer/init.js

1
src/components/base/SideBar/SideBarListItem.js

@ -31,7 +31,6 @@ class SideBarListItem extends PureComponent<Props> {
} = this.props
return (
<Container
data-role="side-bar-item"
isActive={!disabled && isActive}
iconActiveColor={iconActiveColor}
onClick={disabled ? null : onClick}

18
src/logger.js

@ -47,28 +47,10 @@ const makeSerializableLog = (o: mixed) => {
return String(o)
}
const logClicks = !__DEV__ || process.env.DEBUG_CLICK_ELEMENT
const logRedux = !__DEV__ || process.env.DEBUG_ACTION
const logTabkey = __DEV__ || process.env.DEBUG_TAB_KEY
export default {
// tracks the user interactions (click, input focus/blur, what else?)
onClickElement: (role: string, roleData: ?Object) => {
const label = `👆 ${role}`
if (roleData) {
if (logClicks) {
console.log(label, roleData)
}
addLog('click', label, roleData)
} else {
if (logClicks) {
console.log(label)
}
addLog('click', label, roleData)
}
},
// tracks Redux actions (NB not all actions are serializable)
onReduxAction: (action: Object) => {

22
src/renderer/init.js

@ -85,34 +85,12 @@ async function init() {
const libcoreVersion = await libcoreGetVersion.send().toPromise()
logger.log('libcore', libcoreVersion)
// DOM elements can have a data-role that identify the UI entity
// and that allow us to track interactions with this.
window.addEventListener('click', ({ target }) => {
const { dataset } = target
if (dataset) {
const { role, roledata } = dataset
if (role) {
logger.onClickElement(role, roledata)
}
}
})
window.addEventListener('keydown', (e: SyntheticKeyboardEvent<any>) => {
if (e.which === TAB_KEY) {
if (!isGlobalTabEnabled()) enableGlobalTab()
logger.onTabKey(document.activeElement)
}
})
window.addEventListener('click', ({ target }) => {
const { dataset } = target
if (dataset) {
const { role, roledata } = dataset
if (role) {
logger.onClickElement(role, roledata)
}
}
})
}
}

Loading…
Cancel
Save