-
Notifications
You must be signed in to change notification settings - Fork 308
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
02d7f21
commit e5c7dc6
Showing
19 changed files
with
276 additions
and
177 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import React from 'react' | ||
import { PluginUI, PluginConfig } from '../../plugins/plugin' | ||
|
||
export interface PageInspectorProps {} | ||
|
||
export function PageInspector(props: PageInspectorProps) { | ||
return ( | ||
<> | ||
{[...PluginUI.values()].map((x) => ( | ||
<PluginPageInspectorForEach key={x.identifier} config={x} /> | ||
))} | ||
</> | ||
) | ||
} | ||
|
||
function PluginPageInspectorForEach({ config }: { config: PluginConfig }) { | ||
const F = config.pageInspector | ||
if (typeof F === 'function') return <F /> | ||
return null | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export interface TradeDialogProps {} | ||
|
||
export function TradeDialog(props: TradeDialogProps) { | ||
return null | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import React, { useState, useEffect } from 'react' | ||
import { Popper, ClickAwayListener, PopperProps } from '@material-ui/core' | ||
import { MessageCenter, ObserveCashTagEvent } from '../messages' | ||
|
||
export interface TrendingPopperProps { | ||
children?: (name: string) => React.ReactNode | ||
PopperProps?: Partial<PopperProps> | ||
} | ||
|
||
export function TrendingPopper(props: TrendingPopperProps) { | ||
const [name, setName] = useState('') | ||
const [anchorEl, setAnchorEl] = useState<HTMLElement | null>(null) | ||
|
||
useEffect(() => { | ||
const off = MessageCenter.on('cashTagObserved', (ev: ObserveCashTagEvent) => { | ||
setName(ev.name) | ||
setAnchorEl(ev.element) | ||
}) | ||
return () => { | ||
off() | ||
setAnchorEl(null) | ||
} | ||
}, []) | ||
|
||
if (!anchorEl) return null | ||
return ( | ||
<ClickAwayListener onClickAway={() => setAnchorEl(null)}> | ||
<Popper | ||
open={true} | ||
anchorEl={anchorEl} | ||
disablePortal | ||
transition | ||
style={{ zIndex: 1 }} | ||
{...props.PopperProps}> | ||
{props.children?.(name)} | ||
</Popper> | ||
</ClickAwayListener> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.