Skip to content
This repository has been archived by the owner on Dec 13, 2020. It is now read-only.

Commit

Permalink
Rename keymap keys to new flat structure
Browse files Browse the repository at this point in the history
Issue #1283
  • Loading branch information
pablosichert committed Nov 16, 2017
1 parent 0f6fca4 commit 1fcacd6
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 68 deletions.
24 changes: 12 additions & 12 deletions src/components/app/Modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ class Modal extends Component {
onClick={this.removeModal}
tabIndex={0}
onMouseEnter={() => this.toggleTooltip(
keymap.MODAL_CONTEXT.CANCEL
keymap.CANCEL
)}
onMouseLeave={this.toggleTooltip}
>
Expand All @@ -367,10 +367,10 @@ class Modal extends Component {
)}

{(isTooltipShow ===
keymap.MODAL_CONTEXT.CANCEL
keymap.CANCEL
) && (
<Tooltips
name={keymap.MODAL_CONTEXT.CANCEL}
name={keymap.CANCEL}
action={counterpart.translate(
'modal.actions.cancel',
)}
Expand All @@ -390,8 +390,8 @@ class Modal extends Component {
tabIndex={0}
onMouseEnter={() => this.toggleTooltip(
modalType === 'process' ?
keymap.MODAL_CONTEXT.CANCEL :
keymap.MODAL_CONTEXT.APPLY
keymap.CANCEL :
keymap.APPLY
)}
onMouseLeave={this.toggleTooltip}
>
Expand All @@ -404,13 +404,13 @@ class Modal extends Component {
}

{isTooltipShow === (modalType === 'process' ?
keymap.MODAL_CONTEXT.CANCEL :
keymap.MODAL_CONTEXT.APPLY
keymap.CANCEL :
keymap.APPLY
) && (
<Tooltips
name={modalType === 'process' ?
keymap.MODAL_CONTEXT.CANCEL :
keymap.MODAL_CONTEXT.APPLY
keymap.CANCEL :
keymap.APPLY
}
action={modalType === 'process' ?
counterpart.translate(
Expand All @@ -434,7 +434,7 @@ class Modal extends Component {
onClick={this.handleStart}
tabIndex={0}
onMouseEnter={() => this.toggleTooltip(
keymap.MODAL_CONTEXT.APPLY
keymap.APPLY
)}
onMouseLeave={this.toggleTooltip}
>
Expand All @@ -443,10 +443,10 @@ class Modal extends Component {
)}

{(isTooltipShow ===
keymap.MODAL_CONTEXT.APPLY
keymap.APPLY
) && (
<Tooltips
name={keymap.MODAL_CONTEXT.APPLY}
name={keymap.APPLY}
action={counterpart.translate(
'modal.actions.start',
)}
Expand Down
2 changes: 1 addition & 1 deletion src/components/app/QuickActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ class QuickActions extends Component {
{isTooltip &&
<Tooltips
name={
keymap.QUICK_ACTIONS.QUICK_ACTION_TOGGLE
keymap.QUICK_ACTION_TOGGLE
}
action={
'Toggle list'
Expand Down
2 changes: 1 addition & 1 deletion src/components/app/RawModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ class RawModal extends Component {
{counterpart.translate('modal.actions.done')}
{isTooltipShow &&
<Tooltips
name={keymap.MODAL_CONTEXT.APPLY}
name={keymap.APPLY}
action={counterpart.translate('modal.actions.done')}
type={''}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/components/filters/FiltersItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ class FiltersItem extends Component {
{counterpart.translate('window.apply.caption')}
{isTooltipShow &&
<Tooltips
name={keymap.MODAL_CONTEXT.APPLY}
name={keymap.APPLY}
action={counterpart.translate('window.apply.caption')}
type={''}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/components/header/Breadcrumb.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ class Breadcrumb extends Component {
{tooltipOpen &&
<Tooltips
extraClass="tooltip-home-menu"
name={keymap.GLOBAL_CONTEXT.OPEN_NAVIGATION_MENU}
name={keymap.OPEN_NAVIGATION_MENU}
action= {
counterpart.translate(
'mainScreen.navigation.tooltip'
Expand Down
48 changes: 13 additions & 35 deletions src/components/header/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -342,9 +342,7 @@ class Header extends Component {
}
onMouseEnter={() =>
this.toggleTooltip(
keymap
.GLOBAL_CONTEXT
.OPEN_ACTIONS_MENU
keymap.OPEN_ACTIONS_MENU
)
}
onMouseLeave={() => this.toggleTooltip('')}
Expand All @@ -360,12 +358,10 @@ class Header extends Component {
<i className="meta-icon-more" />

{tooltipOpen ===
keymap.GLOBAL_CONTEXT.OPEN_ACTIONS_MENU
keymap.OPEN_ACTIONS_MENU
&& <Tooltips
name={
keymap
.GLOBAL_CONTEXT
.OPEN_ACTIONS_MENU
keymap.OPEN_ACTIONS_MENU
}
action={
counterpart.translate(
Expand Down Expand Up @@ -404,9 +400,7 @@ class Header extends Component {
onClick={() => this.toggleTooltip('')}
onMouseEnter={() =>
this.toggleTooltip(
keymap
.GLOBAL_CONTEXT
.DOC_STATUS
keymap.DOC_STATUS
)
}
onMouseLeave={() =>
Expand All @@ -426,14 +420,10 @@ class Header extends Component {
{...docStatus}
/>
{ tooltipOpen ===
keymap
.GLOBAL_CONTEXT
.DOC_STATUS
keymap.DOC_STATUS
&& <Tooltips
name={
keymap
.GLOBAL_CONTEXT
.DOC_STATUS
keymap.DOC_STATUS
}
action= {
counterpart.translate(
Expand All @@ -459,9 +449,7 @@ class Header extends Component {
)}
onMouseEnter={() =>
this.toggleTooltip(
keymap
.GLOBAL_CONTEXT
.OPEN_INBOX_MENU
keymap.OPEN_INBOX_MENU
)
}
onMouseLeave={() => this.toggleTooltip('')}
Expand All @@ -481,14 +469,10 @@ class Header extends Component {
}
</span>
{ tooltipOpen ===
keymap
.GLOBAL_CONTEXT
.OPEN_INBOX_MENU &&
keymap.OPEN_INBOX_MENU &&
<Tooltips
name={
keymap
.GLOBAL_CONTEXT
.OPEN_INBOX_MENU
keymap.OPEN_INBOX_MENU
}
action= {
counterpart.translate(
Expand All @@ -513,7 +497,7 @@ class Header extends Component {
disableOnClickOutside={!isUDOpen}
redirect={this.redirect}
shortcut={
keymap.GLOBAL_CONTEXT.OPEN_AVATAR_MENU
keymap.OPEN_AVATAR_MENU
}
toggleTooltip={this.toggleTooltip}
tooltipOpen={tooltipOpen}
Expand All @@ -536,9 +520,7 @@ class Header extends Component {
}}
onMouseEnter={() =>
this.toggleTooltip(
keymap
.GLOBAL_CONTEXT
.OPEN_SIDEBAR_MENU_0
keymap.OPEN_SIDEBAR_MENU_0
)
}
onMouseLeave={() =>
Expand All @@ -547,14 +529,10 @@ class Header extends Component {
>
<i className="meta-icon-list" />
{ tooltipOpen ===
keymap
.GLOBAL_CONTEXT
.OPEN_SIDEBAR_MENU_0 &&
keymap.OPEN_SIDEBAR_MENU_0 &&
<Tooltips
name={
keymap
.GLOBAL_CONTEXT
.OPEN_SIDEBAR_MENU_0
keymap.OPEN_SIDEBAR_MENU_0
}
action={counterpart.translate(
/* eslint-disable max-len */
Expand Down
16 changes: 8 additions & 8 deletions src/components/header/SubHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,47 +187,47 @@ class Subheader extends Component {
},
icon: 'meta-icon-edit',
caption: counterpart.translate('window.advancedEdit.caption'),
hotkey: keymap.GLOBAL_CONTEXT.OPEN_ADVANCED_EDIT
hotkey: keymap.OPEN_ADVANCED_EDIT
}, {
action: 'clone',
handler: () => {
handleClone(windowType, dataId);
},
icon: 'meta-icon-duplicate',
caption: counterpart.translate('window.clone.caption'),
hotkey: keymap.GLOBAL_CONTEXT.CLONE_DOCUMENT
hotkey: keymap.CLONE_DOCUMENT
}, {
action: 'email',
handler: () => {
handleEmail();
},
icon: 'meta-icon-mail',
caption: counterpart.translate('window.email.caption'),
hotkey: keymap.GLOBAL_CONTEXT.OPEN_EMAIL
hotkey: keymap.OPEN_EMAIL
}, {
action: 'letter',
handler: () => {
handleLetter();
},
icon: 'meta-icon-letter',
caption: counterpart.translate('window.letter.caption'),
hotkey: keymap.GLOBAL_CONTEXT.OPEN_LETTER
hotkey: keymap.OPEN_LETTER
}, {
action: 'print',
handler: () => {
handlePrint(windowType, dataId, docNo);
},
icon: 'meta-icon-print',
caption: counterpart.translate('window.Print.caption'),
hotkey: keymap.GLOBAL_CONTEXT.OPEN_PRINT_RAPORT
hotkey: keymap.OPEN_PRINT_RAPORT
}, {
action: 'delete',
handler: () => {
handleDelete();
},
icon: 'meta-icon-delete',
caption: counterpart.translate('window.Delete.caption'),
hotkey: keymap.GLOBAL_CONTEXT.DELETE_DOCUMENT
hotkey: keymap.DELETE_DOCUMENT
}]
.filter(docLink => standardActions.has(docLink.action))
.map(docLink => {
Expand Down Expand Up @@ -297,7 +297,7 @@ class Subheader extends Component {
{counterpart.translate('window.new.caption')}

<span className="tooltip-inline">
{keymap.GLOBAL_CONTEXT.NEW_DOCUMENT}
{keymap.NEW_DOCUMENT}
</span>
</div>
)}
Expand Down Expand Up @@ -328,7 +328,7 @@ class Subheader extends Component {
counterpart.translate('window.openEditMode')
}
<span className="tooltip-inline">
{keymap.GLOBAL_CONTEXT.TOGGLE_EDIT_MODE}
{keymap.TOGGLE_EDIT_MODE}
</span>
</div>}
</div>
Expand Down
6 changes: 3 additions & 3 deletions src/components/table/TableContextMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ class TableContextMenu extends Component {
>
<i className="meta-icon-edit" /> Advanced edit
<span className="tooltip-inline">
{keymap.DOCUMENT_LIST_CONTEXT.ADVANCED_EDIT}
{keymap.ADVANCED_EDIT}
</span>
</div>
}
Expand All @@ -165,7 +165,7 @@ class TableContextMenu extends Component {
>
<i className="meta-icon-file" /> Open in new tab
<span className="tooltip-inline">
{keymap.DOCUMENT_LIST_CONTEXT.OPEN_SELECTED}
{keymap.OPEN_SELECTED}
</span>
</div>
}
Expand All @@ -174,7 +174,7 @@ class TableContextMenu extends Component {
<div className="context-menu-item" onClick={handleDelete}>
<i className="meta-icon-trash" /> Delete
<span className="tooltip-inline">
{keymap.DOCUMENT_LIST_CONTEXT.REMOVE_SELECTED}
{keymap.REMOVE_SELECTED}
</span>
</div>
}
Expand Down
12 changes: 6 additions & 6 deletions src/components/table/TableFilter.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class TableFilter extends Component {
onClick={handleBatchEntryToggle}
onMouseEnter={() =>
this.toggleTooltip(
keymap.TABLE_CONTEXT.TOGGLE_QUICK_INPUT
keymap.TOGGLE_QUICK_INPUT
)
}
onMouseLeave={this.toggleTooltip}
Expand All @@ -61,10 +61,10 @@ class TableFilter extends Component {
'window.batchEntry.caption'
)}
{isTooltipShow ===
keymap.TABLE_CONTEXT.TOGGLE_QUICK_INPUT &&
keymap.TOGGLE_QUICK_INPUT &&
<Tooltips
name={
keymap.TABLE_CONTEXT.TOGGLE_QUICK_INPUT
keymap.TOGGLE_QUICK_INPUT
}
action={
isBatchEntry ?
Expand Down Expand Up @@ -95,17 +95,17 @@ class TableFilter extends Component {
className="btn-icon btn-meta-outline-secondary pointer"
onClick={() => toggleFullScreen(!fullScreen)}
onMouseEnter={() =>
this.toggleTooltip(keymap.TABLE_CONTEXT.TOGGLE_EXPAND)
this.toggleTooltip(keymap.TOGGLE_EXPAND)
}
onMouseLeave={this.toggleTooltip}
tabIndex="-1"
>
{fullScreen ? <i className="meta-icon-collapse"/> :
<i className="meta-icon-fullscreen"/>}

{isTooltipShow === keymap.TABLE_CONTEXT.TOGGLE_EXPAND &&
{isTooltipShow === keymap.TOGGLE_EXPAND &&
<Tooltips
name={keymap.TABLE_CONTEXT.TOGGLE_EXPAND}
name={keymap.TOGGLE_EXPAND}
action={fullScreen ?
counterpart.translate(
'window.table.collapse') :
Expand Down

0 comments on commit 1fcacd6

Please sign in to comment.