|
3 | 3 | * Copyright FINOS FDC3 contributors - see NOTICE file |
4 | 4 | */ |
5 | 5 |
|
6 | | -import React from "react"; |
7 | | -import { observer } from "mobx-react"; |
8 | | -import appChannelStore from "../../store/AppChannelStore"; |
9 | | -import { AccordionList, AccordionListItem } from "../common/AccordionList"; |
10 | | -import { TextField } from "@mui/material"; |
11 | | -import { ReceivedField } from "./ReceivedField"; |
| 6 | +import React from 'react'; |
| 7 | +import { observer } from 'mobx-react'; |
| 8 | +import appChannelStore from '../../store/AppChannelStore'; |
| 9 | +import { AccordionList, AccordionListItem } from '../common/AccordionList'; |
| 10 | +import { TextField } from '@mui/material'; |
| 11 | +import { ReceivedField } from './ReceivedField'; |
12 | 12 |
|
13 | 13 | const classes = { |
14 | | - textField: { |
15 | | - mt: 2, |
16 | | - width: "100%", |
17 | | - }, |
18 | | - input: { |
19 | | - fontSize: "14px", |
20 | | - }, |
| 14 | + textField: { |
| 15 | + mt: 2, |
| 16 | + width: '100%', |
| 17 | + }, |
| 18 | + input: { |
| 19 | + fontSize: '14px', |
| 20 | + }, |
21 | 21 | } as const; |
22 | 22 |
|
23 | 23 | export const AppChannelListeners = observer(() => { |
24 | | - let contextListeners: AccordionListItem[] = []; |
| 24 | + let contextListeners: AccordionListItem[] = []; |
25 | 25 |
|
26 | | - appChannelStore.channelListeners.forEach(({ id, channelId, type, lastReceivedContext, metaData }) => { |
27 | | - const receivedContextListenerValue = lastReceivedContext ? JSON.stringify(lastReceivedContext, undefined, 4) : ""; |
28 | | - const contextField = ( |
29 | | - <div> |
30 | | - <TextField |
31 | | - disabled |
32 | | - label={"LAST RECEIVED CONTEXT"} |
33 | | - sx={classes.textField} |
34 | | - InputLabelProps={{ |
35 | | - shrink: true, |
36 | | - }} |
37 | | - contentEditable={false} |
38 | | - fullWidth |
39 | | - multiline |
40 | | - variant="outlined" |
41 | | - size="small" |
42 | | - value={receivedContextListenerValue} |
43 | | - InputProps={{ |
44 | | - sx: classes.input, |
45 | | - }} |
46 | | - /> |
47 | | - {window.fdc3Version === "2.0" && <ReceivedField metaData={metaData} />} |
48 | | - </div> |
49 | | - ); |
| 26 | + appChannelStore.channelListeners.forEach(({ id, channelId, type, lastReceivedContext, metaData }) => { |
| 27 | + const receivedContextListenerValue = lastReceivedContext ? JSON.stringify(lastReceivedContext, undefined, 4) : ''; |
| 28 | + const contextField = ( |
| 29 | + <div> |
| 30 | + <TextField |
| 31 | + disabled |
| 32 | + label={'LAST RECEIVED CONTEXT'} |
| 33 | + sx={classes.textField} |
| 34 | + InputLabelProps={{ |
| 35 | + shrink: true, |
| 36 | + }} |
| 37 | + contentEditable={false} |
| 38 | + fullWidth |
| 39 | + multiline |
| 40 | + variant="outlined" |
| 41 | + size="small" |
| 42 | + value={receivedContextListenerValue} |
| 43 | + InputProps={{ |
| 44 | + sx: classes.input, |
| 45 | + }} |
| 46 | + /> |
| 47 | + {window.fdc3Version === '2.0' && <ReceivedField metaData={metaData} />} |
| 48 | + </div> |
| 49 | + ); |
50 | 50 |
|
51 | | - contextListeners.push({ id, textPrimary: `${channelId}: ${type}`, afterEachElement: contextField }); |
52 | | - }); |
| 51 | + contextListeners.push({ id, textPrimary: `${channelId}: ${type}`, afterEachElement: contextField }); |
| 52 | + }); |
53 | 53 |
|
54 | | - const handleDeleteListener = (id: string) => { |
55 | | - appChannelStore.removeContextListener(id); |
56 | | - }; |
| 54 | + const handleDeleteListener = (id: string) => { |
| 55 | + appChannelStore.removeContextListener(id); |
| 56 | + }; |
57 | 57 |
|
58 | | - return ( |
59 | | - <AccordionList |
60 | | - title="App Channels" |
61 | | - icon="Any context already in the channel will NOT be received automatically" |
62 | | - noItemsText="No App Channel Listeners" |
63 | | - listItems={contextListeners} |
64 | | - onDelete={handleDeleteListener} |
65 | | - /> |
66 | | - ); |
| 58 | + return ( |
| 59 | + <AccordionList |
| 60 | + title="App Channels" |
| 61 | + icon="Any context already in the channel will NOT be received automatically" |
| 62 | + noItemsText="No App Channel Listeners" |
| 63 | + listItems={contextListeners} |
| 64 | + onDelete={handleDeleteListener} |
| 65 | + /> |
| 66 | + ); |
67 | 67 | }); |
0 commit comments