diff --git a/packages/web-console/src/scenes/News/index.tsx b/packages/web-console/src/scenes/News/index.tsx index 4d062867f..150112432 100644 --- a/packages/web-console/src/scenes/News/index.tsx +++ b/packages/web-console/src/scenes/News/index.tsx @@ -7,11 +7,18 @@ import { NewsItem } from "../../utils/questdb" import { useSelector } from "react-redux" import { selectors } from "../../store" import ReactMarkdown from "react-markdown" +import { Loader } from "@questdb/react-components" + +const Loading = styled.div` + display: grid; + grid-auto-flow: column; + gap: 1rem; + justify-self: center; + margin-top: 2rem; +` const Items = styled.div` display: grid; - grid-auto-rows: max-content; - gap: 4rem; width: 100%; justify-items: center; overflow: auto; @@ -21,6 +28,10 @@ const Item = styled.div` display: grid; gap: 1rem; padding: 2rem; + + &:not(:last-child) { + border-bottom: 1px solid ${({ theme }) => theme.color.backgroundLighter}; + } ` const Title = styled.h2` @@ -50,7 +61,9 @@ const Thumbnail = styled.img` const News = () => { const { quest } = useContext(QuestContext) const telemetryConfig = useSelector(selectors.telemetry.getConfig) - const [enterpriseNews, setEnterpriseNews] = useState([]) + const [enterpriseNews, setEnterpriseNews] = useState( + undefined, + ) useEffect(() => { void quest @@ -62,39 +75,46 @@ const News = () => { return ( - {enterpriseNews.map((newsItem, index) => ( - - {newsItem.title} - {newsItem.date} - {newsItem.thumbnail && - newsItem.thumbnail.length > 0 && - newsItem.thumbnail[0].thumbnails.large && ( - - )} + {enterpriseNews === undefined && ( + + Loading news... + + + )} + {enterpriseNews && + enterpriseNews.map((newsItem, index) => ( + + {newsItem.title} + {newsItem.date} + {newsItem.thumbnail && + newsItem.thumbnail.length > 0 && + newsItem.thumbnail[0].thumbnails.large && ( + + )} - - ( - - {children} - - ), - }} - > - {newsItem.body} - - - - ))} + + ( + + {children} + + ), + }} + > + {newsItem.body} + + + + ))} ) }