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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
0 additions and
41 deletions
-
src/components/base/SideBar/SideBarListItem.js
-
src/logger.js
-
src/renderer/init.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} |
|
|
|
|
|
@ -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) => { |
|
|
|
|
|
@ -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) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|