import { WebApplication } from '@/ui_models/application'; import { SNComponent } from '@standardnotes/snjs'; import { Component } from 'preact'; import { findDOMNode, unmountComponentAtNode } from 'preact/compat'; interface Props { application: WebApplication; callback: (approved: boolean) => void; component: SNComponent; permissionsString: string; } export class PermissionsModal extends Component { getElement(): Element | null { return findDOMNode(this); } dismiss = () => { const elem = this.getElement(); if (!elem) { return; } const parent = elem.parentElement; if (!parent) { return; } parent.remove(); unmountComponentAtNode(parent); }; accept = () => { this.props.callback(true); this.dismiss(); }; deny = () => { this.props.callback(false); this.dismiss(); }; render() { return (
Activate Component
Cancel
{this.props.component.name} {' would like to interact with your '} {this.props.permissionsString}

Components use an offline messaging system to communicate. Learn more at{' '} https://standardnotes.com/permissions.

); } }