2024-07-14 15:21:44 +02:00
|
|
|
import React from "react";
|
|
|
|
import {Subapp, useSubapp} from "../src/Components/Subapps/Subapps";
|
|
|
|
import {Card} from "../src/Components/Card";
|
2024-09-29 10:10:14 +02:00
|
|
|
import {useKernelContext} from "../src/KernelGlobalContext";
|
|
|
|
import {KernelContext} from "./DemoKernelContext";
|
2024-07-14 15:21:44 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* A demo Subapp component.
|
|
|
|
*/
|
|
|
|
export function DemoSubapp()
|
|
|
|
{
|
|
|
|
// Get subapp close function.
|
|
|
|
const {uuid, close} = useSubapp();
|
|
|
|
|
2024-09-29 10:10:14 +02:00
|
|
|
// Get kernel context data.
|
|
|
|
const [kernelContext] = useKernelContext(KernelContext);
|
2024-09-29 00:10:21 +02:00
|
|
|
|
2024-07-14 15:21:44 +02:00
|
|
|
return (
|
|
|
|
<Subapp title={"My complex subapp"}>
|
|
|
|
<Card>
|
|
|
|
<p>This is a complex subapp.</p>
|
|
|
|
|
|
|
|
<p>UUID : <code>{uuid}</code></p>
|
|
|
|
|
2024-09-29 10:10:14 +02:00
|
|
|
{kernelContext && <p><strong>Kernel context data</strong>: <code>{kernelContext}</code></p>}
|
2024-09-29 00:10:21 +02:00
|
|
|
|
2024-07-14 15:21:44 +02:00
|
|
|
<button onClick={close}>Close the subapp</button>
|
|
|
|
</Card>
|
|
|
|
</Subapp>
|
|
|
|
);
|
|
|
|
}
|