Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple fixes #239

Merged
merged 15 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rsk-explorer",
"version": "2.1.0",
"version": "2.1.1",
"private": true,
"description": "Rsk explorer client",
"author": "emi <emiliorizzo@gmail.com>",
Expand Down
145 changes: 87 additions & 58 deletions src/components/EventCall.vue
Original file line number Diff line number Diff line change
@@ -1,23 +1,31 @@
<template>
<div class="event-call" v-if="data">
<ul class="event">
<li class="event-name">{{ name }}
<template v-if="inputs">
<ul class="args" v-for="(arg, i) in inputs" :key="i">
<li class="type" :key="`1-${i}`" :style="{ color: PAGE_COLORS[$route.name].cl }">{{ arg.type }}</li>
<li class="index" v-if="arg.indexed">indexed</li>
<li class="name">{{ arg.name }}</li>
</ul>
</template>
</li>
</ul>
<div class="event-details-container">
<div class="event-details white-100" v-if="data">
<span>{{ name }}{{ space }}</span>
<span class="event-args">
<span>{{ openingParen }}</span>
<span class="event-arg" v-for="(arg, i) in inputs" :key="i">
<span class="orange-900">{{ arg.type }}{{ space }}</span>
<span class="white-400" v-if="arg.indexed">{{ indexed }}{{ space }}</span>
<span>{{ arg.name }}</span>
<span class="white-400" v-if="addComma(i, inputs)">{{ comma }}{{ space }}</span>
</span>
<span>{{ closingParen }}</span>
</span>
</div>
<copy-button :value="eventSignature" title="Copy event signature" css=""/>
</div>
</template>
<script>
import { PAGE_COLORS } from '../config/pageColors'
import CopyButton from './controls/CopyButton'

export default {
name: 'event-call',
props: ['data'],
components: {
CopyButton
},
data () {
return {
PAGE_COLORS
Expand All @@ -29,62 +37,83 @@ export default {
},
inputs () {
return this.data.inputs
},
eventSignature () {
const { name, inputs, space, indexed } = this
const eventName = `${name}`

const eventParams = inputs.map(input => {
const inputType = input.type
const inputName = input.name

let formattedInputLine
if (input.indexed) {
formattedInputLine = `${inputType}${space}${indexed}${space}${inputName}`
} else {
formattedInputLine = `${inputType}${space}${inputName}`
}
return formattedInputLine
})

return `${eventName} (${eventParams.join(', ').trim()})`
},
openingParen () {
return '\u0028'
},
closingParen () {
return '\u0029'
},
comma () {
return '\u002C'
},
space () {
return ' '
},
indexed () {
return 'indexed'
}
},
methods: {
addComma (index, list) {
return index < list.length - 1
}
}
}
</script>
<style lang="stylus">

.event-call
margin 0
display flex
.index
font-size .8em

li.event-name
font-weight bold
color $info
<style lang="scss" scoped>
@import '@/styles/variables.scss';

ul
raw()
font-size .9em
list-style none
align-items flex-end
font-style italic
font-weight normal
margin 0
padding 0
flex-flow row wrap
li
color white

ul,li
margin 0 0.25em 0 0
display flex
.event-details-container {
flex: 5;
text-transform: none;
display: flex;
gap: 20px;
justify-content: start;
align-items: center;
}

&:last-child:after
font-weight bold
.event-details {
display: inline;

.args
&::before
content '('
}

&::after
content ')'
.event-args {
display: inline;
}

.type
color white
&:after
content ''
.event-arg {
display: inline;
}

.name
font-size 0.9em
// color green
.white-400 {
color: $white_400;
}

&:after
content ','
font-size 1em
.white-100 {
color: $white_100;
}

&:last-child:after
content none
.orange-900 {
color: $orange_900;
}
</style>
13 changes: 12 additions & 1 deletion src/components/controls/CopyButton.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div class="copy-button">
<textarea v-if="value" :ref="refName" class="hidden-ctrl" v-model="value"></textarea>
<burp-button :icon="iconName" :message="message || 'copied!'" :title="title" :text="text" @click="copy" :class="css">
<burp-button :icon="iconName" :message="message || 'copied!'" :title="title" :text="text" @click="copy" :class="css || defaultStyle">
<slot></slot>
</burp-button>
</div>
Expand Down Expand Up @@ -29,6 +29,9 @@ export default {
targetNode () {
const { refName, target } = this
return (target) || this.$refs[refName]
},
defaultStyle () {
return 'white-400'
}
},
methods: {
Expand All @@ -39,3 +42,11 @@ export default {
}
}
</script>

<style lang="scss" scoped>
@import '@/styles/variables.scss';

.white-400 {
color: $white_400;
}
</style>
18 changes: 18 additions & 0 deletions src/styles/_page.scss
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,27 @@
flex: 1 1 100%;
padding: 12px;
gap: 20px;
box-shadow: 0px -1px 0px 0px #3A3A3A inset;
.field-title.big-field, .field-title.BigField, .field-title.event-call {
flex: 1;
}
.big-field:nth-child(2) {
flex-direction: column-reverse;
.decode {
margin-left: unset;
margin-bottom: 10px;
}
textarea {
background-color: #1d1d1d;
padding: 12px;
border-radius: 12px;
overflow-x: auto;
min-height: 45px;
height: min-content;
margin: unset;
resize: none;
}
}
.big-field, .event-call {
flex: 5;
textarea {
Expand Down
Loading