mirror of
https://github.com/matrix-org/matrix-hookshot.git
synced 2025-03-10 21:19:13 +00:00

* Refactor HookFilter to only support enabledEvents (and add a function to convert) * Convert connections to deprecate ignoreHooks * Update documentation * Split out EventHookCheckbox * Refactor frontend to support enableHooks only mode * drop old field name * changelog * Fix enabledHooks for widgets * Fixes across the board * Update test description * Cleanup * Fix HookFilter * Fixup checkboxes * Cleanup
22 lines
720 B
TypeScript
22 lines
720 B
TypeScript
import { FunctionComponent } from "preact";
|
|
import { JSXInternal } from "preact/src/jsx";
|
|
|
|
export const EventHookCheckbox: FunctionComponent<{
|
|
enabledHooks: string[],
|
|
onChange: JSXInternal.GenericEventHandler<HTMLInputElement>,
|
|
hookEventName: string,
|
|
parentEvent?: string,
|
|
}> = ({enabledHooks, onChange, hookEventName, parentEvent, children}) => {
|
|
const checked = enabledHooks.includes(hookEventName) || (!!parentEvent && enabledHooks.includes(parentEvent));
|
|
|
|
return <li>
|
|
<label>
|
|
<input
|
|
type="checkbox"
|
|
x-event-name={hookEventName}
|
|
checked={checked}
|
|
onChange={onChange} />
|
|
{ children }
|
|
</label>
|
|
</li>;
|
|
}; |