Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split js logic into multiple files #2944

Merged
merged 26 commits into from
Mar 9, 2020
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
6f29da7
split home page logic
maxaleks Jan 8, 2020
a2a14bd
split account logic
maxaleks Jan 8, 2020
bcd86a1
separate blocks page logic
maxaleks Jan 8, 2020
e8896c2
separate transactions logic
maxaleks Jan 8, 2020
c418a70
separate remaining pages logic
maxaleks Jan 9, 2020
503b61b
separate smart contracts logic
maxaleks Jan 9, 2020
2a97b68
remove token balance dropdown logic from app.js
maxaleks Jan 9, 2020
a4e1f01
move some libs to separate files
maxaleks Jan 9, 2020
bcd222e
fix internalization files
maxaleks Jan 9, 2020
5851908
fix api templates
maxaleks Jan 13, 2020
ee7fb49
Update CHANGELOG.md
maxaleks Jan 13, 2020
822d444
Merge branch 'master' into split-js-logic-into-multiple-files
maxaleks Jan 13, 2020
2b23ecc
fix eth api docs
maxaleks Jan 16, 2020
3271dc8
use useBuiltIns option in webpack instead of importing @babel/polyfill
maxaleks Jan 18, 2020
7f2cb10
remove async_listing_load lib import from app.js
maxaleks Jan 20, 2020
49da989
do not load app.js on the first page
maxaleks Jan 20, 2020
a56370c
import app.js instead of separate libraries
maxaleks Feb 11, 2020
8c0beea
js scripts optimization
maxaleks Feb 11, 2020
706de85
more scripts optimization
maxaleks Feb 12, 2020
567802d
fix internalization
maxaleks Feb 12, 2020
e92c128
delete duplicate
maxaleks Feb 12, 2020
305ec10
Merge branch 'master' into split-js-logic-into-multiple-files
vbaranov Feb 18, 2020
b9702b0
Fix gettext
vbaranov Feb 18, 2020
f69101c
Merge branch 'master' into split-js-logic-into-multiple-files
vbaranov Feb 25, 2020
ebcdb1a
Merge branch 'master' into split-js-logic-into-multiple-files
vbaranov Mar 9, 2020
2e813ea
Update CHANGELOG entry
vbaranov Mar 9, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions apps/block_scout_web/assets/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,9 @@ import 'bootstrap'

import './locale'

import './pages/address'
import './pages/address/coin_balances'
import './pages/address/transactions'
import './pages/address/logs'
import './pages/address/validations'
import './pages/address/internal_transactions'
import './pages/blocks'
import './pages/chain'
import './pages/pending_transactions'
import './pages/transaction'
import './pages/transactions'
import './pages/layout'
import './pages/verification_form'
import './pages/token_counters'
import './pages/dark-mode-switcher'

import './pages/admin/tasks.js'

import './lib/clipboard_buttons'
import './lib/currency'
import './lib/from_now'
Expand All @@ -46,16 +31,8 @@ import './lib/loading_element'
import './lib/pending_transactions_toggle'
import './lib/pretty_json'
import './lib/reload_button'
import './lib/smart_contract/read_only_functions'
import './lib/smart_contract/wei_ether_converter'
import './lib/stop_propagation'
import './lib/token_balance_dropdown'
import './lib/token_balance_dropdown_search'
import './lib/token_transfers_toggle'
import './lib/transaction_input_dropdown'
import './lib/async_listing_load'
import './lib/tooltip'
import './lib/modals'
import './lib/try_api'
import './lib/try_eth_api'
import './lib/card_tabs'
2 changes: 2 additions & 0 deletions apps/block_scout_web/assets/js/lib/smart_contract/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import './read_only_functions'
import './wei_ether_converter'
1 change: 1 addition & 0 deletions apps/block_scout_web/assets/js/pages/address.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import socket, { subscribeChannel } from '../socket'
import { createStore, connectElements } from '../lib/redux_helpers.js'
import { updateAllCalculatedUsdValues } from '../lib/currency.js'
import { loadTokenBalanceDropdown } from '../lib/token_balance_dropdown'
import '../lib/token_balance_dropdown_search'

