Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

New feature: Visual debugger for Truffle Dashboard #6058

Merged
merged 189 commits into from
Jul 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
189 commits
Select commit Hold shift + click to select a range
aad0afa
dashboard: Debugger WIP
Feb 3, 2023
0cc368f
WIP: hack on getting the debugger working in dashboard
eggplantzzz Feb 17, 2023
0e5b8ba
hack out the state for keeping track of sources and debugger session
eggplantzzz Feb 22, 2023
82d9337
get rid of unnecessary component, type some things, and use provider …
eggplantzzz Feb 23, 2023
e41bc51
fetch verified source material after loading compilations from browser
eggplantzzz Feb 27, 2023
f268631
use loop instead of reduce for finding unknown addresses affected
eggplantzzz Feb 27, 2023
23327f2
get scroll working crudely and provide error message when tx hash not…
eggplantzzz Feb 27, 2023
7efccc7
add new inspect lib, create Variables component, and update operation…
eggplantzzz Mar 1, 2023
b7eead5
get rid of $ assignment
eggplantzzz Mar 1, 2023
c13218a
only call scrollIntoView when the ref exists
eggplantzzz Mar 2, 2023
32c47f0
keep track of unknown sources so we can display something useful in t…
eggplantzzz Mar 2, 2023
59d9685
add a couple of deps to useEffect callback to make React happy
eggplantzzz Mar 6, 2023
5db2df3
add plumbing for keeping track of debugger breakpoints
eggplantzzz Mar 7, 2023
e382389
add click handler on source lines to handle breakpoints and create Un…
eggplantzzz Mar 7, 2023
b733742
update UI when the user clicks on a line to set a breakpoint
eggplantzzz Mar 7, 2023
ee50336
update debugger when setting breakpoints
eggplantzzz Mar 8, 2023
d744047
improve rendering of variables
eggplantzzz Mar 8, 2023
6191736
update mantine packages to latest of version 5
eggplantzzz Mar 9, 2023
4ba3e38
WIP - work on the css for debugger view
eggplantzzz Mar 13, 2023
7264e07
when stepping, make content center in the scrollable container
eggplantzzz Mar 13, 2023
33bfe44
edit styles and component structure a little bit
eggplantzzz Mar 15, 2023
f5f38fc
start work on arranging for a way to set the current source manually
eggplantzzz Mar 16, 2023
5c19ab7
move initDebugger into the utils folder
eggplantzzz Mar 16, 2023
7f36977
use generic html element dom manipulation for jumping to source line
eggplantzzz Mar 17, 2023
d37df9a
remove unnecessary stuff from callback
eggplantzzz Mar 17, 2023
a3a38f9
correct bug with class construction and rename method
eggplantzzz Mar 17, 2023
03eaeac
create delete breakpoint method and use it in breakpoint section
eggplantzzz Mar 20, 2023
dc9d283
give mouse pointer a hover state while over breakpoints
eggplantzzz Mar 21, 2023
30f7937
add source text processing fully into the utils
eggplantzzz Mar 22, 2023
dc49dea
add hacky method for fully supporting multiline comments
eggplantzzz Mar 22, 2023
d7edeba
update useEffects to better deal with autoscrolling as debugger steps
eggplantzzz Mar 22, 2023
71141c4
optimize renders and add type predicate
eggplantzzz Mar 22, 2023
03b8b66
add some comments and pass etherscan api key to source-fetcher if it …
eggplantzzz Mar 29, 2023
3e34868
bump react-dom-router to ^6.10.0
eggplantzzz Mar 31, 2023
8120bed
create simulate tx button and adjust some method signatures in sessio…
eggplantzzz Mar 31, 2023
1693b4f
edit some css and fix a bug involving passing the provider
eggplantzzz Mar 31, 2023
6cf7f7e
add stack component, update useEffects, and start working on notifica…
eggplantzzz Apr 4, 2023
d813e05
rework layout leveraging mantine more
eggplantzzz Apr 7, 2023
5d6ba2f
update html a bit and the scrolling algorithm
eggplantzzz Apr 12, 2023
243342e
remove contracts module from dashboard
eggplantzzz Apr 12, 2023
a32c48f
dashboard: Debugger WIP
Feb 3, 2023
309bccc
hack out the state for keeping track of sources and debugger session
eggplantzzz Feb 22, 2023
6957841
get scroll working crudely and provide error message when tx hash not…
eggplantzzz Feb 27, 2023
b85dc48
add new inspect lib, create Variables component, and update operation…
eggplantzzz Mar 1, 2023
9862778
only call scrollIntoView when the ref exists
eggplantzzz Mar 2, 2023
3bbcd1d
keep track of unknown sources so we can display something useful in t…
eggplantzzz Mar 2, 2023
13a306c
add plumbing for keeping track of debugger breakpoints
eggplantzzz Mar 7, 2023
2503461
update debugger when setting breakpoints
eggplantzzz Mar 8, 2023
7285d1a
WIP - work on the css for debugger view
eggplantzzz Mar 13, 2023
ba31acb
when stepping, make content center in the scrollable container
eggplantzzz Mar 13, 2023
1f94e9d
start work on arranging for a way to set the current source manually
eggplantzzz Mar 16, 2023
56e8ee8
use generic html element dom manipulation for jumping to source line …
eggplantzzz Mar 17, 2023
9468597
create delete breakpoint method and use it in breakpoint section
eggplantzzz Mar 20, 2023
c590095
give mouse pointer a hover state while over breakpoints
eggplantzzz Mar 21, 2023
883fc67
update useEffects to better deal with autoscrolling as debugger steps
eggplantzzz Mar 22, 2023
10d9d68
optimize renders
eggplantzzz Mar 22, 2023
8e3bf27
update html a bit, some styles, and the scrolling algorithm
eggplantzzz Apr 12, 2023
ea8b400
keep werkin that design
eggplantzzz Apr 14, 2023
46b1895
give individual panes nice, curvy corners and update stack
eggplantzzz Apr 14, 2023
299864d
update unknown source display, add more css, and try a different disp…
eggplantzzz Apr 17, 2023
6ea2853
update background color for uknown source in dark mode and update bre…
eggplantzzz Apr 17, 2023
5025c93
reword message
eggplantzzz Apr 17, 2023
0f125de
set reasonable scroll amount
eggplantzzz Apr 17, 2023
f41863a
refine breakpoint design
eggplantzzz Apr 18, 2023
785c61b
remove notification on error, text in header, and style header
eggplantzzz Apr 19, 2023
fc997f4
move some css into component and tweak input stuff
eggplantzzz Apr 19, 2023
ca84e66
continue moving css to component files
eggplantzzz Apr 19, 2023
1b890c3
move all debugger logic into the Debugger folder
eggplantzzz Apr 20, 2023
fbadf0b
add padding to breakpoints and tweak border radius for sources
eggplantzzz Apr 21, 2023
e5bd017
add component for displaying preparation progress
eggplantzzz Apr 21, 2023
949318e
keep unknown addresses in the global state
eggplantzzz Apr 21, 2023
c858b28
tighten up some more styling and add naive implementation of preparin…
eggplantzzz Apr 24, 2023
6314ac5
rearrange some code and make active source tab a different color
eggplantzzz Apr 24, 2023
acb0f22
fix issue with debugger line numbering and breakpoint system
eggplantzzz Apr 24, 2023
e7006ef
tweak colors for active/inactive tabs on sources
eggplantzzz Apr 25, 2023
e17c880
add tooltips to control buttons
eggplantzzz Apr 25, 2023
0ffeaf1
add new inactive status for welcome page and add loading spinner
eggplantzzz Apr 25, 2023
8a2cfa1
create home page for debugger and store etherscan api key in global s…
eggplantzzz Apr 26, 2023
1887513
use mantine hook for interacting with local storage and remove unnece…
eggplantzzz Apr 26, 2023
f1e4b9c
tweak text for etherscan key and update styling
eggplantzzz Apr 26, 2023
2307471
remove border from input
eggplantzzz Apr 26, 2023
0a5640d
further develop etherscan prompt
eggplantzzz Apr 26, 2023
b66d22a
adjust color of prompt container for dark mode
eggplantzzz Apr 26, 2023
46aa95c
add background color change for active navbar item and update css for…
eggplantzzz Apr 27, 2023
c29d4ab
re-add disabled prop to nav buttons and make background color consist…
eggplantzzz Apr 27, 2023
af95494
rework how ganache/provider options are passed through init functions
eggplantzzz Apr 27, 2023
98a8390
instead of passing provider, pass network id through init functions
eggplantzzz Apr 27, 2023
a667627
group network id and etherscan key under one parameter named fetching…
eggplantzzz Apr 27, 2023
c12be50
add simple error notification when there is an issue with debugger in…
eggplantzzz Apr 28, 2023
43d411b
slightly re-work design for tx signer dialogue
eggplantzzz Apr 28, 2023
e673036
add some more info to error notification
eggplantzzz Apr 28, 2023
9bf7516
tweak error notification design
eggplantzzz Apr 28, 2023
b2fa4f5
update etherscan message and tweak scrolling algorithm
eggplantzzz May 1, 2023
ff33eb0
match active color for sidebar items to the bottom left button backgr…
eggplantzzz May 2, 2023
32e839f
hook up input field and use test tx hash as a backup
eggplantzzz May 2, 2023
cfe37cb
style to fix a bug where content went offscreen
eggplantzzz May 3, 2023
296ad79
indent variable names in display
eggplantzzz May 3, 2023
f9b4234
remove object-inspect from project and add fetch-and-compile to dashb…
eggplantzzz May 4, 2023
628aeec
use flex elements to alleviate weird scrolling issue and remove unnec…
eggplantzzz May 4, 2023
1b32190
make another naive attempt at getting the stack information correct
eggplantzzz May 4, 2023
fda1207
make tabs for sources scroll instead of stacking
eggplantzzz May 5, 2023
0d216fd
update ResultInspector to take options
eggplantzzz May 4, 2023
5bffa5f
check to make sure an affected address is a contract and not an EOA
eggplantzzz May 5, 2023
a621208
save fetched compilations in the browser
eggplantzzz May 5, 2023
af5eafd
check to see if a session is loaded so a debugger session doesn't van…
eggplantzzz May 10, 2023
343c3db
make block highlighting include whitespace at start of lines
eggplantzzz May 11, 2023
6ba3cdd
scroll only when debugger steps or current source changes
eggplantzzz May 11, 2023
b4e4548
fix block highlighting issue
eggplantzzz May 11, 2023
3e299da
make continue until breakpoint button inactive until one is set
eggplantzzz May 11, 2023
6991d29
Revert "fix block highlighting issue"
eggplantzzz May 12, 2023
3f04c11
remove testing tx hashes
eggplantzzz May 12, 2023
7fabfa3
disable submit button when no tx hash is in input and remove some css
eggplantzzz May 12, 2023
2e88553
remove duplicate entries in dashboard package.json and update to curr…
eggplantzzz May 25, 2023
167b07d
use vs code icons for debugger buttons
eggplantzzz May 26, 2023
c7c4b26
improve block highlighting
eggplantzzz May 30, 2023
e0ff7f5
add some comments and correct property name
eggplantzzz Jun 1, 2023
ea9a306
clean up some unnecessary code snippets
eggplantzzz Jun 1, 2023
4710170
make some corrections based on react warnings
eggplantzzz Jun 1, 2023
3ad37ae
handle case when the source range has an undefined source id
eggplantzzz Jun 1, 2023
6813d28
highlight the line numbers on lines that have highlighting
eggplantzzz Jun 1, 2023
1a2470e
make some refinements based on the design
eggplantzzz Jun 2, 2023
11b1312
narrow error notification box, wrap text when too long, and remove im…
eggplantzzz Jun 5, 2023
64e2984
refine the etherscan api key message and move a line of code
eggplantzzz Jun 5, 2023
0e6572d
adjust some types related to visual debugger state
eggplantzzz Jun 7, 2023
f91f382
handle when the fetch request for source material is not ok
eggplantzzz Jun 8, 2023
9e9cbd9
clean up after rebase mistakes
eggplantzzz Jun 8, 2023
b820032
make Ganache fork the current block instead of 5 blocks behind the cu…
eggplantzzz Jun 9, 2023
4b07e3b
fix debug button that broke
eggplantzzz Jun 9, 2023
ed054c2
clean up another rebase mistake
eggplantzzz Jun 13, 2023
d6d9094
add emojis to the etherscan api key message
eggplantzzz Jun 13, 2023
34dfa6e
make button icons larger
eggplantzzz Jun 13, 2023
2f564ef
add a check to make sure the source id is defined before setting
eggplantzzz Jun 13, 2023
9696257
limit ganache output in preparing screen to 6 lines
eggplantzzz Jun 14, 2023
c24e469
fix some spacing issues related to source material
eggplantzzz Jun 14, 2023
cc6f5d3
Use codec-components inside Dashboard Debugger
gnidan Jun 14, 2023
583f6fe
dashboard: Import codec components styles
cliffoo Jun 14, 2023
bc697dd
complete html broken when we chop up the source code and use   f…
eggplantzzz Jun 20, 2023
a47bfe9
separate source material into two panes: line number and source material
eggplantzzz Jun 21, 2023
66e6173
remove some unnecessary imports, some unused libs, update some deps, …
eggplantzzz Jun 22, 2023
72f8485
Display variables in <ul> with <NameValuePair>
gnidan Jun 22, 2023
1bcfa2a
update preparing session message
eggplantzzz Jun 23, 2023
892eefb
add another step for preparation and put it in 'prep' mode earlier to…
eggplantzzz Jun 23, 2023
87c348a
add comment about why we add highlighting tags at the end of html pro…
eggplantzzz Jun 26, 2023
2b26bc1
add in hacky thing to deal with some instances of bad source maps
eggplantzzz Jun 26, 2023
b1a6fea
update yarn.lock
eggplantzzz Jun 27, 2023
2db4381
don't set breakpoints on source code but only the margin
eggplantzzz Jun 27, 2023
a7543a7
make input responsive to enter key press
eggplantzzz Jun 29, 2023
bda3aa1
make syntax highlighting more Truffle-y
eggplantzzz Jul 5, 2023
19a73d2
bump ganache to 7.9.0 in dashboard and set some truffle deps to the c…
eggplantzzz Jul 6, 2023
f3ebfd5
replace accidentally deleted dependency and update yarn.lock
eggplantzzz Jul 6, 2023
906ef8f
dashboard: Improve contrast in debugger
cliffoo Jul 6, 2023
38d7240
remove some unused styling
eggplantzzz Jul 7, 2023
927ba36
get rid of border from mantine component
eggplantzzz Jul 7, 2023
23572a6
remove argument from fetch and compile route
eggplantzzz Jul 7, 2023
d38e76c
set border-radius property properly
eggplantzzz Jul 7, 2023
391c042
remove unused styling classes
eggplantzzz Jul 7, 2023
fe57147
change name of button from 'SimulateTx' to 'Debug'
eggplantzzz Jul 7, 2023
f56a7c7
add type
eggplantzzz Jul 7, 2023
a68a77f
Update packages/dashboard/src/components/composed/Debugger/Variables.tsx
eggplantzzz Jul 7, 2023
36a9998
move etherscan api key name to constants
eggplantzzz Jul 7, 2023
576ae9c
cast window.ethereum as any to get rid of some ts-ignores
eggplantzzz Jul 7, 2023
2a1d01b
get rid of unnecessary flex
eggplantzzz Jul 10, 2023
44e8c9d
Update packages/dashboard/src/components/composed/Debugger/PreparingS…
eggplantzzz Jul 10, 2023
29bede6
remove unnecessary escapes
eggplantzzz Jul 10, 2023
4704330
re-add flex
eggplantzzz Jul 10, 2023
24177e2
use constant
eggplantzzz Jul 10, 2023
7de1f79
move some styles into the component file and remove unused class
eggplantzzz Jul 10, 2023
31c9d30
Update packages/dashboard/src/components/composed/Debugger/Sources/in…
eggplantzzz Jul 10, 2023
9729d8b
change type of variable and get rid of some ts-ignores
eggplantzzz Jul 10, 2023
72ff67c
remove method that was replaced and never removed
eggplantzzz Jul 10, 2023
3527792
re-add hover state for inactive navbar tabs
eggplantzzz Jul 10, 2023
393cd4b
add two methods to session type and remove some ts-ignores
eggplantzzz Jul 11, 2023
5babf90
use non-null assertion instead of conditional logic and use createSty…
eggplantzzz Jul 11, 2023
42d496d
revert changes to the try in fetch-and-compile route
eggplantzzz Jul 11, 2023
92cd396
get rid of method
eggplantzzz Jul 11, 2023
98ae2ec
correct type for operations
eggplantzzz Jul 11, 2023
7e6c1d1
move string constants next to the others
eggplantzzz Jul 11, 2023
13ceee4
update mantine-related classes and add eslint ignore comment
eggplantzzz Jul 12, 2023
f7fa66b
update one more mantine-related class and use empty string instead of…
eggplantzzz Jul 12, 2023
e9a00dc
eslint ignore entire file, cast window.ethereum as any, and remove un…
eggplantzzz Jul 12, 2023
860c006
get rid of some unnecessary css stuff
eggplantzzz Jul 12, 2023
beef549
change how highlighted class is stored in constants and update code u…
eggplantzzz Jul 12, 2023
6739448
narrow the scope of the eslint ignore
eggplantzzz Jul 12, 2023
47a71d3
remove console.log
eggplantzzz Jul 12, 2023
0de3172
conditionally add tooltip to fix an issue where it won't disappear wh…
eggplantzzz Jul 12, 2023
e628520
re-work Variables component to store raw data in state and calculate …
eggplantzzz Jul 13, 2023
e86fc8f
store stack report data in state and use that for the render
eggplantzzz Jul 13, 2023
5ec4f32
dashboard: Fix debug button styles
cliffoo Jul 14, 2023
4c74c93
dashboard: Clean up ganache indexeddb on start
cliffoo Jul 14, 2023
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
2 changes: 1 addition & 1 deletion packages/dashboard/lib/DashboardServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import express, { Application, NextFunction, Request, Response } from "express";
import path from "path";
import getPort from "get-port";
import open from "open";
import { v4 as uuid } from "uuid";
import { fetchAndCompile } from "@truffle/fetch-and-compile";
import { sha1 } from "object-hash";
import { v4 as uuid } from "uuid";
import Config from "@truffle/config";
import {
dashboardProviderMessageType,
Expand Down
25 changes: 17 additions & 8 deletions packages/dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,31 +33,40 @@
"types": "dist/lib/index.d.ts",
"dependencies": {
"@emotion/react": "^11.9.3",
"@mantine/core": "^5.0.0",
"@mantine/hooks": "^5.0.0",
"@mantine/notifications": "^5.0.0",
"@mantine/prism": "^5.0.0",
"@truffle/codec": "^0.17.0",
"@truffle/config": "^1.3.58",
"@truffle/decoder": "^6.1.0",
"@truffle/fetch-and-compile": "^0.5.51",
"@truffle/codec-components": "^0.1.2",
"@truffle/dashboard-message-bus": "^0.1.11",
"@truffle/dashboard-message-bus-client": "^0.1.11",
"@truffle/dashboard-message-bus-common": "^0.1.6",
"@truffle/decoder": "^6.1.0",
"@truffle/fetch-and-compile": "^0.5.51",
"@truffle/debugger": "^12.1.0",
"@truffle/debug-utils": "^6.0.54",
"@mantine/core": "^5.10.5",
"@mantine/hooks": "^5.10.5",
"@mantine/notifications": "^5.10.5",
"@mantine/prism": "^5.10.5",
"cors": "^2.8.5",
"css-loader": "^6.8.1",
"debug": "^4.3.2",
"ethers": "^5.6.9",
"express": "^4.17.1",
"ganache": "7.9.0",
"get-port": "^5.1.1",
"highlightjs-solidity": "^2.0.6",
"idb": "^7.1.1",
"isomorphic-ws": "^4.0.1",
"lowlight": "^2.8.1",
"object-hash": "^3.0.0",
"object-inspect": "^1.12.2",
eggplantzzz marked this conversation as resolved.
Show resolved Hide resolved
"open": "^8.4.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-feather": "^2.0.10",
"react-router-dom": "^6.3.0",
"react-router-dom": "^6.10.0",
"rehype-stringify": "^9.0.3",
"style-loader": "^3.3.3",
"unified": "^10.1.2",
"uuid": "^9.0.0",
"wagmi": "^0.6.3",
"ws": "^7.2.0"
Expand Down
2 changes: 2 additions & 0 deletions packages/dashboard/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { BrowserRouter, Routes, Route, Navigate } from "react-router-dom";
// Components
import Layout from "src/components/composed/Layout";
import RPCs from "src/components/composed/RPCs";
import Debugger from "src/components/composed/Debugger";
import Palette from "src/components/composed/Palette";
import MantineGlobal from "src/components/MantineGlobal";

Expand All @@ -26,6 +27,7 @@ function App(): JSX.Element {
<Route path="/" element={<Layout />}>
<Route index element={<Navigate to="/rpcs" replace />} />
<Route path="rpcs" element={<RPCs />} />
<Route path="debugger" element={<Debugger />} />
</Route>
{process.env.NODE_ENV === "development" && (
<Route path="colors" element={<Palette />} />
Expand Down
76 changes: 68 additions & 8 deletions packages/dashboard/src/components/MantineGlobal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,22 @@ const fonts = [
}
];

const truffleBgColorSelectors = [".mantine-AppShell-root"].join(", ");
const truffleBgColorSelectors = [".trfl-AppShell-root"].join(", ");

const truffleOffBgColorSelectors = [
".mantine-Navbar-root",
".mantine-Paper-root"
".trfl-Navbar-root",
".trfl-Paper-root"
].join(", ");

const watermelonHex = "#E86591";
const orangeHex = "#E4A663";
const orangeBrightHex = "#E78820";
const redHex = "#D60000";
const mintHex = "#3FE0C5";
const mintDarkHex = "#0FBEA1";
const greenHex = "#00D717";
const greenDarkHex = "#00A412";

function MantineGlobal(): JSX.Element {
return (
<Global
Expand All @@ -42,33 +51,84 @@ function MantineGlobal(): JSX.Element {
[`${truffleBgColorSelectors}, ${truffleOffBgColorSelectors}`]: {
transition: "background-color 0.1s"
},
".mantine-Alert-icon": {
// class for highlighting source material in debugger
".truffle-debugger-text-highlighted": {
backgroundColor:
colorScheme === "dark" ? "#4444aa60" : "#ffff0050"
},

".trfl-Input-wrapper": {
flexGrow: 1
},
".trfl-Alert-icon": {
"width": 28,
"height": "auto",
"> svg": {
height: 28,
width: 28
}
},
".mantine-Notification-root": {
".trfl-Notification-root": {
"backgroundColor":
colorScheme === "dark" ? colors["dark"][4] : white,
"padding": "1rem 1rem 1rem 2rem",
".mantine-Notification-title": {
".trfl-Notification-title": {
fontSize: 15
}
},
".mantine-Prism-code": {
".trfl-Prism-code": {
"backgroundColor":
colorScheme === "dark"
? `${fn.darken(colors["truffle-brown"][9], 0.1)} !important`
: `${colors["truffle-beige"][0]} !important`,
".mantine-Prism-lineNumber": {
".trfl-Prism-lineNumber": {
color:
colorScheme === "dark"
? colors["truffle-brown"][5]
: colors["truffle-beige"][5]
}
},
".codec-components-code-bracket": {
color: colors["truffle-beige"][8]
},
".hljs-comment, .hljs-quote": {
color:
theme.colorScheme === "dark"
? colors["truffle-beige"][8]
: colors["truffle-beige"][6],
fontStyle: "italic"
},
".hljs-keyword": {
color: theme.colorScheme === "dark" ? mintHex : mintDarkHex,
fontWeight: "bold"
},
".hljs-subst": {
color: colors.pink[7],
fontWeight: "normal"
},
".hljs-number": {
color: redHex
},
".hljs-string, .hljs-doctag": {
color: theme.colorScheme === "dark" ? greenHex : greenDarkHex
},
[[
".hljs-type",
".hljs-class",
".hljs-title",
".hljs-section",
".hljs-selector-id",
".codec-components-code-name"
].join(", ")]: {
color: theme.colorScheme === "dark" ? orangeHex : orangeBrightHex,
fontWeight: "bold"
},
".hljs-attribute": {
color: colors["truffle-teal"][8],
fontWeight: "normal"
},
".hljs-literal, .hljs-built_in, .hljs-builtin-name": {
color: watermelonHex
}
}
];
Expand Down
5 changes: 0 additions & 5 deletions packages/dashboard/src/components/composed/Contracts.tsx

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import type { BreakpointType } from "src/components/composed/Debugger/utils";
import { createStyles } from "@mantine/core";

const useStyles = createStyles(() => ({
breakpointGroup: {
display: "flex",
marginBottom: 5
},
breakpointDelete: {
"&:hover": {
cursor: "pointer"
},
"borderRadius": 8,
"backgroundColor": "#FA5252",
"width": 16,
"height": 16,
"marginRight": 16
},
breakpoint: {
"&:hover": {
cursor: "pointer"
}
}
}));

type BreakpointProps = {
sourceName: string;
line: number;
sourceId: string;
handleBreakpointComponentClick: (arg: BreakpointType) => void;
handleBreakpointDeleteClick: (arg: BreakpointType) => void;
};

function Breakpoint({
sourceName,
line,
sourceId,
handleBreakpointComponentClick,
handleBreakpointDeleteClick
}: BreakpointProps): JSX.Element | null {
const { classes } = useStyles();
return (
<div className={classes.breakpointGroup}>
<div
className={classes.breakpointDelete}
onClick={() =>
handleBreakpointDeleteClick({
sourceId,
line
})
}
></div>
<div
className={classes.breakpoint}
onClick={() =>
handleBreakpointComponentClick({
sourceId,
line
})
}
>
{sourceName} - line {line}
</div>
</div>
);
}

export default Breakpoint;
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
import { Source } from "src/components/composed/Debugger/utils";
import { useDash } from "src/hooks";
import * as path from "path";
import { BreakpointType } from "src/components/composed/Debugger/utils";
import Breakpoint from "src/components/composed/Debugger/Breakpoints/Breakpoint";
import { Flex, createStyles } from "@mantine/core";

const useStyles = createStyles(theme => ({
breakpointsContainer: {
overflow: "hidden",
height: "30%",
borderWidth: 1,
borderStyle: "solid",
borderRadius: 4,
marginBottom: 20,
borderColor:
theme.colorScheme === "dark"
? theme.colors["truffle-brown"][5]
: `${theme.colors["truffle-beige"][5]}73`
},
sectionHeader: {
height: 42,
fontSize: 16,
paddingTop: 10,
paddingLeft: 16,
backgroundColor:
theme.colorScheme === "dark"
? `${theme.colors["truffle-beige"][8]}33`
: theme.colors["truffle-beige"][2],
borderBottom: "1px solid",
borderColor:
theme.colorScheme === "dark"
? theme.colors["truffle-brown"][5]
: `${theme.colors["truffle-beige"][5]}73`
},
breakpoints: {
overflow: "scroll",
height: "100%",
backgroundColor:
theme.colorScheme === "dark" ? theme.colors["truffle-brown"][8] : "white"
},
breakpointsContent: {
paddingLeft: 10
}
}));

type BreakpointsArgs = {
sources: Source[];
handleBreakpointComponentClick: (breakpoint: BreakpointType) => void;
handleBreakpointDeleteClick: (breakpoint: BreakpointType) => void;
};

function Breakpoints({
sources,
handleBreakpointComponentClick,
handleBreakpointDeleteClick
}: BreakpointsArgs): JSX.Element | null {
const { classes } = useStyles();
const {
state: {
debugger: { breakpoints }
}
} = useDash()!;
const breakpointsList: JSX.Element[] = [];
for (const source of sources) {
if (
breakpoints[source.id] === undefined ||
breakpoints[source.id].size === 0
) {
continue;
}
if (!source?.sourcePath) {
continue;
}
const iterator = breakpoints[source.id].values();
const sourceName = path.basename(source.sourcePath);
for (const line of iterator) {
breakpointsList.push(
<Breakpoint
key={`${source.id}${line.toString()}`}
sourceName={sourceName}
line={line}
sourceId={source.id}
handleBreakpointComponentClick={handleBreakpointComponentClick}
handleBreakpointDeleteClick={handleBreakpointDeleteClick}
/>
);
}
}
return (
<Flex direction="column" className={classes.breakpointsContainer}>
<div className={classes.sectionHeader}>Breakpoints</div>
<div className={classes.breakpoints}>
<pre className={classes.breakpointsContent}>{breakpointsList}</pre>
</div>
</Flex>
);
}

export default Breakpoints;
Loading