aboutsummaryrefslogtreecommitdiff
path: root/users/ryan/modules/simple-bar/simple-bar-source/lib/components/missives/missives.jsx
diff options
context:
space:
mode:
authorRyan Schanzenbacher <ryan@rschanz.org>2026-07-09 22:15:53 -0400
committerRyan Schanzenbacher <ryan@rschanz.org>2026-07-09 22:15:53 -0400
commitd06784958d73159b5e4abafe5114804662114ed7 (patch)
treed8464262c1aa1f10553a5b11a9fda3e505e71f7f /users/ryan/modules/simple-bar/simple-bar-source/lib/components/missives/missives.jsx
parent1a71e94eb8ca1585201263cf654611ef6849d359 (diff)
move ubersicht modules in tree
Diffstat (limited to 'users/ryan/modules/simple-bar/simple-bar-source/lib/components/missives/missives.jsx')
-rwxr-xr-xusers/ryan/modules/simple-bar/simple-bar-source/lib/components/missives/missives.jsx40
1 files changed, 40 insertions, 0 deletions
diff --git a/users/ryan/modules/simple-bar/simple-bar-source/lib/components/missives/missives.jsx b/users/ryan/modules/simple-bar/simple-bar-source/lib/components/missives/missives.jsx
new file mode 100755
index 0000000..3563937
--- /dev/null
+++ b/users/ryan/modules/simple-bar/simple-bar-source/lib/components/missives/missives.jsx
@@ -0,0 +1,40 @@
1import * as Uebersicht from "uebersicht";
2import { useSimpleBarContext } from "../simple-bar-context.jsx";
3import Missive from "./missive.jsx";
4import useServerSocket from "../../hooks/use-server-socket.js";
5
6export { missivesStyles as styles } from "../../styles/components/missives";
7
8const { React } = Uebersicht;
9
10/**
11 * Component to display a list of missives.
12 * It uses the simple-bar context to get settings and missives data.
13 * It also sets up a server socket to receive new missives.
14 *
15 * @returns {JSX.Element} The rendered component.
16 */
17export function Component() {
18 // Destructure settings, missives, and pushMissive function from the context
19 const { settings, missives, pushMissive } = useSimpleBarContext();
20 const { enableServer } = settings.global;
21
22 // Set up a server socket to listen for "missive" events and push new missives
23 useServerSocket("missive", enableServer, pushMissive);
24
25 return (
26 <div className="missives">
27 {missives.map(({ id, side, content, timeout }) => {
28 return (
29 <Missive
30 key={id}
31 id={id}
32 side={side}
33 content={content}
34 timeout={timeout}
35 />
36 );
37 })}
38 </div>
39 );
40}