Add vertical scroller for tx actions area (draft version)

pull/6582/head
POA 2 years ago
parent d7870eaa03
commit 8c4a19d3ea
  1. 37
      apps/block_scout_web/assets/css/custom-scrollbar.scss
  2. 19
      apps/block_scout_web/assets/js/lib/custom_scrollbar.js
  3. 32
      apps/block_scout_web/assets/package-lock.json
  4. 1
      apps/block_scout_web/assets/package.json
  5. 2
      apps/block_scout_web/assets/webpack.config.js
  6. 7
      apps/block_scout_web/lib/block_scout_web/templates/layout/app.html.eex
  7. 4
      apps/block_scout_web/lib/block_scout_web/templates/transaction/_actions.html.eex
  8. 10
      apps/block_scout_web/lib/block_scout_web/templates/transaction/overview.html.eex

File diff suppressed because one or more lines are too long

@ -0,0 +1,19 @@
import $ from 'jquery'
import 'malihu-custom-scrollbar-plugin/jquery.mCustomScrollbar.concat.min'
$(function() {
$(".mCustomScrollbar").mCustomScrollbar({
callbacks: {
onOverflowY: () => {
$("#txActionsTitle .note").css("display", "block");
},
onOverflowYNone: () => {
$("#txActionsTitle .note").css("display", "none");
}
},
theme: "dark",
autoHideScrollbar: true,
scrollButtons: {enable: false},
scrollbarPosition: "outside"
});
});

