MCPcopy Index your code
hub / github.com/Linen-dev/linen.dev / MatrixView

Function MatrixView

apps/web/ui/MatrixView/index.tsx:16–157  ·  view source on GitHub ↗
({
  currentCommunity,
  api,
}: {
  currentCommunity: SerializedAccount;
  api: ApiClient;
})

Source from the content-addressed store, hash-verified

14import ConfirmationModal from '@/ConfirmationModal';
15
16export default function MatrixView({
17 currentCommunity,
18 api,
19}: {
20 currentCommunity: SerializedAccount;
21 api: ApiClient;
22}) {
23 const [modal, setModal] = useState(false);
24 const [{ value: keys }, callback] = useAsyncFn(() =>
25 api.getIntegrationMatrix({ accountId: currentCommunity.id })
26 );
27
28 useEffect(() => {
29 callback();
30 }, []);
31
32 return (
33 <div className={styles.container}>
34 <StickyHeader className={styles.header}>
35 <div className={styles.title}>Matrix integration</div>
36 </StickyHeader>
37
38 <div className={styles.content}>
39 {!keys ? (
40 <div className={styles.italic}>Loading...</div>
41 ) : keys?.length ? (
42 <table className={styles.table}>
43 <tr className={styles.tr}>
44 <th>Server</th>
45 <th>Enabled</th>
46 <th>Created</th>
47 <th>Updated</th>
48 <th></th>
49 </tr>
50 <tbody className={styles.tbody}>
51 {keys.map((k) => {
52 return (
53 <tr key={k.id}>
54 <td>{k.matrixUrl}</td>
55 <td>
56 <div className={styles.toggle}>
57 <Toggle
58 checked={k.enabled}
59 onChange={async (val) => {
60 try {
61 await api.updateIntegrationMatrix({
62 accountId: currentCommunity.id,
63 enabled: val,
64 id: k.id,
65 });
66 await callback();
67 } catch (error) {
68 handleError(error);
69 }
70 }}
71 />
72 </div>
73 </td>

Callers

nothing calls this directly

Calls 5

formatFunction · 0.90
useAsyncFnFunction · 0.85
handleErrorFunction · 0.85
mapMethod · 0.80
callbackFunction · 0.50

Tested by

no test coverage detected