Skip to content

Commit

Permalink
Add support for hidden layers in Layer selector
Browse files Browse the repository at this point in the history
  • Loading branch information
csillag committed Feb 11, 2024
1 parent d45cb6b commit 80c15a3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/app/components/LayerPicker/LayerMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ export const LayerMenu: FC<LayerMenuProps> = ({
}) => {
const [hoveredLayer, setHoveredLayer] = useState<undefined | Layer>()
const options = Object.values(Layer)
.filter(layer => !isLayerHidden(layer))
.map(layer => ({
layer,
enabled: RouteUtils.getEnabledLayersForNetwork(selectedNetwork || network).includes(layer),
Expand Down
4 changes: 4 additions & 0 deletions src/types/layers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ const layerOrder: Record<Layer, number> = {
[Layer.cipher]: 4,
}

const hiddenLayers: Layer[] = []

export const orderByLayer = (itemA: HasLayer, itemB: HasLayer): number =>
layerOrder[itemA.layer] - layerOrder[itemB.layer]

Expand All @@ -36,3 +38,5 @@ export const doesLayerSupportEncryptedTransactions = (layer: Layer): boolean =>

export const doesAnyOfTheseLayersSupportEncryptedTransactions = (layers: Layer[] | undefined): boolean =>
uniq(layers).some(doesLayerSupportEncryptedTransactions)

export const isLayerHidden = (layer: Layer): boolean => hiddenLayers.includes(layer)

0 comments on commit 80c15a3

Please sign in to comment.