fix unpin provider

pull/5003/head
yann300 5 months ago committed by Aniket
parent d38eb904b9
commit 0a69fd75a2
  1. 18
      apps/remix-ide/src/app/providers/environment-explorer.tsx
  2. 4
      libs/remix-ui/grid-view/src/lib/remix-ui-grid-cell.tsx

@ -109,9 +109,13 @@ export class EnvironmentExplorer extends ViewPlugin {
pinned={this.pinnedProviders.includes(provider.name)}
pinStateCallback={async (pinned: boolean) => {
if (pinned) {
this.emit('providerPinned', provider.name, provider)
return true
}
const providerName = await this.call('blockchain', 'getProvider')
if (providerName !== provider.name) {
this.emit(pinned ? 'providerPinned' : 'providerUnpinned', provider.name, provider)
this.emit('providerUnpinned', provider.name, provider)
return true
} else {
this.call('notification', 'toast', 'Cannot unpin the current selected provider')
@ -133,9 +137,13 @@ export class EnvironmentExplorer extends ViewPlugin {
title={provider.name}
pinned={this.pinnedProviders.includes(provider.name)}
pinStateCallback={async (pinned: boolean) => {
if (pinned) {
this.emit('providerPinned', provider.name, provider)
return true
}
const providerName = await this.call('blockchain', 'getProvider')
if (providerName !== provider.name) {
this.emit(pinned ? 'providerPinned' : 'providerUnpinned', provider.name, provider)
this.emit('providerUnpinned', provider.name, provider)
return true
} else {
this.call('notification', 'toast', 'Cannot unpin the current selected provider')
@ -156,9 +164,13 @@ export class EnvironmentExplorer extends ViewPlugin {
title={provider.name}
pinned={this.pinnedProviders.includes(provider.name)}
pinStateCallback={async (pinned: boolean) => {
if (pinned) {
this.emit('providerPinned', provider.name, provider)
return true
}
const providerName = await this.call('blockchain', 'getProvider')
if (providerName !== provider.name) {
this.emit(pinned ? 'providerPinned' : 'providerUnpinned', provider.name, provider)
this.emit('providerUnpinned', provider.name, provider)
return true
} else {
this.call('notification', 'toast', 'Cannot unpin the current selected provider')

@ -78,8 +78,8 @@ export const RemixUIGridCell = (props: RemixUIGridCellProps) => {
{ filterCon.showPin && <button
className={`${pinned ? 'fa-duotone' : 'fa-light'}` + ` fa-map-pin text-info border-0 mb-0 remixui_grid_cell_pin`}
onClick={() => {
setPinned(!pinned)
props.pinStateCallback()
if (!props.pinStateCallback) setPinned(!pinned)
if (await props.pinStateCallback(!pinned)) setPinned(!pinned)
}}
></button>}
{ props.tagList && <div className={`d-flex flex-column align-items-begin ` +`${filterCon.showPin ? 'remixui_grid_cell_tags' : 'remixui_grid_cell_tags_no_pin'}`}>

Loading…
Cancel
Save