From eb56c85edba4e3d2d1b22ff0c5ab1a38bfdc0cd4 Mon Sep 17 00:00:00 2001 From: Toby Brown Date: Fri, 16 Feb 2024 17:40:40 +0100 Subject: [PATCH] channels in flex container --- components/slack/slack-events.js | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/components/slack/slack-events.js b/components/slack/slack-events.js index 207289a0..9d811ccd 100644 --- a/components/slack/slack-events.js +++ b/components/slack/slack-events.js @@ -1,7 +1,8 @@ import { sample, take } from 'lodash' import React, { useEffect, useMemo, useRef, useState } from 'react' +import { Slide } from 'react-reveal' import useWebSocket from 'react-use-websocket' -import { Box, Grid, Text } from 'theme-ui' +import { Box, Text } from 'theme-ui' const colors = ['red', 'orange', 'yellow', 'green', 'cyan', 'blue', '#8067c3'] @@ -33,7 +34,7 @@ const SlackEvents = ({ sx, color, textColor, ...props }) => { 'wss://joebunyan.haas.hackclub.com/stream', STATIC_OPTIONS ) - + useEffect(() => { try { async function resolveEvent() { @@ -52,7 +53,7 @@ const SlackEvents = ({ sx, color, textColor, ...props }) => { .catch(err => console.error(err)) if (whitelistedChannels.has(name)) { - // this check should happen before the web req, to save on net resources + //this check should happen before the web req, to save on net resources setEvents(prev => [ { type: lastJsonMessage.type, @@ -77,27 +78,30 @@ const SlackEvents = ({ sx, color, textColor, ...props }) => { }) return ( - - `linear-gradient(to left,rgba(255,255,255,0), ${ + `linear-gradient(rgba(255,255,255,0), ${ color || theme.colors.white })` }, @@ -108,20 +112,18 @@ const SlackEvents = ({ sx, color, textColor, ...props }) => { aria-hidden="true" {...props} > - {take(events, 7).map(({ type, channel, color }) => ( + <> {type === 'message' && ( - - - + <> + Message in + )} + ))} - - - - + ) }