Skip to content

Commit

Permalink
Merge pull request #246 from rsksmart/staging
Browse files Browse the repository at this point in the history
Merge staging into develop
  • Loading branch information
ezequiel-rodriguez authored Nov 27, 2024
2 parents 4f3987c + 200f67c commit 8f87395
Show file tree
Hide file tree
Showing 8 changed files with 90 additions and 34 deletions.
Binary file added src/assets/icons/remix.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/assets/svg/link.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 13 additions & 26 deletions src/components/ContractCode.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<h3 class="subtitle">Contract Source</h3>

<!-- Source -->
<ctrl-big-text v-if="source" :value="source.contents" :fileName="source.name" fileType="sol" :title="source.name">
<ctrl-big-text v-if="source" :value="source.contents" :fileName="source.name" fileType="sol" :title="source.name" :remixLink="remixLink">
<source-code language="solidity" :code="source.contents"></source-code>
</ctrl-big-text>

Expand Down Expand Up @@ -144,6 +144,16 @@ export default {
const result = this.result || {}
const { constructorArguments: decoded, encodedConstructorArguments: encoded } = result
return (encoded || decoded) ? { encoded, decoded } : undefined
},
remixLink () {
const address = this.data.address
// backend url format: without protocol and trailing slash
// const backend = process.env.WS_URL // Staging behind VPN -> Remix cannot reach it
const backend = 'mock-backend.netlify.app/.netlify/functions/index' // TODO: Update with the correct backend once QA is done
const link = `https://remix.ethereum.org/?address=${address}&blockscout=${backend}`
return link
}
},
methods: {
Expand All @@ -159,28 +169,5 @@ export default {
}
}
</script>
// <style lang="stylus">
// .contract-details
// .verify
// display block
// margin 1em
// width 100%
// text-align right
// .files
// display flex
// flex-flow row wrap
// position relative
// min-width 100%
// width 100%
// justify-content flex-start
// button
// margin 0 0.5em
// .selected-file-enter-active, .selected-file-leave-active
// transition opacity 0.2s ease-in
// .selected-file-enter, .selected-file-leave-to
// opacity 0
// </style>
<style>
</style>
44 changes: 44 additions & 0 deletions src/components/RemixLink.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<template>
<a v-if="remixLink" :href="remixLink" target="_blank" class="remix-link">
<img src="@/assets/icons/remix.png" height="16px" width="16px" alt="Remix Icon" class="remix-icon" />
Open in Remix
<img src="@/assets/svg/link.svg" height="12px" alt="link icon">
</a>
</template>

<script>
export default {
name: 'RemixLink',
props: {
remixLink: {
type: String,
required: true
}
}
}
</script>

<style lang="scss" scoped>
@import '@/styles/variables.scss';
.remix-link {
padding: 8px 10px;
font-size: 12px;
border-radius: 10px;
background-color: none;
color: $white_100;
border: 2px solid $white_400;
transition: background-color 0.3s ease, border 0.3s ease;
text-decoration: none;
text-align: center;
display: flex;
align-items: center;
gap: 6px;
margin-left: 6px;
margin-right: 3px;
&:hover {
border: 2px solid $white_100;
}
}
</style>
18 changes: 14 additions & 4 deletions src/components/Search/CtrlSearch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
<a
:href="result.link"
@touchend.passive="gotoResult($event, i)"
@click="gotoResult($event, i)">
@click="gotoResult($event, i)"
>
{{ result.name || result.value }}
</a>
</div>
Expand Down Expand Up @@ -92,7 +93,7 @@ export default {
'fetchSearch'
]),
formatValue (value) {
return value.toString().replaceAll(',', '')
return value.toString().replaceAll(',', '').trim()
},
btnClear () {
this.clear()
Expand Down Expand Up @@ -121,8 +122,8 @@ export default {
this.selectResult(0)
const value = event.target.value
this.value = value
this.emit(event, type, value)
this.emit(event, 'change', value)
this.emit(event, type, value.trim())
this.emit(event, 'change', value.trim())
},
emit (event, type, value) {
type = type || event.type
Expand Down Expand Up @@ -230,3 +231,12 @@ export default {
}
}
</script>
<style>
.highlight {
background-color: #ffef60;
color: #000;
border-radius: 4px;
font-weight: bold;
}
</style>
2 changes: 1 addition & 1 deletion src/components/Search/SearchBox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export default {
},
onInput ({ event, value }) {
this.clearRequests()
if (!value || value.length < 2) return
if (!value) return
this.setValue(value)
this.fetchSearch({ value })
},
Expand Down
10 changes: 9 additions & 1 deletion src/components/controls/CtrlBigText.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,22 @@
strong.subtitle {{title}}
copy-button.button(v-bind='{value,css,title:copyTitle}')
download-button.button(v-if='fileType' v-bind='{fileName,fileType,value,css, title:downloadTitle}')
remix-link(v-if='remixLink' :remixLink='remixLink')
.big-text(:style='style')
slot
.content(v-if='!hasSlots') {{value}}
</template>
<script>
import CopyButton from './CopyButton'
import DownloadButton from './DownloadButton'
import RemixLink from '../RemixLink.vue'
export default {
name: 'ctrl-big-text',
components: {
CopyButton,
DownloadButton
DownloadButton,
RemixLink
},
props: {
value: {
Expand All @@ -29,6 +33,10 @@ export default {
height: {
type: String,
default: '20em'
},
remixLink: {
type: String,
default: null
}
},
computed: {
Expand Down
8 changes: 6 additions & 2 deletions src/store/modules/search/payloads.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,12 @@ export const createPayloads = (payloads) => {
}

const getAddressName = data => {
const { address, name } = data
return `${name} ${address}`
const { address, symbol, name } = data
const validSymbol = typeof symbol === 'string' && symbol !== ''

if (validSymbol) return `(${symbol}) ${name}: ${address}`

return `${name}: ${address}`
}

const getAddressTime = data => {
Expand Down

0 comments on commit 8f87395

Please sign in to comment.