@ -44,6 +44,7 @@
"lodash.rangeright": "^4.2.0", "lodash.rangeright": "^4.2.0",
"lodash.reduce": "^4.6.0", "lodash.reduce": "^4.6.0",
"luxon": "^3.1.1", "luxon": "^3.1.1",
"malihu-custom-scrollbar-plugin": "3.1.5",
"moment": "^2.29.4", "moment": "^2.29.4",
"nanomorph": "^5.4.0", "nanomorph": "^5.4.0",
"numeral": "^2.0.6", "numeral": "^2.0.6",
@ -98,10 +99,11 @@
} }
}, },
"../../../deps/phoenix": { "../../../deps/phoenix": {
"version": "0.0.1" "version": "1.5.13",
"license": "MIT"
}, },
"../../../deps/phoenix_html": { "../../../deps/phoenix_html": {
"version": "0.0.1" "version": "3.0.4"
}, },
"node_modules/@ampproject/remapping": { "node_modules/@ampproject/remapping": {
"version": "2.2.0", "version": "2.2.0",
@ -11890,6 +11892,11 @@
"resolved": "https://registry.npmjs.org/jquery/-/jquery-3.6.1.tgz", "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.6.1.tgz",
"integrity": "sha512-opJeO4nCucVnsjiXOE+/PcCgYw9Gwpvs/a6B1LL/lQhwWwpbVEVYDZ1FokFr8PRc7ghYlrFPuyHuiiDNTQxmcw==" "integrity": "sha512-opJeO4nCucVnsjiXOE+/PcCgYw9Gwpvs/a6B1LL/lQhwWwpbVEVYDZ1FokFr8PRc7ghYlrFPuyHuiiDNTQxmcw=="
}, },
"node_modules/jquery-mousewheel": {
"version": "3.1.13",
"resolved": "https://registry.npmjs.org/jquery-mousewheel/-/jquery-mousewheel-3.1.13.tgz",
"integrity": "sha512-GXhSjfOPyDemM005YCEHvzrEALhKDIswtxSHSR2e4K/suHVJKJxxRCGz3skPjNxjJjQa9AVSGGlYjv1M3VLIPg=="
},
"node_modules/js-base64": { "node_modules/js-base64": {
"version": "2.6.4", "version": "2.6.4",
"resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.6.4.tgz", "resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.6.4.tgz",
@ -12587,6 +12594,14 @@
"tmpl": "1.0.5" "tmpl": "1.0.5"
} }
}, },
"node_modules/malihu-custom-scrollbar-plugin": {
"version": "3.1.5",
"resolved": "https://registry.npmjs.org/malihu-custom-scrollbar-plugin/-/malihu-custom-scrollbar-plugin-3.1.5.tgz",
"integrity": "sha512-lwW3LgI+CNDMPnP4ED2la6oYxWMkCXlnhex+s2wuOLhFDFGnGmQuTQVdRK9bvDLpxs10sGlfErVufJy9ztfgJQ==",
"dependencies": {
"jquery-mousewheel": ">=3.0.6"
}
},
"node_modules/map-obj": { "node_modules/map-obj": {
"version": "4.3.0", "version": "4.3.0",
"resolved": "https://registry.npmjs.org/map-obj/-/map-obj-4.3.0.tgz", "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-4.3.0.tgz",
@ -27464,6 +27479,11 @@
"resolved": "https://registry.npmjs.org/jquery/-/jquery-3.6.1.tgz", "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.6.1.tgz",
"integrity": "sha512-opJeO4nCucVnsjiXOE+/PcCgYw9Gwpvs/a6B1LL/lQhwWwpbVEVYDZ1FokFr8PRc7ghYlrFPuyHuiiDNTQxmcw==" "integrity": "sha512-opJeO4nCucVnsjiXOE+/PcCgYw9Gwpvs/a6B1LL/lQhwWwpbVEVYDZ1FokFr8PRc7ghYlrFPuyHuiiDNTQxmcw=="
}, },
"jquery-mousewheel": {
"version": "3.1.13",
"resolved": "https://registry.npmjs.org/jquery-mousewheel/-/jquery-mousewheel-3.1.13.tgz",
"integrity": "sha512-GXhSjfOPyDemM005YCEHvzrEALhKDIswtxSHSR2e4K/suHVJKJxxRCGz3skPjNxjJjQa9AVSGGlYjv1M3VLIPg=="
},
"js-base64": { "js-base64": {
"version": "2.6.4", "version": "2.6.4",
"resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.6.4.tgz", "resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.6.4.tgz",
@ -28063,6 +28083,14 @@
"tmpl": "1.0.5" "tmpl": "1.0.5"
} }
}, },
"malihu-custom-scrollbar-plugin": {
"version": "3.1.5",
"resolved": "https://registry.npmjs.org/malihu-custom-scrollbar-plugin/-/malihu-custom-scrollbar-plugin-3.1.5.tgz",
"integrity": "sha512-lwW3LgI+CNDMPnP4ED2la6oYxWMkCXlnhex+s2wuOLhFDFGnGmQuTQVdRK9bvDLpxs10sGlfErVufJy9ztfgJQ==",
"requires": {
"jquery-mousewheel": ">=3.0.6"
}
},
"map-obj": { "map-obj": {
"version": "4.3.0", "version": "4.3.0",
"resolved": "https://registry.npmjs.org/map-obj/-/map-obj-4.3.0.tgz", "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-4.3.0.tgz",

@ -56,6 +56,7 @@
"lodash.rangeright": "^4.2.0", "lodash.rangeright": "^4.2.0",
"lodash.reduce": "^4.6.0", "lodash.reduce": "^4.6.0",
"luxon": "^3.1.1", "luxon": "^3.1.1",
"malihu-custom-scrollbar-plugin": "3.1.5",
"moment": "^2.29.4", "moment": "^2.29.4",
"nanomorph": "^5.4.0", "nanomorph": "^5.4.0",
"numeral": "^2.0.6", "numeral": "^2.0.6",

@ -68,6 +68,8 @@ const appJs =
'text-ad': './js/lib/text_ad.js', 'text-ad': './js/lib/text_ad.js',
'banner': './js/lib/banner.js', 'banner': './js/lib/banner.js',
'autocomplete': './js/lib/autocomplete.js', 'autocomplete': './js/lib/autocomplete.js',
'custom-scrollbar': './js/lib/custom_scrollbar.js',
'custom-scrollbar-styles': './css/custom-scrollbar.scss',
'search-results': './js/pages/search-results/search.js', 'search-results': './js/pages/search-results/search.js',
'token-overview': './js/pages/token/overview.js', 'token-overview': './js/pages/token/overview.js',
'export-csv': './css/export-csv.scss', 'export-csv': './css/export-csv.scss',

@ -11,6 +11,10 @@
<link rel="preload" href="<%= static_path(@conn, "/js/chain.js") %>" as="script"> <link rel="preload" href="<%= static_path(@conn, "/js/chain.js") %>" as="script">
<link rel="preload" href="<%= static_path(@conn, "/js/chart-loader.js") %>" as="script"> <link rel="preload" href="<%= static_path(@conn, "/js/chart-loader.js") %>" as="script">
<link rel="preload" href="<%= static_path(@conn, "/js/token-transfers-toggle.js") %>" as="script"> <link rel="preload" href="<%= static_path(@conn, "/js/token-transfers-toggle.js") %>" as="script">
<% Elixir.BlockScoutWeb.TransactionView -> %>
<link rel="stylesheet" href="<%= static_path(@conn, "/css/app.css") %>">
<link rel="stylesheet" href="<%= static_path(@conn, "/css/custom-scrollbar-styles.css") %>">
<link rel="preload" href="<%= static_path(@conn, "/js/custom-scrollbar.js") %>" as="script">
<% _ -> %> <% _ -> %>
<link rel="stylesheet" href="<%= static_path(@conn, "/css/app.css") %>"> <link rel="stylesheet" href="<%= static_path(@conn, "/css/app.css") %>">
<% end %> <% end %>
@ -297,6 +301,9 @@
<script defer data-cfasync="false" src="<%= static_path(@conn, "/js/chart-loader.js") %>"></script> <script defer data-cfasync="false" src="<%= static_path(@conn, "/js/chart-loader.js") %>"></script>
<script defer data-cfasync="false" src="<%= static_path(@conn, "/js/token-transfers-toggle.js") %>"></script> <script defer data-cfasync="false" src="<%= static_path(@conn, "/js/token-transfers-toggle.js") %>"></script>
<% end %> <% end %>
<%= if @view_module == Elixir.BlockScoutWeb.TransactionView do %>
<script defer data-cfasync="false" src="<%= static_path(@conn, "/js/custom-scrollbar.js") %>"></script>
<% end %>
<script defer src="<%= static_path(@conn, "/js/autocomplete.js") %>"></script> <script defer src="<%= static_path(@conn, "/js/autocomplete.js") %>"></script>
<%= if @view_module in [Elixir.BlockScoutWeb.AddressContractVerificationView, Elixir.BlockScoutWeb.AddressContractVerificationVyperView, Elixir.BlockScoutWeb.AddressContractVerificationViaFlattenedCodeView, Elixir.BlockScoutWeb.AddressContractVerificationViaMultiPartFilesView, Elixir.BlockScoutWeb.AddressContractVerificationViaJsonView, Elixir.BlockScoutWeb.AddressContractVerificationViaStandardJsonInputView] do %> <%= if @view_module in [Elixir.BlockScoutWeb.AddressContractVerificationView, Elixir.BlockScoutWeb.AddressContractVerificationVyperView, Elixir.BlockScoutWeb.AddressContractVerificationViaFlattenedCodeView, Elixir.BlockScoutWeb.AddressContractVerificationViaMultiPartFilesView, Elixir.BlockScoutWeb.AddressContractVerificationViaJsonView, Elixir.BlockScoutWeb.AddressContractVerificationViaStandardJsonInputView] do %>
<script defer data-cfasync="false" src="<%= static_path(@conn, "/js/verification-form.js") %>"></script> <script defer data-cfasync="false" src="<%= static_path(@conn, "/js/verification-form.js") %>"></script>

@ -1,5 +1,6 @@
<%= if @action.protocol == :uniswap_v3 do %> <%= if @action.protocol == :uniswap_v3 do %>
<%= if @action.type == :mint_nft do %> <%= if @action.type == :mint_nft do %>
<div class="<%= if @isLast, do: "lastItem", else: "" %>">
<span class="actions-item"> <span class="actions-item">
<i class="fa fa-caret-right"></i> <i class="fa fa-caret-right"></i>
@ -44,8 +45,10 @@
</span> </span>
<br /> <br />
<% end %> <% end %>
</div>
<% end %> <% end %>
<%= if Enum.member?([:mint, :burn, :collect, :swap], @action.type) do %> <%= if Enum.member?([:mint, :burn, :collect, :swap], @action.type) do %>
<div class="<%= if @isLast, do: "lastItem", else: "" %>">
<span class="actions-item"> <span class="actions-item">
<% amount0 = Map.get(@action.data, "amount0") %> <% amount0 = Map.get(@action.data, "amount0") %>
<% amount0 = BlockScoutWeb.CldrHelper.Number.to_string!(Decimal.new(amount0), format: "#,##0.##################") %> <% amount0 = BlockScoutWeb.CldrHelper.Number.to_string!(Decimal.new(amount0), format: "#,##0.##################") %>
@ -85,5 +88,6 @@
<% end %> <% end %>
</span> </span>
<br /> <br />
</div>
<% end %> <% end %>
<% end %> <% end %>

@ -201,9 +201,15 @@
text: gettext("Highlighted events of the transaction.") %> text: gettext("Highlighted events of the transaction.") %>
<%= gettext "Transaction Action" %></dt> <%= gettext "Transaction Action" %></dt>
<dd class="col-sm-9 col-lg-10 actions-list-mobile-container"> <dd class="col-sm-9 col-lg-10 actions-list-mobile-container">
<%= for action <- transaction_actions do %> <div class="mCustomScrollbar" style="max-height:100px;width:90%">
<%= render BlockScoutWeb.TransactionView, "_actions.html", Map.put(assigns, :action, action) %> <% transaction_actions_indexed = Enum.with_index(transaction_actions) %>
<% transaction_actions_length = Enum.count(transaction_actions) %>
<%= for {action, i} <- transaction_actions_indexed do %>
<% action_assigns = Map.put(assigns, :action, action) %>
<% action_assigns = Map.put(action_assigns, :isLast, (i == transaction_actions_length - 1)) %>
<%= render BlockScoutWeb.TransactionView, "_actions.html", action_assigns %>
<% end %> <% end %>
</div>
</dd> </dd>
</dl> </dl>
<% end %> <% end %>

Loading…
Cancel
Save