feat(plugins/developer-settings/devtools): use generated IconComponent for toasts
This commit is contained in:
parent
c0babbd486
commit
177988dd8e
1 changed files with 6 additions and 2 deletions
|
|
@ -1,9 +1,9 @@
|
|||
import { getAssetByName, getAssetId } from '@revenge-mod/assets'
|
||||
import { ToastActionCreators } from '@revenge-mod/discord/actions'
|
||||
import { React } from '@revenge-mod/react'
|
||||
import { getErrorStack } from '@revenge-mod/utils/errors'
|
||||
import { useReRender } from '@revenge-mod/utils/react'
|
||||
import { pluginApi } from '.'
|
||||
import { lookupGeneratedIconComponent } from '@revenge-mod/utils/discord'
|
||||
|
||||
export const DevToolsContext: {
|
||||
ws: WebSocket | undefined
|
||||
|
|
@ -20,15 +20,19 @@ export const DevToolsContext: {
|
|||
type Subscription = (event: 1 | 2 | 3, err?: unknown) => void
|
||||
const subscriptions: Set<Subscription> = new Set()
|
||||
|
||||
const CircleXIcon = lookupGeneratedIconComponent('CircleXIcon', 'CircleXIcon-secondary', 'CircleXIcon-primary')
|
||||
|
||||
subscriptions.add((e, err) => {
|
||||
if (e === 3) {
|
||||
const actualError = (err as { message: string }).message ?? getErrorStack(err)
|
||||
|
||||
pluginApi.logger.error('React DevTools error:', actualError)
|
||||
|
||||
pluginApi.logger.log(CircleXIcon)
|
||||
|
||||
ToastActionCreators.open({
|
||||
key: 'DEVTOOLS_ERROR',
|
||||
icon: getAssetId(getAssetByName('CircleXIcon-primary')!)!,
|
||||
IconComponent: CircleXIcon,
|
||||
content: actualError,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue