Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
frontend
Commits
1864622d
Commit
1864622d
authored
Mar 20, 2023
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
editor for one file and color fixes
parent
6d8e1324
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
42 additions
and
20 deletions
+42
-20
ContractSourceCode.tsx
ui/address/contract/ContractSourceCode.tsx
+6
-0
CodeEditor.tsx
ui/shared/monaco/CodeEditor.tsx
+14
-0
CodeEditorSearch.tsx
ui/shared/monaco/CodeEditorSearch.tsx
+6
-6
CodeEditorSearchResultItem.tsx
ui/shared/monaco/CodeEditorSearchResultItem.tsx
+1
-1
CodeEditorTab.tsx
ui/shared/monaco/CodeEditorTab.tsx
+1
-1
CoderEditorCollapseButton.tsx
ui/shared/monaco/CoderEditorCollapseButton.tsx
+1
-1
themes.ts
ui/shared/monaco/utils/themes.ts
+13
-11
No files found.
ui/address/contract/ContractSourceCode.tsx
View file @
1864622d
...
...
@@ -4,6 +4,7 @@ import React from 'react';
import
type
{
SmartContract
}
from
'
types/api/contract
'
;
import
CopyToClipboard
from
'
ui/shared/CopyToClipboard
'
;
import
LinkInternal
from
'
ui/shared/LinkInternal
'
;
import
CodeEditor
from
'
ui/shared/monaco/CodeEditor
'
;
import
formatFilePath
from
'
ui/shared/monaco/utils/formatFilePath
'
;
...
...
@@ -44,11 +45,16 @@ const ContractSourceCode = ({ data, hasSol2Yml, address, isViper, filePath, addi
...(
additionalSource
||
[]).
map
((
source
)
=>
({
...
source
,
file_path
:
formatFilePath
(
source
.
file_path
)
}))
];
},
[
additionalSource
,
data
,
filePath
,
isViper
]);
const
copyToClipboard
=
editorData
.
length
===
1
?
<
CopyToClipboard
text=
{
editorData
[
0
].
source_code
}
/>
:
null
;
return
(
<
section
>
<
Flex
justifyContent=
"space-between"
alignItems=
"center"
mb=
{
3
}
>
{
heading
}
{
diagramLink
}
{
copyToClipboard
}
</
Flex
>
<
CodeEditor
data=
{
editorData
}
/>
</
section
>
...
...
ui/shared/monaco/CodeEditor.tsx
View file @
1864622d
...
...
@@ -88,6 +88,20 @@ const CodeEditor = ({ data }: Props) => {
});
},
[
data
,
index
]);
if
(
data
.
length
===
1
)
{
return
(
<
Box
overflow=
"hidden"
borderRadius=
"md"
height=
"540px"
>
<
MonacoEditor
language=
"sol"
path=
{
data
[
index
].
file_path
}
defaultValue=
{
data
[
index
].
source_code
}
options=
{
EDITOR_OPTIONS
}
onMount=
{
handleEditorDidMount
}
/>
</
Box
>
);
}
return
(
<
Flex
overflow=
"hidden"
borderRadius=
"md"
height=
"540px"
position=
"relative"
>
<
Box
flexGrow=
{
1
}
>
...
...
ui/shared/monaco/CodeEditorSearch.tsx
View file @
1864622d
...
...
@@ -152,26 +152,26 @@ const CodeEditorSearch = ({ monaco, data, onFileSelect, isInputStuck }: Props) =
{
...
buttonProps
}
className=
"codicon codicon-case-sensitive"
onClick=
{
setMatchCase
.
toggle
}
bgColor=
{
isMatchCase
?
themeColors
[
'
inputOption.activeBackground
'
]
:
'
transparent
'
}
_hover=
{
{
bgColor
:
isMatchCase
?
themeColors
[
'
inputOption.activeBackground
'
]
:
themeColors
[
'
inputOption.hoverBackground
'
]
}
}
bgColor=
{
isMatchCase
?
themeColors
[
'
custom.
inputOption.activeBackground
'
]
:
'
transparent
'
}
_hover=
{
{
bgColor
:
isMatchCase
?
themeColors
[
'
custom.inputOption.activeBackground
'
]
:
themeColors
[
'
custom.
inputOption.hoverBackground
'
]
}
}
title=
"Match Case"
aria
-
label=
"Match Case"
/>
<
Box
{
...
buttonProps
}
className=
"codicon codicon-whole-word"
bgColor=
{
isMatchWholeWord
?
themeColors
[
'
inputOption.activeBackground
'
]
:
'
transparent
'
}
bgColor=
{
isMatchWholeWord
?
themeColors
[
'
custom.
inputOption.activeBackground
'
]
:
'
transparent
'
}
onClick=
{
setMatchWholeWord
.
toggle
}
_hover=
{
{
bgColor
:
isMatchWholeWord
?
themeColors
[
'
inputOption.activeBackground
'
]
:
themeColors
[
'
inputOption.hoverBackground
'
]
}
}
_hover=
{
{
bgColor
:
isMatchWholeWord
?
themeColors
[
'
custom.inputOption.activeBackground
'
]
:
themeColors
[
'
custom.
inputOption.hoverBackground
'
]
}
}
title=
"Match Whole Word"
aria
-
label=
"Match Whole Word"
/>
<
Box
{
...
buttonProps
}
className=
"codicon codicon-regex"
bgColor=
{
isMatchRegex
?
themeColors
[
'
inputOption.activeBackground
'
]
:
'
transparent
'
}
bgColor=
{
isMatchRegex
?
themeColors
[
'
custom.
inputOption.activeBackground
'
]
:
'
transparent
'
}
onClick=
{
setMatchRegex
.
toggle
}
_hover=
{
{
bgColor
:
isMatchRegex
?
themeColors
[
'
inputOption.activeBackground
'
]
:
themeColors
[
'
inputOption.hoverBackground
'
]
}
}
_hover=
{
{
bgColor
:
isMatchRegex
?
themeColors
[
'
custom.inputOption.activeBackground
'
]
:
themeColors
[
'
custom.
inputOption.hoverBackground
'
]
}
}
title=
"Use Regular Expression"
aria
-
label=
"Use Regular Expression"
/>
...
...
ui/shared/monaco/CodeEditorSearchResultItem.tsx
View file @
1864622d
...
...
@@ -48,7 +48,7 @@ const CodeEditorSearchResultItem = ({ lineContent, filePath, onClick, startLineN
_hover=
{
{
bgColor
:
themeColors
[
'
list.hoverBackground
'
]
}
}
>
<
span
>
{
lineContent
.
slice
(
start
,
startColumn
-
1
)
}
</
span
>
<
chakra
.
span
bgColor=
{
themeColors
[
'
editor
.findMatchHighlightBackground
'
]
}
>
<
chakra
.
span
bgColor=
{
themeColors
[
'
custom
.findMatchHighlightBackground
'
]
}
>
{
lineContent
.
slice
(
startColumn
-
1
,
endColumn
-
1
)
}
</
chakra
.
span
>
<
span
>
{
lineContent
.
slice
(
endColumn
-
1
)
}
</
span
>
...
...
ui/shared/monaco/CodeEditorTab.tsx
View file @
1864622d
...
...
@@ -69,7 +69,7 @@ const CodeEditorTab = ({ isActive, path, onClick, onClose, isCloseDisabled, tabs
opacity=
{
isCloseDisabled
?
0.3
:
1
}
visibility=
{
isActive
?
'
visible
'
:
'
hidden
'
}
color=
{
themeColors
[
'
icon.foreground
'
]
}
_hover=
{
{
bgColor
:
isCloseDisabled
?
'
transparent
'
:
themeColors
[
'
inputOption.hoverBackground
'
]
}
}
_hover=
{
{
bgColor
:
isCloseDisabled
?
'
transparent
'
:
themeColors
[
'
custom.
inputOption.hoverBackground
'
]
}
}
/>
</
Flex
>
);
...
...
ui/shared/monaco/CoderEditorCollapseButton.tsx
View file @
1864622d
...
...
@@ -28,7 +28,7 @@ const CoderEditorCollapseButton = ({ onClick, label, isDisabled, isCollapsed }:
content
:
isCollapsed
?
'
"
\\
eb95"
'
:
'
"
\\
eac5"
'
,
}
}
_hover=
{
{
bgColor
:
themeColors
[
'
inputOption.hoverBackground
'
],
bgColor
:
themeColors
[
'
custom.
inputOption.hoverBackground
'
],
}
}
onClick=
{
onClick
}
cursor=
"pointer"
...
...
ui/shared/monaco/utils/themes.ts
View file @
1864622d
...
...
@@ -4,7 +4,6 @@ export const light = {
rules
:
[],
colors
:
{
'
editor.background
'
:
'
#f5f5f6
'
,
'
editor.findMatchHighlightBackground
'
:
'
rgba(234, 92, 0, 0.33)
'
,
'
tab.activeBackground
'
:
'
#f5f5f6
'
,
'
tab.inactiveBackground
'
:
'
rgb(236, 236, 236)
'
,
...
...
@@ -14,12 +13,9 @@ export const light = {
'
icon.foreground
'
:
'
#616161
'
,
'
input.foreground
'
:
'
rgb(97, 97, 97)
'
,
'
input.foreground
'
:
'
#616161
'
,
'
input.background
'
:
'
#fff
'
,
'
inputOption.activeBackground
'
:
'
rgba(0, 144, 241, 0.2)
'
,
'
inputOption.hoverBackground
'
:
'
rgba(184, 184, 184, 0.31)
'
,
'
list.hoverBackground
'
:
'
rgba(16, 17, 18, 0.08)
'
,
// blackAlpha.200
'
list.inactiveSelectionBackground
'
:
'
#e4e6f1
'
,
...
...
@@ -30,6 +26,11 @@ export const light = {
'
sideBar.background
'
:
'
#eee
'
,
focusBorder
:
'
#0090f1
'
,
// not able to use rgba for standard variables, so we use custom prefix here
'
custom.findMatchHighlightBackground
'
:
'
rgba(234,92,0,0.33)
'
,
'
custom.inputOption.activeBackground
'
:
'
rgba(0, 144, 241, 0.2)
'
,
'
custom.inputOption.hoverBackground
'
:
'
rgba(184, 184, 184, 0.31)
'
,
}
as
const
,
};
...
...
@@ -39,7 +40,6 @@ export const dark = {
rules
:
[],
colors
:
{
'
editor.background
'
:
'
#1a1b1b
'
,
'
editor.findMatchHighlightBackground
'
:
'
rgba(234, 92, 0, 0.33)
'
,
'
tab.activeBackground
'
:
'
#1a1b1b
'
,
// black
'
tab.inactiveBackground
'
:
'
rgb(45, 45, 45)
'
,
...
...
@@ -49,11 +49,8 @@ export const dark = {
'
icon.foreground
'
:
'
#616161
'
,
'
input.foreground
'
:
'
rgb(204, 204, 204)
'
,
'
input.background
'
:
'
rgb(60, 60, 60)
'
,
'
inputOption.activeBackground
'
:
'
rgba(0, 127, 212, 0.4)
'
,
'
inputOption.hoverBackground
'
:
'
rgba(90, 93, 94, 0.31)
'
,
'
input.foreground
'
:
'
#cccccc
'
,
'
input.background
'
:
'
#3c3c3c
'
,
'
list.hoverBackground
'
:
'
rgba(255, 255, 255, 0.08)
'
,
// whiteAlpha.200
'
list.inactiveSelectionBackground
'
:
'
#37373d
'
,
...
...
@@ -65,5 +62,10 @@ export const dark = {
'
sideBar.background
'
:
'
#222
'
,
focusBorder
:
'
#007fd4
'
,
// not able to use rgba for standard variables, so we use custom prefix here
'
custom.findMatchHighlightBackground
'
:
'
rgba(234,92,0,0.33)
'
,
'
custom.inputOption.activeBackground
'
:
'
rgba(0, 127, 212, 0.4)
'
,
'
custom.inputOption.hoverBackground
'
:
'
rgba(90, 93, 94, 0.31)
'
,
}
as
const
,
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment