diff --git a/d b/d new file mode 100644 index 00000000..fca130eb --- /dev/null +++ b/d @@ -0,0 +1,267 @@ +commit d63f5cd24f98cce8602c2207afec810c72b8356d (HEAD -> date_range_pick_correction) +Merge: c3bac5d 78a4552 +Author: Max +Date: Thu Oct 6 15:26:35 2022 +0200 + + styles added + +commit 78a45521b68743a1bc33b66f44d3f32d8611cf37 (origin/develop, origin/HEAD, develop) +Merge: ea175ce b782976 +Author: millix-alex <57537379+millix-alex@users.noreply.github.com> +Date: Tue Oct 4 12:07:21 2022 +0200 + + Merge branch 'millix:main' into develop + +commit c3bac5dbdd69bb7d7b871e0b78b16213dd50351c (origin/close_popovers_if_window_size_changed, close_popovers_if_window_size_changed) +Author: crank +Date: Mon Oct 3 19:06:19 2022 +0200 + + getTransactionHistory pass date begin, end + remove PasswordStrength + +commit b782976f4c393358a791caa9438e36c18f58be87 +Author: millix-alex <57537379+millix-alex@users.noreply.github.com> +Date: Mon Oct 3 17:23:01 2022 +0200 + + wallet_aggregation_auto_enabled, use transaction_create_date for messages (#46) + + * MILLIX-176: remove zero to bool formatting, remove console.log (#56) + + Co-authored-by: AShulpekov + + * MILLIX-190: changes in received(deposit) list (#57) + + * MILLIX-190: advertisement deposits and event log ui + + Co-authored-by: AShulpekov + Co-authored-by: crank + + * MILLIX-message-hotfix: remove history state from view tx button (#58) + + Co-authored-by: AShulpekov + + * Millix 193 (#60) + + * MILLIX-193: support multiple recipient addresses in the compose form + + Co-authored-by: Eriksson Monteiro + Co-authored-by: AShulpekov + Co-authored-by: crank + + * chip_input empty style + + * send transaction switch to post + + * send transaction switch to post + + * Millix 189 (#59) + + * MILLIX-189: convert /report-issue into send message form + + Co-authored-by: AShulpekov + Co-authored-by: crank + + * report issue cosmetic fixes + + * change REPORT_ISSUE_ADDRESS + + * hide extra fields on report issue form + + * MILLIX-191: dns validation + + * MILLIX-191: dns validation + + Co-authored-by: AShulpekov + Co-authored-by: crank + + * MILLIX-195: fix link in error message does not work + + * MILLIX-195: fix link in error message does not work + + Co-authored-by: AShulpekov + + * MILLIX-194: message ux improvement from 2022-06-02 + + make the date field searchable in the inbox / sent data table + can't collapse the message parent item in left navigation + add the view tx button to the message page. next to reply button on top + + Co-authored-by: AShulpekov + Co-authored-by: crank + + * update tangled.com links + + * fix btn styles + + * fix left nav parent nav collapse + + * fix sidebar this.props.history.listen + + * MILLIX-173: add reload and close popup if page is same (#65) + + * MILLIX-173: reset validation on pending unspents result modal link doesn't work + + Co-authored-by: AShulpekov + + * Millix 193 (#60) + + * MILLIX-193: support multiple recipient addresses in the compose form + + Co-authored-by: Eriksson Monteiro + Co-authored-by: AShulpekov + Co-authored-by: crank + # Conflicts: + # src/css/form.scss + # src/js/components/message/message-compose-view.jsx + + * chip_input empty style + + * Millix 189 (#59) + + * MILLIX-189: convert /report-issue into send message form + + Co-authored-by: AShulpekov + Co-authored-by: crank + + * report issue cosmetic fixes + + * change REPORT_ISSUE_ADDRESS + + * MILLIX-191: dns validation + + * MILLIX-191: dns validation + + Co-authored-by: AShulpekov + Co-authored-by: crank + + * MILLIX-195: fix link in error message does not work + + * MILLIX-195: fix link in error message does not work + + Co-authored-by: AShulpekov + + * MILLIX-194: message ux improvement from 2022-06-02 + + make the date field searchable in the inbox / sent data table + can't collapse the message parent item in left navigation + add the view tx button to the message page. next to reply button on top + + Co-authored-by: AShulpekov + Co-authored-by: crank + + * update tangled.com links + + * fix btn styles + + * fix left nav parent nav collapse + + * fix sidebar this.props.history.listen + + * MILLIX-173: add reload and close popup if page is same (#65) + + * MILLIX-173: reset validation on pending unspents result modal link doesn't work + + Co-authored-by: AShulpekov + + * Millix 192 (#67) + + MILLIX-192: translate ui + + Co-authored-by: AShulpekov + Co-authored-by: crank + + * fix aggregation button loader + + * Millix 189 (#59) + + * MILLIX-189: convert /report-issue into send message form + + Co-authored-by: AShulpekov + Co-authored-by: crank + + * report issue cosmetic fixes + + * MILLIX-191: dns validation + + * MILLIX-191: dns validation + + Co-authored-by: AShulpekov + Co-authored-by: crank + + * fix btn styles + + * fix left nav parent nav collapse + + * fix sidebar this.props.history.listen + + * Millix 193 (#60) + + * MILLIX-193: support multiple recipient addresses in the compose form + + Co-authored-by: Eriksson Monteiro + Co-authored-by: AShulpekov + Co-authored-by: crank + # Conflicts: + # src/css/form.scss + # src/js/components/message/message-compose-view.jsx + + * chip_input empty style + + * Millix 189 (#59) + + * MILLIX-189: convert /report-issue into send message form + + Co-authored-by: AShulpekov + Co-authored-by: crank + + * report issue cosmetic fixes + + * change REPORT_ISSUE_ADDRESS + + * MILLIX-191: dns validation + + * MILLIX-191: dns validation + + Co-authored-by: AShulpekov + Co-authored-by: crank + + * fix btn styles + + * fix left nav parent nav collapse + + * fix sidebar this.props.history.listen + + * Millix 192 (#67) + + MILLIX-192: translate ui + + Co-authored-by: AShulpekov + Co-authored-by: crank + + * fix aggregation button loader + + * hide disabled languages + + * show_phrase_guid + + * fix phrase replacement of multiple variables + + * Millix 192 (#71) + + * MILLIX-192: translation: fix not unique key react console errors + + Co-authored-by: AShulpekov + Co-authored-by: crank + + * MILLIX-199: fix href (#72) + + Co-authored-by: AShulpekov + + * MILLIX-192: fix translation and merge (#70) + + fix date sort on messages + + Co-authored-by: AShulpekov + Co-authored-by: crank + + * MILLIX-193: a \ No newline at end of file diff --git a/src/css/daterangepicker.scss b/src/css/daterangepicker.scss new file mode 100644 index 00000000..8b053b2b --- /dev/null +++ b/src/css/daterangepicker.scss @@ -0,0 +1,419 @@ +@import './variable'; + +.daterangepicker { + position: absolute; + color: inherit; + background-color: $input-color; + border-radius: 0.25rem; + border: 1px solid rgba(205, 207, 214, 0.25); + width: 278px; + max-width: none; + padding: 0; + margin-top: 7px; + top: 100px; + left: 20px; + z-index: 3001; + display: none; + font-family: arial; + font-size: 15px; + line-height: 1em; + } + + + th { + color: inherit; + } + + .daterangepicker:before, .daterangepicker:after { + position: absolute; + display: inline-block; + border-bottom-color: rgba(0, 0, 0, 0.2); + content: ''; + } + + .daterangepicker:before { + top: -7px; + border-right: 7px solid transparent; + border-left: 7px solid transparent; + border-bottom: 7px solid #ccc; + } + + .daterangepicker:after { + top: -6px; + border-right: 6px solid transparent; + border-bottom: 6px solid $input-color; + border-left: 6px solid transparent; + } + + .daterangepicker.opensleft:before { + right: 9px; + } + + .daterangepicker.opensleft:after { + right: 10px; + } + + .daterangepicker.openscenter:before { + left: 0; + right: 0; + width: 0; + margin-left: auto; + margin-right: auto; + } + + .daterangepicker.openscenter:after { + left: 0; + right: 0; + width: 0; + margin-left: auto; + margin-right: auto; + } + + .daterangepicker.opensright:before { + left: 9px; + } + + .daterangepicker.opensright:after { + left: 10px; + } + + .daterangepicker.drop-up { + margin-top: -7px; + } + + .daterangepicker.drop-up:before { + top: initial; + bottom: -7px; + border-bottom: initial; + border-top: 7px solid #ccc; + } + + .daterangepicker.drop-up:after { + top: initial; + bottom: -6px; + border-bottom: initial; + border-top: 6px solid $input-color; + } + + .daterangepicker.single .daterangepicker .ranges, .daterangepicker.single .drp-calendar { + float: none; + } + + .daterangepicker.single .drp-selected { + display: none; + } + + .daterangepicker.show-calendar .drp-calendar { + display: block; + } + + .daterangepicker.show-calendar .drp-buttons { + display: block; + } + + .daterangepicker.auto-apply .drp-buttons { + display: none; + } + + .daterangepicker .drp-calendar { + display: none; + max-width: 270px; + } + + .daterangepicker .drp-calendar.left { + padding: 8px 0 8px 8px; + } + + .daterangepicker .drp-calendar.right { + padding: 8px; + } + + .daterangepicker .drp-calendar.single .calendar-table { + border: none; + } + + .daterangepicker .calendar-table .next span, .daterangepicker .calendar-table .prev span { + color: $input-color; + border: solid $color-font-left-nav-hover; + border-width: 0 2px 2px 0; + border-radius: 0; + display: inline-block; + padding: 3px; + } + + .daterangepicker .calendar-table .next span { + transform: rotate(-45deg); + -webkit-transform: rotate(-45deg); + } + + .daterangepicker .calendar-table .prev span { + transform: rotate(135deg); + -webkit-transform: rotate(135deg); + } + + .daterangepicker .calendar-table th, .daterangepicker .calendar-table td { + $input-color-space: nowrap; + text-align: center; + vertical-align: middle; + min-width: 32px; + width: 32px; + height: 24px; + line-height: 24px; + font-size: 12px; + border-radius: 4px; + border: 1px solid transparent; + $input-color-space: nowrap; + cursor: pointer; + } + + .daterangepicker .calendar-table { + border: 1px solid $input-color; + border-radius: 4px; + background-color: $input-color; + } + + .daterangepicker .calendar-table table { + width: 100%; + margin: 0; + border-spacing: 0; + border-collapse: collapse; + } + + .daterangepicker td.available:hover, .daterangepicker th.available:hover { + background-color: $color-secondary; + border-color: transparent; + color: $color-black; + } + + .daterangepicker td.week, .daterangepicker th.week { + font-size: 80%; + color: #ccc; + } + + .daterangepicker td.off, .daterangepicker td.off.in-range, .daterangepicker td.off.start-date, .daterangepicker td.off.end-date { + background-color: $input-color; + border-color: transparent; + color: #999; + } + + .daterangepicker td.in-range { + background-color: $color-tab-hover; + border-color: transparent; + color: #000; + border-radius: 0; + } + + .daterangepicker td.start-date { + border-radius: 4px 0 0 4px; + } + + .daterangepicker td.end-date { + border-radius: 0 4px 4px 0; + } + + .daterangepicker td.start-date.end-date { + border-radius: 4px; + } + + .daterangepicker td.active, .daterangepicker td.active:hover { + background-color: $color-primary; + border-color: transparent; + color: $input-color; + } + + .daterangepicker th.month { + width: auto; + } + + .daterangepicker td.disabled, .daterangepicker option.disabled { + color: #999; + cursor: not-allowed; + text-decoration: line-through; + } + + .daterangepicker select.monthselect, .daterangepicker select.yearselect { + font-size: 12px; + padding: 1px; + height: auto; + margin: 0; + cursor: default; + } + + .daterangepicker select.monthselect { + margin-right: 2%; + width: 56%; + } + + .daterangepicker select.yearselect { + width: 40%; + } + + .daterangepicker select.hourselect, .daterangepicker select.minuteselect, .daterangepicker select.secondselect, .daterangepicker select.ampmselect { + width: 50px; + margin: 0 auto; + background: $color-secondary; + border: 1px solid $color-secondary; + padding: 2px; + outline: 0; + font-size: 12px; + } + + .daterangepicker .calendar-time { + text-align: center; + margin: 4px auto 0 auto; + line-height: 30px; + position: relative; + } + + .daterangepicker .calendar-time select.disabled { + color: #ccc; + cursor: not-allowed; + } + + .daterangepicker .drp-buttons { + clear: both; + text-align: right; + padding: 8px; + border-top: 1px solid #ddd; + display: none; + line-height: 12px; + vertical-align: middle; + } + + .daterangepicker .drp-selected { + display: inline-block; + font-size: 12px; + padding-right: 8px; + } + + .daterangepicker .drp-buttons .btn { + margin-left: 8px; + font-size: 12px; + font-weight: bold; + padding: 4px 8px; + } + + .daterangepicker.show-ranges.single.rtl .drp-calendar.left { + border-right: 1px solid #ddd; + } + + .daterangepicker.show-ranges.single.ltr .drp-calendar.left { + border-left: 1px solid #ddd; + } + + .daterangepicker.show-ranges.rtl .drp-calendar.right { + border-right: 1px solid #ddd; + } + + .daterangepicker.show-ranges.ltr .drp-calendar.left { + border-left: 1px solid #ddd; + } + + .daterangepicker .ranges { + float: none; + text-align: left; + margin: 0; + } + + .daterangepicker.show-calendar .ranges { + margin-top: 8px; + } + + .daterangepicker .ranges ul { + list-style: none; + margin: 0 auto; + padding: 0; + width: 100%; + } + + .daterangepicker .ranges li { + font-size: 12px; + padding: 8px 12px; + cursor: pointer; + } + + .daterangepicker .ranges li:hover { + background-color: $color-secondary; + } + + .daterangepicker .ranges li.active { + background-color: #08c; + color: $input-color; + } + + /* Larger Screen Styling */ + @media (min-width: 564px) { + .daterangepicker { + width: auto; + } + + .daterangepicker .ranges ul { + width: 140px; + } + + .daterangepicker.single .ranges ul { + width: 100%; + } + + .daterangepicker.single .drp-calendar.left { + clear: none; + } + + .daterangepicker.single .ranges, .daterangepicker.single .drp-calendar { + float: left; + } + + .daterangepicker { + direction: ltr; + text-align: left; + } + + .daterangepicker .drp-calendar.left { + clear: left; + margin-right: 0; + } + + .daterangepicker .drp-calendar.left .calendar-table { + border-right: none; + border-top-right-radius: 0; + border-bottom-right-radius: 0; + } + + .daterangepicker .drp-calendar.right { + margin-left: 0; + margin-right: 16px; + } + + .daterangepicker .drp-calendar.right .calendar-table { + border-left: none; + border-top-left-radius: 0; + border-bottom-left-radius: 0; + } + + .daterangepicker .drp-calendar.left .calendar-table { + padding-right: 8px; + } + + .daterangepicker .ranges, .daterangepicker .drp-calendar { + float: left; + } + } + + @media (min-width: 730px) { + .daterangepicker .ranges { + width: auto; + } + + .daterangepicker .ranges { + float: left; + } + + .daterangepicker.rtl .ranges { + float: right; + } + + .daterangepicker .drp-calendar.left { + clear: none !important; + } + } + \ No newline at end of file diff --git a/src/css/form.scss b/src/css/form.scss index 3ec9a392..f83e5be6 100644 --- a/src/css/form.scss +++ b/src/css/form.scss @@ -181,3 +181,32 @@ label { margin-left: 0; } } + +.password-strength-value { + background-color: $color-red; + transition: width 0.3s; + width: 0; + + &.danger-20 { + width: 20%; + } + &.danger-40 { + width: 40%; + } + &.danger-60 { + width: 60%; + } + &.warning-80 { + background-color: $color-yellow; + width: 80%; + } + &.safe-100 { + background-color: $color-green; + width: 100%; + } +} + +.progress.password-strength-bar { + background-color: rgba(205, 207, 214, 0.1); + width: auto +} diff --git a/src/index.js b/src/index.js index b7298814..8a5b7aeb 100644 --- a/src/index.js +++ b/src/index.js @@ -79,7 +79,6 @@ import moment from 'moment'; import localforage from 'localforage'; import Loader from './js/components/loader'; - faConfig.autoAddCss = false; library.add(faArrowCircleLeft, faWallet, faKey, faHome, faFingerprint, faStream, faExchangeAlt, faCloudDownloadAlt, faSlidersH, @@ -214,6 +213,7 @@ getNodeAboutAttribute(); getNodeConfig(); getStorageConfig(); getWalletAddressVersion(); + ReactDOM.render(
diff --git a/src/js/common/transaction.js b/src/js/common/transaction.js index 24bda8e2..26f31d84 100644 --- a/src/js/common/transaction.js +++ b/src/js/common/transaction.js @@ -2,11 +2,11 @@ import API from '../api'; import async from 'async'; import UserInterfaceError from '../components/utils/user-interface-error'; import Translation from './translation'; +import utils from '../helper/utils'; import _ from 'lodash'; class Transaction { - verifyAddress(result_transaction_param) { return new Promise((resolve, reject) => { const verified_address_list = []; @@ -48,7 +48,7 @@ class Transaction { } return data; }).then(data => { - resolve(this.handleSuccessResponse(data, transaction_output_payload.transaction_output_list[0].address_base.startsWith('1'))); + resolve(this.handleSuccessResponse(data, utils.is_main_network_address(transaction_output_payload.transaction_output_list[0].address_key_identifier))); }).catch((e) => { reject(this.handleErrorResponse(e)); }); @@ -95,6 +95,8 @@ class Transaction { return item.version.indexOf(is_main_net ? '0a' : 'la') !== -1; }); + const transaction_id = transaction?.transaction_id; + return { sending : false, fee_input_locked : true, @@ -104,8 +106,8 @@ class Transaction { image : null, destination_address_list: [], address_verified_list : [], - transaction_id : transaction.transaction_id, - modal_body_send_result : this.getModalBodySuccessResult(transaction.transaction_id) + transaction_id : transaction_id, + modal_body_send_result : this.getModalBodySuccessResult(transaction_id) }; } } diff --git a/src/js/components/.transaction-history-view.jsx.swp b/src/js/components/.transaction-history-view.jsx.swp new file mode 100644 index 00000000..dfe245b8 Binary files /dev/null and b/src/js/components/.transaction-history-view.jsx.swp differ diff --git a/src/js/components/message/message-compose-form.jsx b/src/js/components/message/message-compose-form.jsx index ff06e518..cbc94c14 100644 --- a/src/js/components/message/message-compose-form.jsx +++ b/src/js/components/message/message-compose-form.jsx @@ -112,13 +112,22 @@ class MessageComposeForm extends Component { }; if (error_list.length === 0) { - validate.verified_sender_domain_name(transaction_param.dns, error_list).then(_ => { - if (error_list.length === 0) { + validate.verified_sender_domain_name(transaction_param.dns, this.props.wallet.address_key_identifier).then(result => { + if (result.valid) { Transaction.verifyAddress(transaction_param).then((data) => { this.setState(data); this.changeModalShowConfirmation(); }).catch((error) => { error_list.push(error); + + this.setState({ + error_list: error_list + }); + }); + } + else { + this.setState({ + error_list: result.error_list }); } }); diff --git a/src/js/components/nft/nft-create-form.jsx b/src/js/components/nft/nft-create-form.jsx index 0d170b27..606b3475 100644 --- a/src/js/components/nft/nft-create-form.jsx +++ b/src/js/components/nft/nft-create-form.jsx @@ -102,13 +102,17 @@ class NftCreateForm extends Component { }; if (error_list.length === 0) { - validate.verified_sender_domain_name(transaction_param.dns, error_list).then(result => { + validate.verified_sender_domain_name(transaction_param.dns, this.props.wallet.address_key_identifier).then(result => { if (result.valid) { Transaction.verifyAddress(transaction_param).then((data) => { this.setState(data); this.changeModalShowConfirmation(); }).catch((error) => { error_list.push(error); + + this.setState({ + error_list: error_list + }); }); } else { diff --git a/src/js/components/utils/help-icon-view.jsx b/src/js/components/utils/help-icon-view.jsx index 1d37b8ff..a3d7d390 100644 --- a/src/js/components/utils/help-icon-view.jsx +++ b/src/js/components/utils/help-icon-view.jsx @@ -329,6 +329,20 @@ class HelpIconView extends Component { return help_item; } + closePopover = () => { + this.setState({ + show: false + }); + } + + componentDidMount() { + window.addEventListener('resize', this.closePopover); + } + + componentWillUnmount() { + window.removeEventListener('resize', this.closePopover); + } + render() { const help_item = this.getHelpItem(this.props.help_item_name); if (!help_item) { @@ -345,15 +359,15 @@ class HelpIconView extends Component { {help_item.body} ); - + return ( <> - + {this.setState((state) => ({show: !state.show}))}} className={'help_icon'}> diff --git a/src/js/components/utils/password-strength-view.jsx b/src/js/components/utils/password-strength-view.jsx new file mode 100644 index 00000000..7480518b --- /dev/null +++ b/src/js/components/utils/password-strength-view.jsx @@ -0,0 +1,55 @@ +import { Component } from 'react'; + +class PasswordStrength extends Component { + counter = (password) => { + let strength = 0 + if (password.length >= 8) + strength += 1 + + if (password.match(/(?=.*[0-9])/)) + strength += 1 + + if (password.match(/(?=.*[!,%,&,@,#,$,^,*,?,_,~,<,>,])/)) + strength += 1 + + if (password.match(/(?=.*[a-z])/)) + strength += 1 + + if (password.match(/(?=.*[A-Z])/)) + strength += 1 + + return strength + } + + render() { + const {password} = this.props + let counter = this.counter(password) + let clazz = 'password-strength-value'; + + if (counter == 1) { + clazz += ' danger-20'; + + } else if (counter == 2) { + clazz += ' danger-40'; + + } else if (counter == 3) { + clazz += ' danger-60'; + + } else if (counter == 4) { + clazz += ' warning-80'; + + } else if (counter == 5) { + clazz += ' safe-100'; + } + + return
Password strength +
+
+
+
+
+
+ } +} + +export default PasswordStrength \ No newline at end of file diff --git a/src/js/components/utils/wallet-create-password-view.jsx b/src/js/components/utils/wallet-create-password-view.jsx index c878b3cd..019da6fb 100644 --- a/src/js/components/utils/wallet-create-password-view.jsx +++ b/src/js/components/utils/wallet-create-password-view.jsx @@ -2,42 +2,58 @@ import React from 'react'; import PropTypes from 'prop-types'; import {FormControl} from 'react-bootstrap'; import Translation from '../../common/translation'; +import PasswordStrength from './password-strength-view'; +import { Component } from 'react'; -const WalletCreatePasswordView = (props) => { - let passphraseRef, passphraseConfirmRef; +class WalletCreatePasswordView extends Component { + constructor(props) { + super(props) + this.state = { + password: '' + } + } - let info_label = Translation.getPhrase('b7e9ca83d'); - if (props.processName === 'import') { - info_label = Translation.getPhrase('0b3b5d17b'); + render() { + + let passphraseRef, passphraseConfirmRef; + let info_label = Translation.getPhrase('b7e9ca83d'); + if (this.props.processName === 'import') { + info_label = Translation.getPhrase('0b3b5d17b'); + } + + return ( +
+
{info_label}
+ passphraseRef = c} + placeholder={Translation.getPhrase('43c568626')} + aria-label="password" + aria-describedby="basic-addon" + onChange={() => { + this.props.onPassword(passphraseRef.value); + this.setState({ + password: passphraseRef.value + }); + }} + /> + + passphraseConfirmRef = c} + placeholder={Translation.getPhrase('e59f9ba20')} + aria-label="confirm password" + aria-describedby="basic-addon" + onChange={() => { + this.props.onConfirmPassword(passphraseConfirmRef.value); + }} + /> + +
+ ); } - - return ( -
-
{info_label}
- passphraseRef = c} - placeholder={Translation.getPhrase('43c568626')} - aria-label="password" - aria-describedby="basic-addon" - onChange={() => { - props.onPassword(passphraseRef.value); - }} - /> - passphraseConfirmRef = c} - placeholder={Translation.getPhrase('e59f9ba20')} - aria-label="confirm password" - aria-describedby="basic-addon" - onChange={() => { - props.onConfirmPassword(passphraseConfirmRef.value); - }} - /> -
- ); }; WalletCreatePasswordView.propTypes = { diff --git a/src/js/helper/message.js b/src/js/helper/message.js index f7ab2eb9..bc0e08b9 100644 --- a/src/js/helper/message.js +++ b/src/js/helper/message.js @@ -12,11 +12,20 @@ export function datatable_format(data) { if (attribute?.value) { const file_list = attribute.value.file_list; const file_hash = file_list[0].hash; - if (!attribute.file_data[file_hash]) { + + let file_data; + if (attribute.file_data) { + file_data = attribute.file_data; + } + else if (attribute.value.file_data) { + file_data = attribute.value.file_data; + } + + if (!file_data[file_hash]) { return; } - const message = !_.isNil(attribute.file_data[file_hash]) ? attribute.file_data[file_hash] : {}; + const message = !_.isNil(file_data[file_hash]) ? file_data[file_hash] : {}; const { message_subject, message_body, diff --git a/src/js/helper/utils.js b/src/js/helper/utils.js index 992083cb..220b43e9 100644 --- a/src/js/helper/utils.js +++ b/src/js/helper/utils.js @@ -100,7 +100,13 @@ function getNftViewLink(nft_data, absolute = false) { return `${origin}/nft-preview/?p0=${nft_data.transaction.transaction_id}&p1=${nft_data.transaction.address_key_identifier_to}&p2=${nft_data.file_key}&p3=${nft_data.hash}&p4=${nft_data.metadata_hash}`; } +function is_main_network_address(address_key_identifier) +{ + return address_key_identifier.startsWith('1'); +} + export default { getImageFromApi, - getNftViewLink + getNftViewLink, + is_main_network_address };