diff --git a/src/common/classes.js b/src/common/classes.js index f20587caa..bea33a718 100644 --- a/src/common/classes.js +++ b/src/common/classes.js @@ -66,6 +66,7 @@ const CLASSES = { PREFERENCES_PAGE_INSIDE_CONTENT_USERS: 'preferences-page__inside-content--users', PREFERENCES_PAGE_INSIDE_CONTENT_CURRENCIES: 'preferences-page__inside-content--currencies', PREFERENCES_PAGE_INSIDE_CONTENT_ACCOUNTANT: 'preferences-page__inside-content--accountant', + PREFERENCES_PAGE_INSIDE_CONTENT_SMS_INTEGRATION: 'preferences-page__inside-content--sms-integration', FINANCIAL_REPORT_INSIDER: 'dashboard__insider--financial-report', diff --git a/src/components/Button/ButtonLink.js b/src/components/Button/ButtonLink.js index 9b9cb7b5b..655cdc615 100644 --- a/src/components/Button/ButtonLink.js +++ b/src/components/Button/ButtonLink.js @@ -1,23 +1,13 @@ import styled from 'styled-components'; -import { Button } from '@blueprintjs/core'; -export const ButtonLink = styled(Button)` - line-height: inherit; +export const ButtonLink = styled.button` + color: #0052cc; + border: 0; + background: transparent; + cursor: pointer; - &.bp3-small { - min-height: auto; - min-width: auto; - padding: 0; - } - &:not([class*='bp3-intent-']) { - &, - &:hover { - color: #0052cc; - background: transparent; - } - - &:hover { - text-decoration: underline; - } + &:hover, + &:active { + text-decoration: underline; } `; diff --git a/src/components/DataTableCells/SwitchFieldCell.js b/src/components/DataTableCells/SwitchFieldCell.js new file mode 100644 index 000000000..a25e96ae4 --- /dev/null +++ b/src/components/DataTableCells/SwitchFieldCell.js @@ -0,0 +1,51 @@ +import React from 'react'; +import classNames from 'classnames'; +import { Classes, Switch, FormGroup, Intent } from '@blueprintjs/core'; + +import { safeInvoke } from 'utils'; + +/** + * Switch editable cell. + */ +const SwitchEditableCell = ({ + row: { index, original }, + column: { id, switchProps, onSwitchChange }, + cell: { value: initialValue }, + payload, +}) => { + const [value, setValue] = React.useState(initialValue); + + // Handle the switch change. + const onChange = (e) => { + const newValue = e.target.checked; + + setValue(newValue); + + safeInvoke(payload.updateData, index, id, newValue); + safeInvoke(onSwitchChange, e, newValue, original); + }; + + React.useEffect(() => { + setValue(initialValue); + }, [initialValue]); + + const error = payload.errors?.[index]?.[id]; + + return ( + + + + ); +}; + +export default SwitchEditableCell; \ No newline at end of file diff --git a/src/components/DataTableCells/TextAreaCell.js b/src/components/DataTableCells/TextAreaCell.js new file mode 100644 index 000000000..c8ff97a0c --- /dev/null +++ b/src/components/DataTableCells/TextAreaCell.js @@ -0,0 +1,42 @@ +import React, { useState, useEffect } from 'react'; +import classNames from 'classnames'; +import { Classes, TextArea, FormGroup, Intent } from '@blueprintjs/core'; + +const TextAreaEditableCell = ({ + row: { index }, + column: { id }, + cell: { value: initialValue }, + payload, +}) => { + const [value, setValue] = useState(initialValue); + + const onChange = (e) => { + setValue(e.target.value); + }; + const onBlur = () => { + payload.updateData(index, id, value); + }; + useEffect(() => { + setValue(initialValue); + }, [initialValue]); + + const error = payload.errors?.[index]?.[id]; + + return ( + +