Skip to content

Commit 8efa5e6

Browse files
authored
Merge pull request #2383 from oasisprotocol/mz/labels
Migrate runtime events icons to Lucide
2 parents 9ef2add + d0a870f commit 8efa5e6

File tree

7 files changed

+142
-35
lines changed

7 files changed

+142
-35
lines changed

.changelog/2383.trivial.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Migrate runtime events icons to Lucide
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { FC } from 'react'
2+
import { Icon, IconNode } from 'lucide-react'
3+
4+
// From https://github.com/mui/material-ui/blob/4c336b8bd492749117a34947db44b0157a44c18b/packages/mui-icons-material/lib/esm/DeveloperBoard.js#L6
5+
const developerBoardNode: IconNode = [
6+
[
7+
'path',
8+
{
9+
d: 'M22 9V7h-2V5c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-2h2v-2h-2v-2h2v-2h-2V9zm-4 10H4V5h14zM6 13h5v4H6zm6-6h4v3h-4zM6 7h5v5H6zm6 4h4v6h-4z',
10+
fill: 'currentColor',
11+
stroke: 'none',
12+
},
13+
],
14+
]
15+
16+
export const DeveloperBoard: FC<{ className?: string; size?: number }> = ({ className, size = 24 }) => {
17+
return <Icon iconNode={developerBoardNode} size={size} className={className} />
18+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { FC } from 'react'
2+
import { Icon, IconNode } from 'lucide-react'
3+
4+
// From https://github.com/mui/material-ui/blob/4c336b8bd492749117a34947db44b0157a44c18b/packages/mui-icons-material/lib/esm/DeveloperBoardOff.js#L6
5+
const developerBoardOffNode: IconNode = [
6+
[
7+
'path',
8+
{
9+
d: 'M7.83 5H18v10.17L19.83 17H22v-2h-2v-2h2v-2h-2V9h2V7h-2V5c0-1.1-.9-2-2-2H5.83zM12 9.17V7h4v3h-3.17zM9.83 7H11v1.17zm4 4H16v2.17zM18 21c.06 0 .11 0 .16-.01l2.32 2.32 1.41-1.41L2.1 2.1.69 3.51l1.32 1.32C2 4.89 2 4.94 2 5v14c0 1.1.9 2 2 2zM4 19V6.83l2 2V12h3.17l1 1H6v4h5v-3.17l1 1V17h2.17l2 2z',
10+
fill: 'currentColor',
11+
stroke: 'none',
12+
},
13+
],
14+
]
15+
16+
export const DeveloperBoardOff: FC<{ className?: string; size?: number }> = ({ className, size = 24 }) => {
17+
return <Icon iconNode={developerBoardOffNode} size={size} className={className} />
18+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2014 Call-Em-All
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
import { FC } from 'react'
2+
import { Icon, IconNode } from 'lucide-react'
3+
4+
// From https://github.com/mui/material-ui/blob/4c336b8bd492749117a34947db44b0157a44c18b/packages/mui-icons-material/lib/esm/Stream.js#L5
5+
const streamNode: IconNode = [
6+
[
7+
'circle',
8+
{
9+
cx: '20',
10+
cy: '12',
11+
r: '2',
12+
fill: 'currentColor',
13+
stroke: 'none',
14+
},
15+
],
16+
[
17+
'circle',
18+
{
19+
cx: '4',
20+
cy: '12',
21+
r: '2',
22+
fill: 'currentColor',
23+
stroke: 'none',
24+
},
25+
],
26+
[
27+
'circle',
28+
{
29+
cx: '12',
30+
cy: '20',
31+
r: '2',
32+
fill: 'currentColor',
33+
stroke: 'none',
34+
},
35+
],
36+
[
37+
'path',
38+
{
39+
d: 'M10.05 8.59 6.03 4.55h-.01l-.31-.32-1.42 1.41 4.02 4.05.01-.01.31.32zm3.893.027 4.405-4.392L19.76 5.64l-4.405 4.393zM10.01 15.36l-1.42-1.41-4.03 4.01-.32.33 1.41 1.41 4.03-4.02zm9.75 2.94-3.99-4.01-.36-.35L14 15.35l3.99 4.01.35.35z',
40+
fill: 'currentColor',
41+
stroke: 'none',
42+
},
43+
],
44+
[
45+
'circle',
46+
{
47+
cx: '12',
48+
cy: '4',
49+
r: '2',
50+
fill: 'currentColor',
51+
stroke: 'none',
52+
},
53+
],
54+
]
55+
56+
export const Stream: FC<{ className?: string; size?: number }> = ({ className, size = 24 }) => {
57+
return <Icon iconNode={streamNode} size={size} className={className} />
58+
}

src/app/components/RuntimeEvents/RuntimeEventDetails.tsx

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,12 @@ import { exhaustedTypeWarning } from '../../../types/errors'
1818
import { LongDataDisplay } from '../LongDataDisplay'
1919
import { parseEvmEvent } from '../../utils/parseEvmEvent'
2020
import { TokenTransferIcon } from '../Tokens/TokenTransferIcon'
21-
import StreamIcon from '@mui/icons-material/Stream'
22-
import LocalFireDepartmentIcon from '@mui/icons-material/LocalFireDepartment'
21+
import { ArrowRight, ArrowUp, ArrowDown, Cpu, Flame, Network } from 'lucide-react'
22+
import { DeveloperBoard } from '../MuiIcons/DeveloperBoard'
23+
import { DeveloperBoardOff } from '../MuiIcons/DeveloperBoardOff'
24+
import { Stream } from '../MuiIcons/Stream'
2325
import { getPreciseNumberFormat } from '../../../locales/getPreciseNumberFormat'
2426
import { MaybeEventErrorLine } from './EventError'
25-
import ArrowDownwardIcon from '@mui/icons-material/ArrowDownward'
26-
import { ArrowRight } from 'lucide-react'
27-
import ArrowUpwardIcon from '@mui/icons-material/ArrowUpward'
28-
import MemoryIcon from '@mui/icons-material/Memory'
29-
import LanIcon from '@mui/icons-material/Lan'
30-
import LanOutlinedIcon from '@mui/icons-material/LanOutlined'
31-
import DeveloperBoard from '@mui/icons-material/DeveloperBoard'
32-
import DeveloperBoardOffIcon from '@mui/icons-material/DeveloperBoardOff'
3327
import { MethodIcon } from '../ConsensusTransactionMethod'
3428
import { TransactionLink } from '../Transactions/TransactionLink'
3529
import { Tooltip } from '@oasisprotocol/ui-library/src/components/tooltip'
@@ -111,32 +105,32 @@ export const EventTypeIcon: FC<{
111105
[RuntimeEventType.evmlog]: <></>,
112106
[RuntimeEventType.coregas_used]: <></>,
113107
[RuntimeEventType.consensus_accountswithdraw]: (
114-
<MethodIcon color="orange" icon={<ArrowUpwardIcon />} {...props} />
108+
<MethodIcon color="orange" icon={<ArrowUp />} {...props} />
115109
),
116110
[RuntimeEventType.consensus_accountsdeposit]: (
117-
<MethodIcon color="green" icon={<ArrowDownwardIcon />} {...props} />
111+
<MethodIcon color="green" icon={<ArrowDown />} {...props} />
118112
),
119-
[RuntimeEventType.consensus_accountsdelegate]: <MethodIcon icon={<LanIcon />} {...props} />,
120-
[RuntimeEventType.consensus_accountsundelegate_start]: (
121-
<MethodIcon icon={<LanOutlinedIcon />} {...props} />
113+
[RuntimeEventType.consensus_accountsdelegate]: (
114+
<MethodIcon icon={<Network className="[&_rect]:fill-current" />} {...props} />
122115
),
123-
[RuntimeEventType.consensus_accountsundelegate_done]: <MethodIcon icon={<LanIcon />} {...props} />,
124-
[RuntimeEventType.accountsmint]: <MethodIcon color="green" icon={<StreamIcon />} {...props} />,
125-
[RuntimeEventType.accountsburn]: (
126-
<MethodIcon color="orange" icon={<LocalFireDepartmentIcon />} {...props} />
116+
[RuntimeEventType.consensus_accountsundelegate_start]: <MethodIcon icon={<Network />} {...props} />,
117+
[RuntimeEventType.consensus_accountsundelegate_done]: (
118+
<MethodIcon icon={<Network className="[&_rect]:fill-current" />} {...props} />
127119
),
128-
[RuntimeEventType.roflapp_created]: <MethodIcon color="green" icon={<MemoryIcon />} {...props} />,
129-
[RuntimeEventType.roflapp_removed]: <MethodIcon color="orange" icon={<MemoryIcon />} {...props} />,
130-
[RuntimeEventType.roflapp_updated]: <MethodIcon color="green" icon={<MemoryIcon />} {...props} />,
131-
[RuntimeEventType.roflinstance_registered]: <MethodIcon color="green" icon={<MemoryIcon />} {...props} />,
120+
[RuntimeEventType.accountsmint]: <MethodIcon color="green" icon={<Stream />} {...props} />,
121+
[RuntimeEventType.accountsburn]: <MethodIcon color="orange" icon={<Flame />} {...props} />,
122+
[RuntimeEventType.roflapp_created]: <MethodIcon color="green" icon={<Cpu />} {...props} />,
123+
[RuntimeEventType.roflapp_removed]: <MethodIcon color="orange" icon={<Cpu />} {...props} />,
124+
[RuntimeEventType.roflapp_updated]: <MethodIcon color="green" icon={<Cpu />} {...props} />,
125+
[RuntimeEventType.roflinstance_registered]: <MethodIcon color="green" icon={<Cpu />} {...props} />,
132126
[RuntimeEventType.roflmarketprovider_created]: (
133127
<MethodIcon color="green" icon={<DeveloperBoard />} {...props} />
134128
),
135129
[RuntimeEventType.roflmarketprovider_updated]: (
136130
<MethodIcon color="green" icon={<DeveloperBoard />} {...props} />
137131
),
138132
[RuntimeEventType.roflmarketprovider_removed]: (
139-
<MethodIcon color="orange" icon={<DeveloperBoardOffIcon />} {...props} />
133+
<MethodIcon color="orange" icon={<DeveloperBoardOff />} {...props} />
140134
),
141135
[RuntimeEventType.roflmarketinstance_created]: (
142136
<MethodIcon color="green" icon={<DeveloperBoard />} {...props} />
@@ -146,10 +140,10 @@ export const EventTypeIcon: FC<{
146140
),
147141
[RuntimeEventType.roflmarketinstance_accepted]: <MethodIcon icon={<DeveloperBoard />} {...props} />,
148142
[RuntimeEventType.roflmarketinstance_cancelled]: (
149-
<MethodIcon color="orange" icon={<DeveloperBoardOffIcon />} {...props} />
143+
<MethodIcon color="orange" icon={<DeveloperBoardOff />} {...props} />
150144
),
151145
[RuntimeEventType.roflmarketinstance_removed]: (
152-
<MethodIcon color="orange" icon={<DeveloperBoardOffIcon />} {...props} />
146+
<MethodIcon color="orange" icon={<DeveloperBoardOff />} {...props} />
153147
),
154148
[RuntimeEventType.roflmarketinstance_command_queued]: <MethodIcon icon={<DeveloperBoard />} {...props} />,
155149
}

src/app/components/Tokens/TokenTransferIcon.tsx

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
import { FC } from 'react'
22
import { useTranslation } from 'react-i18next'
33
import { TFunction } from 'i18next'
4-
import StreamIcon from '@mui/icons-material/Stream'
5-
import LocalFireDepartmentIcon from '@mui/icons-material/LocalFireDepartment'
6-
import ApprovalIcon from '@mui/icons-material/Approval'
7-
import { ArrowRight } from 'lucide-react'
8-
import QuestionMarkIcon from '@mui/icons-material/QuestionMark'
4+
import { ArrowRight, Flame, CircleHelp, Stamp } from 'lucide-react'
95
import { MethodIcon } from '../ConsensusTransactionMethod'
6+
import { Stream } from '../MuiIcons/Stream'
107

118
const getTokenTransferLabel = (t: TFunction, name: string | undefined): string => {
129
switch (name) {
@@ -42,13 +39,13 @@ const getTokenTransferIcon = (
4239
case 'Transfer':
4340
return <MethodIcon color="green" icon={<ArrowRight />} {...props} />
4441
case 'Approval':
45-
return <MethodIcon color="green" icon={<ApprovalIcon />} {...props} />
42+
return <MethodIcon color="green" icon={<Stamp />} {...props} />
4643
case 'Minting':
47-
return <MethodIcon color="green" icon={<StreamIcon />} {...props} />
44+
return <MethodIcon color="green" icon={<Stream />} {...props} />
4845
case 'Burning':
49-
return <MethodIcon color="orange" icon={<LocalFireDepartmentIcon />} {...props} />
46+
return <MethodIcon color="orange" icon={<Flame />} {...props} />
5047
default:
51-
return <MethodIcon color="gray" icon={<QuestionMarkIcon />} {...props} />
48+
return <MethodIcon color="gray" icon={<CircleHelp />} {...props} />
5249
}
5350
}
5451

0 commit comments

Comments
 (0)