export const initialState = {
channelDisconnected: false,
Expand Down
1 change: 1 addition & 0 deletions apps/block_scout_web/assets/js/pages/transaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import humps from 'humps'
import numeral from 'numeral'
import socket from '../socket'
import { createStore, connectElements } from '../lib/redux_helpers.js'
import '../lib/transaction_input_dropdown'

export const initialState = {
blockNumber: null,
Expand Down
18 changes: 18 additions & 0 deletions apps/block_scout_web/assets/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,24 @@ const appJs =
app: './js/app.js',
stakes: './js/pages/stakes.js',
'chart-loader': './js/chart-loader.js',
'chain': './js/pages/chain.js',
'blocks': './js/pages/blocks.js',
'address': './js/pages/address.js',
'address-transactions': './js/pages/address/transactions.js',
'address-coin-balances': './js/pages/address/coin_balances.js',
'address-internal-transactions': './js/pages/address/internal_transactions.js',
'address-logs': './js/pages/address/logs.js',
'address-validations': './js/pages/address/validations.js',
'validated-transactions': './js/pages/transactions.js',
'pending-transactions': './js/pages/pending_transactions.js',
'transaction': './js/pages/transaction.js',
'verification-form': './js/pages/verification_form.js',
'token-counters': './js/pages/token_counters.js',
'admin-tasks': './js/pages/admin/tasks.js',
'smart-contract-helpers': './js/lib/smart_contract/index.js',
'token-transfers-toggle': './js/lib/token_transfers_toggle.js',
'try-api': './js/lib/try_api.js',
'try-eth-api': './js/lib/try_eth_api.js',
'non-critical': './css/non-critical.scss'
},
output: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@
</div>

</div>
<script defer data-cfasync="false" src="<%= static_path(@conn, "/js/address.js") %>"></script>
</section>

<!-- Modal QR -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,6 @@
<%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "bottom", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true, data_prev_page_button: true %>

</div>
<script defer data-cfasync="false" src="<%= static_path(@conn, "/js/address-coin-balances.js") %>"></script>
</section>
</section>
Original file line number Diff line number Diff line change
Expand Up @@ -279,5 +279,5 @@
</div>
<% end %>
</div>

<script defer data-cfasync="false" src="<%= static_path(@conn, "/js/verification-form.js") %>"></script>
</section>
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,6 @@

</div>
</div>
<script defer data-cfasync="false" src="<%= static_path(@conn, "/js/address-internal-transactions.js") %>"></script>
</section>
</section>
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,6 @@
</div>

</div>
<script defer data-cfasync="false" src="<%= static_path(@conn, "/js/address-logs.js") %>"></script>
</section>
</section>
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@
</div>
</div>
</div>
<script defer data-cfasync="false" src="<%= static_path(@conn, "/js/smart-contract-helpers.js") %>"></script>
</section>
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,6 @@

</div>
</div>
<script defer data-cfasync="false" src="<%= static_path(@conn, "/js/address-transactions.js") %>"></script>
</section>
</section>
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@

</div> <!-- Card Body -->
</div> <!-- Card -->
<script defer data-cfasync="false" src="<%= static_path(@conn, "/js/address-validations.js") %>"></script>
<section>
</section>
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@
</div>
</div>
</div>
<script defer data-cfasync="false" src="<%= static_path(@conn, "/js/admin-tasks.js") %>"></script>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -256,4 +256,5 @@
</div>
<% end %>
</div>
</div>
<script defer data-cfasync="false" src="<%= static_path(@conn, "/js/try-api.js") %>"></script>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -179,4 +179,5 @@
</div>
</div>
</div>
</div>
<script defer data-cfasync="false" src="<%= static_path(@conn, "/js/try-eth-api.js") %>"></script>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@

</div>
</div>
<script defer data-cfasync="false" src="<%= static_path(@conn, "/js/blocks.js") %>"></script>
</section>
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
</div>
</div>
<script defer data-cfasync="false" src="<%= static_path(@conn, "/js/chart-loader.js") %>"></script>
<script defer data-cfasync="false" src="<%= static_path(@conn, "/js/chain.js") %>"></script>
</div>
<section class="container">
<div class="card card-chain-blocks">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,5 @@

</div>
</div>
<script defer data-cfasync="false" src="<%= static_path(@conn, "/js/pending-transactions.js") %>"></script>
</section>
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
</div>
</div>
<% end %>
<script defer data-cfasync="false" src="<%= static_path(@conn, "/js/token-counters.js") %>"></script>
</section>
<!-- Modal -->
<div class="modal fade" id="qrModal" tabindex="-1" role="dialog" aria-labelledby="qrModalLabel" aria-hidden="true">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@
</div>
</div>
</section>
<script defer data-cfasync="false" src="<%= static_path(@conn, "/js/smart-contract-helpers.js") %>"></script>
</section>
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,5 @@
<% end %>
</div>
</div>
<script defer data-cfasync="false" src="<%= static_path(@conn, "/js/token-transfers-toggle.js") %>"></script>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,5 @@
<%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "bottom", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true, data_prev_page_button: true %>

</div>
<script defer data-cfasync="false" src="<%= static_path(@conn, "/js/validated-transactions.js") %>"></script>
</section>
Original file line number Diff line number Diff line change
Expand Up @@ -255,5 +255,5 @@
</div>
</div>
<% end %>

<script defer data-cfasync="false" src="<%= static_path(@conn, "/js/transaction.js") %>"></script>
</section>
26 changes: 13 additions & 13 deletions apps/block_scout_web/priv/gettext/default.pot
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ msgid "BlockScout provides analytics data, API, and Smart Contract tools for the
msgstr ""

#, elixir-format
#: lib/block_scout_web/templates/chain/show.html.eex:81
#: lib/block_scout_web/templates/chain/show.html.eex:82
#: lib/block_scout_web/templates/layout/_topnav.html.eex:31
#: lib/block_scout_web/templates/layout/_topnav.html.eex:35
msgid "Blocks"
Expand Down Expand Up @@ -1067,7 +1067,7 @@ msgid "More internal transactions have come in"
msgstr ""

#, elixir-format
#: lib/block_scout_web/templates/chain/show.html.eex:142
#: lib/block_scout_web/templates/chain/show.html.eex:143
#: lib/block_scout_web/templates/pending_transaction/index.html.eex:10
#: lib/block_scout_web/templates/transaction/index.html.eex:10
msgid "More transactions have come in"
Expand Down Expand Up @@ -1176,11 +1176,11 @@ msgstr ""

#, elixir-format
#: lib/block_scout_web/templates/address/overview.html.eex:33
#: lib/block_scout_web/templates/address/overview.html.eex:131
#: lib/block_scout_web/templates/address/overview.html.eex:132
#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:51
#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:93
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:36
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:105
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:106
msgid "QR Code"
msgstr ""

Expand Down Expand Up @@ -1313,7 +1313,7 @@ msgstr ""
#: lib/block_scout_web/templates/address_transaction/index.html.eex:59
#: lib/block_scout_web/templates/address_validation/index.html.eex:22
#: lib/block_scout_web/templates/block_transaction/index.html.eex:23
#: lib/block_scout_web/templates/chain/show.html.eex:85
#: lib/block_scout_web/templates/chain/show.html.eex:86
#: lib/block_scout_web/templates/pending_transaction/index.html.eex:19
#: lib/block_scout_web/templates/tokens/holder/index.html.eex:20
#: lib/block_scout_web/templates/tokens/instance/transfer/index.html.eex:21
Expand All @@ -1327,7 +1327,7 @@ msgid "Something went wrong, click to reload."
msgstr ""

#, elixir-format
#: lib/block_scout_web/templates/chain/show.html.eex:148
#: lib/block_scout_web/templates/chain/show.html.eex:149
msgid "Something went wrong, click to retry."
msgstr ""

Expand Down Expand Up @@ -1597,12 +1597,12 @@ msgid "Version"
msgstr ""

#, elixir-format
#: lib/block_scout_web/templates/chain/show.html.eex:80
#: lib/block_scout_web/templates/chain/show.html.eex:81
msgid "View All Blocks"
msgstr ""

#, elixir-format
#: lib/block_scout_web/templates/chain/show.html.eex:138
#: lib/block_scout_web/templates/chain/show.html.eex:139
msgid "View All Transactions"
msgstr ""

Expand Down Expand Up @@ -1718,12 +1718,12 @@ msgstr ""

#, elixir-format
#: lib/block_scout_web/templates/address/_validator_metadata_modal.html.eex:37
#: lib/block_scout_web/templates/address/overview.html.eex:132
#: lib/block_scout_web/templates/address/overview.html.eex:140
#: lib/block_scout_web/templates/address/overview.html.eex:133
#: lib/block_scout_web/templates/address/overview.html.eex:141
#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:94
#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:102
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:106
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:114
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:107
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:115
msgid "Close"
msgstr ""

Expand Down Expand Up @@ -1866,7 +1866,7 @@ msgstr ""
#: lib/block_scout_web/templates/address_transaction/index.html.eex:15
#: lib/block_scout_web/templates/block_transaction/index.html.eex:10
#: lib/block_scout_web/templates/block_transaction/index.html.eex:18
#: lib/block_scout_web/templates/chain/show.html.eex:139
#: lib/block_scout_web/templates/chain/show.html.eex:140
#: lib/block_scout_web/templates/layout/_topnav.html.eex:50
#: lib/block_scout_web/views/address_view.ex:306
msgid "Transactions"
Expand Down
26 changes: 13 additions & 13 deletions apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ msgid "BlockScout provides analytics data, API, and Smart Contract tools for the
msgstr ""

#, elixir-format
#: lib/block_scout_web/templates/chain/show.html.eex:81
#: lib/block_scout_web/templates/chain/show.html.eex:82
#: lib/block_scout_web/templates/layout/_topnav.html.eex:31
#: lib/block_scout_web/templates/layout/_topnav.html.eex:35
msgid "Blocks"
Expand Down Expand Up @@ -1067,7 +1067,7 @@ msgid "More internal transactions have come in"
msgstr ""

#, elixir-format
#: lib/block_scout_web/templates/chain/show.html.eex:142
#: lib/block_scout_web/templates/chain/show.html.eex:143
#: lib/block_scout_web/templates/pending_transaction/index.html.eex:10
#: lib/block_scout_web/templates/transaction/index.html.eex:10
msgid "More transactions have come in"
Expand Down Expand Up @@ -1176,11 +1176,11 @@ msgstr ""

#, elixir-format
#: lib/block_scout_web/templates/address/overview.html.eex:33
#: lib/block_scout_web/templates/address/overview.html.eex:131
#: lib/block_scout_web/templates/address/overview.html.eex:132
#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:51
#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:93
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:36
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:105
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:106
msgid "QR Code"
msgstr ""

Expand Down Expand Up @@ -1313,7 +1313,7 @@ msgstr ""
#: lib/block_scout_web/templates/address_transaction/index.html.eex:59
#: lib/block_scout_web/templates/address_validation/index.html.eex:22
#: lib/block_scout_web/templates/block_transaction/index.html.eex:23
#: lib/block_scout_web/templates/chain/show.html.eex:85
#: lib/block_scout_web/templates/chain/show.html.eex:86
#: lib/block_scout_web/templates/pending_transaction/index.html.eex:19
#: lib/block_scout_web/templates/tokens/holder/index.html.eex:20
#: lib/block_scout_web/templates/tokens/instance/transfer/index.html.eex:21
Expand All @@ -1327,7 +1327,7 @@ msgid "Something went wrong, click to reload."
msgstr ""

#, elixir-format
#: lib/block_scout_web/templates/chain/show.html.eex:148
#: lib/block_scout_web/templates/chain/show.html.eex:149
msgid "Something went wrong, click to retry."
msgstr ""

Expand Down Expand Up @@ -1597,12 +1597,12 @@ msgid "Version"
msgstr ""

#, elixir-format
#: lib/block_scout_web/templates/chain/show.html.eex:80
#: lib/block_scout_web/templates/chain/show.html.eex:81
msgid "View All Blocks"
msgstr ""

#, elixir-format
#: lib/block_scout_web/templates/chain/show.html.eex:138
#: lib/block_scout_web/templates/chain/show.html.eex:139
msgid "View All Transactions"
msgstr ""

Expand Down Expand Up @@ -1718,12 +1718,12 @@ msgstr ""

#, elixir-format
#: lib/block_scout_web/templates/address/_validator_metadata_modal.html.eex:37
#: lib/block_scout_web/templates/address/overview.html.eex:132
#: lib/block_scout_web/templates/address/overview.html.eex:140
#: lib/block_scout_web/templates/address/overview.html.eex:133
#: lib/block_scout_web/templates/address/overview.html.eex:141
#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:94
#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:102
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:106
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:114
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:107
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:115
msgid "Close"
msgstr ""

Expand Down Expand Up @@ -1866,7 +1866,7 @@ msgstr ""
#: lib/block_scout_web/templates/address_transaction/index.html.eex:15
#: lib/block_scout_web/templates/block_transaction/index.html.eex:10
#: lib/block_scout_web/templates/block_transaction/index.html.eex:18
#: lib/block_scout_web/templates/chain/show.html.eex:139
#: lib/block_scout_web/templates/chain/show.html.eex:140
#: lib/block_scout_web/templates/layout/_topnav.html.eex:50
#: lib/block_scout_web/views/address_view.ex:306
msgid "Transactions"
Expand Down