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
be50eae3
Commit
be50eae3
authored
Jun 20, 2023
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add icon for vyper contracts
parent
e3e38248
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
43 additions
and
17 deletions
+43
-17
CodeEditorFileIcon.tsx
ui/shared/monaco/CodeEditorFileIcon.tsx
+29
-0
CodeEditorFileTree.tsx
ui/shared/monaco/CodeEditorFileTree.tsx
+2
-5
CodeEditorSearchSection.tsx
ui/shared/monaco/CodeEditorSearchSection.tsx
+3
-6
CodeEditorTab.tsx
ui/shared/monaco/CodeEditorTab.tsx
+3
-6
vyper.svg
ui/shared/monaco/icons/vyper.svg
+6
-0
No files found.
ui/shared/monaco/CodeEditorFileIcon.tsx
0 → 100644
View file @
be50eae3
import
{
Icon
,
chakra
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
iconFile
from
'
./icons/file.svg
'
;
import
iconSolidity
from
'
./icons/solidity.svg
'
;
import
iconVyper
from
'
./icons/vyper.svg
'
;
interface
Props
{
className
?:
string
;
fileName
:
string
;
}
const
CodeEditorFileIcon
=
({
className
,
fileName
}:
Props
)
=>
{
const
as
=
(()
=>
{
if
(
/.vy$/
.
test
(
fileName
))
{
return
iconVyper
;
}
if
(
/.sol|.yul$/
.
test
(
fileName
))
{
return
iconSolidity
;
}
return
iconFile
;
})();
return
<
Icon
className=
{
className
}
as=
{
as
}
boxSize=
"16px"
/>;
};
export
default
React
.
memo
(
chakra
(
CodeEditorFileIcon
));
ui/shared/monaco/CodeEditorFileTree.tsx
View file @
be50eae3
...
@@ -4,10 +4,9 @@ import React from 'react';
...
@@ -4,10 +4,9 @@ import React from 'react';
import
type
{
FileTree
}
from
'
./types
'
;
import
type
{
FileTree
}
from
'
./types
'
;
import
iconFile
from
'
./icons/file.svg
'
;
import
CodeEditorFileIcon
from
'
./CodeEditorFileIcon
'
;
import
iconFolderOpen
from
'
./icons/folder-open.svg
'
;
import
iconFolderOpen
from
'
./icons/folder-open.svg
'
;
import
iconFolder
from
'
./icons/folder.svg
'
;
import
iconFolder
from
'
./icons/folder.svg
'
;
import
iconSolidity
from
'
./icons/solidity.svg
'
;
import
useThemeColors
from
'
./utils/useThemeColors
'
;
import
useThemeColors
from
'
./utils/useThemeColors
'
;
interface
Props
{
interface
Props
{
...
@@ -74,8 +73,6 @@ const CodeEditorFileTree = ({ tree, level = 0, onItemClick, isCollapsed, selecte
...
@@ -74,8 +73,6 @@ const CodeEditorFileTree = ({ tree, level = 0, onItemClick, isCollapsed, selecte
);
);
}
}
const
icon
=
/.sol|.yul|.vy$/
.
test
(
leaf
.
name
)
?
iconSolidity
:
iconFile
;
return
(
return
(
<
AccordionItem
<
AccordionItem
key=
{
index
}
key=
{
index
}
...
@@ -92,7 +89,7 @@ const CodeEditorFileTree = ({ tree, level = 0, onItemClick, isCollapsed, selecte
...
@@ -92,7 +89,7 @@ const CodeEditorFileTree = ({ tree, level = 0, onItemClick, isCollapsed, selecte
}
}
}
}
bgColor=
{
selectedFile
===
leaf
.
file_path
?
themeColors
[
'
list.inactiveSelectionBackground
'
]
:
'
none
'
}
bgColor=
{
selectedFile
===
leaf
.
file_path
?
themeColors
[
'
list.inactiveSelectionBackground
'
]
:
'
none
'
}
>
>
<
Icon
as=
{
icon
}
boxSize=
"16px"
mr=
"4px"
/>
<
CodeEditorFileIcon
fileName=
{
leaf
.
name
}
mr=
"4px"
/>
{
leafName
}
{
leafName
}
</
AccordionItem
>
</
AccordionItem
>
);
);
...
...
ui/shared/monaco/CodeEditorSearchSection.tsx
View file @
be50eae3
import
{
AccordionButton
,
AccordionItem
,
AccordionPanel
,
Icon
,
Box
}
from
'
@chakra-ui/react
'
;
import
{
AccordionButton
,
AccordionItem
,
AccordionPanel
,
Box
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
type
{
SearchResult
}
from
'
./types
'
;
import
type
{
SearchResult
}
from
'
./types
'
;
import
CodeEditorFileIcon
from
'
./CodeEditorFileIcon
'
;
import
CodeEditorSearchResultItem
from
'
./CodeEditorSearchResultItem
'
;
import
CodeEditorSearchResultItem
from
'
./CodeEditorSearchResultItem
'
;
import
iconFile
from
'
./icons/file.svg
'
;
import
iconSolidity
from
'
./icons/solidity.svg
'
;
import
getFileName
from
'
./utils/getFileName
'
;
import
getFileName
from
'
./utils/getFileName
'
;
import
useThemeColors
from
'
./utils/useThemeColors
'
;
import
useThemeColors
from
'
./utils/useThemeColors
'
;
...
@@ -24,8 +23,6 @@ const CodeEditorSearchSection = ({ data, onItemClick }: Props) => {
...
@@ -24,8 +23,6 @@ const CodeEditorSearchSection = ({ data, onItemClick }: Props) => {
}
}
},
[
data
.
file_path
,
onItemClick
]);
},
[
data
.
file_path
,
onItemClick
]);
const
icon
=
/.sol|.yul|.vy$/
.
test
(
fileName
)
?
iconSolidity
:
iconFile
;
const
themeColors
=
useThemeColors
();
const
themeColors
=
useThemeColors
();
return
(
return
(
...
@@ -48,7 +45,7 @@ const CodeEditorSearchSection = ({ data, onItemClick }: Props) => {
...
@@ -48,7 +45,7 @@ const CodeEditorSearchSection = ({ data, onItemClick }: Props) => {
height=
"22px"
height=
"22px"
py=
"3px"
py=
"3px"
/>
/>
<
Icon
as=
{
icon
}
boxSize=
"16px"
mr=
"4px"
/>
<
CodeEditorFileIcon
mr=
"4px"
fileName=
{
fileName
}
/>
<
span
>
{
fileName
}
</
span
>
<
span
>
{
fileName
}
</
span
>
<
Box
className=
"monaco-count-badge"
ml=
"auto"
bgColor=
{
themeColors
[
'
badge.background
'
]
}
>
{
data
.
matches
.
length
}
</
Box
>
<
Box
className=
"monaco-count-badge"
ml=
"auto"
bgColor=
{
themeColors
[
'
badge.background
'
]
}
>
{
data
.
matches
.
length
}
</
Box
>
</
AccordionButton
>
</
AccordionButton
>
...
...
ui/shared/monaco/CodeEditorTab.tsx
View file @
be50eae3
import
{
Flex
,
Icon
,
chakra
,
Box
}
from
'
@chakra-ui/react
'
;
import
{
Flex
,
chakra
,
Box
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
{
alt
}
from
'
lib/html-entities
'
;
import
{
alt
}
from
'
lib/html-entities
'
;
import
useThemeColors
from
'
ui/shared/monaco/utils/useThemeColors
'
;
import
useThemeColors
from
'
ui/shared/monaco/utils/useThemeColors
'
;
import
iconFile
from
'
./icons/file.svg
'
;
import
CodeEditorFileIcon
from
'
./CodeEditorFileIcon
'
;
import
iconSolidity
from
'
./icons/solidity.svg
'
;
import
getFilePathParts
from
'
./utils/getFilePathParts
'
;
import
getFilePathParts
from
'
./utils/getFilePathParts
'
;
interface
Props
{
interface
Props
{
...
@@ -30,8 +29,6 @@ const CodeEditorTab = ({ isActive, path, onClick, onClose, isCloseDisabled, tabs
...
@@ -30,8 +29,6 @@ const CodeEditorTab = ({ isActive, path, onClick, onClose, isCloseDisabled, tabs
!
isCloseDisabled
&&
onClose
(
path
);
!
isCloseDisabled
&&
onClose
(
path
);
},
[
isCloseDisabled
,
onClose
,
path
]);
},
[
isCloseDisabled
,
onClose
,
path
]);
const
icon
=
/.sol|.yul|.vy$/
.
test
(
fileName
)
?
iconSolidity
:
iconFile
;
return
(
return
(
<
Flex
<
Flex
pl=
"10px"
pl=
"10px"
...
@@ -55,7 +52,7 @@ const CodeEditorTab = ({ isActive, path, onClick, onClose, isCloseDisabled, tabs
...
@@ -55,7 +52,7 @@ const CodeEditorTab = ({ isActive, path, onClick, onClose, isCloseDisabled, tabs
}
}
}
}
userSelect=
"none"
userSelect=
"none"
>
>
<
Icon
as=
{
icon
}
boxSize=
"16px"
mr=
"4px"
/>
<
CodeEditorFileIcon
mr=
"4px"
fileName=
{
fileName
}
/>
<
span
>
{
fileName
}
</
span
>
<
span
>
{
fileName
}
</
span
>
{
folderName
&&
<
chakra
.
span
fontSize=
"11px"
opacity=
{
0.8
}
ml=
{
1
}
>
{
folderName
[
0
]
===
'
.
'
?
''
:
'
...
'
}{
folderName
}
</
chakra
.
span
>
}
{
folderName
&&
<
chakra
.
span
fontSize=
"11px"
opacity=
{
0.8
}
ml=
{
1
}
>
{
folderName
[
0
]
===
'
.
'
?
''
:
'
...
'
}{
folderName
}
</
chakra
.
span
>
}
<
Box
<
Box
...
...
ui/shared/monaco/icons/vyper.svg
0 → 100644
View file @
be50eae3
<svg
xmlns=
"http://www.w3.org/2000/svg"
data-name=
"Transparent Logo"
viewBox=
"0 0 2048 1773.62"
>
<path
d=
"m1024 886.81-256 443.41 256 443.4 256-443.4-256-443.41z"
style=
"opacity:.8"
/>
<path
d=
"m1280 443.41-256 443.4 256 443.41 256-443.41-256-443.4zm-512 0-256 443.4 256 443.41 256-443.41-256-443.4z"
style=
"opacity:.6"
/>
<path
d=
"m1536 0-256 443.41 256 443.4 256-443.4L1536 0zm-384 221.7H896L768 443.41l256 443.4 256-443.4-128-221.71zM512 0 256 443.41l256 443.4 256-443.4L512 0z"
style=
"opacity:.45"
/>
<path
d=
"M1792 443.4 2048 0h-512l256 443.4zm-1536 0L512 0H0l256 443.4z"
style=
"opacity:.3"
/>
</svg>
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