import React, { useEffect, useState } from 'react'; import logo from './logo.svg'; import './App.css'; import { Box, CssBaseline, IconButton, SxProps, Theme } from '@mui/material'; import { BrowserRouter, Routes, Route } from 'react-router-dom'; import Footer from './app/features/footer'; import LaunchPage from './app/page/LaunchPage'; import { useWsSubscription } from './app/ws/subscriptions'; import { useDispatch } from 'react-redux'; import { useStompClient, useSubscription } from 'react-stomp-hooks'; import { updateItems } from './app/store/composed-slice'; import ExplorePage from './app/page/ExplorePage'; import { ThemeProvider } from '@mui/material'; import theme from './theme'; import { EventDataObject, SimpleEventDataObject } from './types'; import EventsChainPage from './app/page/EventsChainPage'; import UnprocessedFilesPage from './app/page/UnprocessedFilesPage'; import AccountTreeIcon from '@mui/icons-material/AccountTree'; import FolderIcon from '@mui/icons-material/Folder'; import QueueIcon from '@mui/icons-material/Queue'; import AppsIcon from '@mui/icons-material/Apps'; import ConstructionIcon from '@mui/icons-material/Construction'; import DashboardIcon from '@mui/icons-material/Dashboard'; import GraphicEqIcon from '@mui/icons-material/GraphicEq'; import HomeRepairServiceIcon from '@mui/icons-material/HomeRepairService'; import InboxIcon from '@mui/icons-material/Inbox'; import InputIcon from '@mui/icons-material/Input'; import NotStartedIcon from '@mui/icons-material/NotStarted'; import EventsPage from './app/page/EventsPage'; import TableChartIcon from '@mui/icons-material/TableChart'; function App() { const client = useStompClient(); const dispatch = useDispatch(); useWsSubscription>("/topic/event/items", (response) => { dispatch(updateItems(response)) }); useEffect(() => { // Kjør din funksjon her når komponenten lastes inn for første gang // Sjekk om cursor er null // Kjør din funksjon her når cursor er null og client ikke er null client?.publish({ destination: "/app/items", body: undefined }) // Alternativt, du kan dispatche en Redux handling her // dispatch(fetchDataAction()); // Eksempel på å dispatche en handling }, [client, dispatch]); const iconHeight: SxProps = { height: 50, width: 50 } return ( window.location.href = "/"} sx={{ ...iconHeight }}> window.location.href = "/processer"} sx={{ ...iconHeight }}> window.location.href = "/eventsflow"} sx={{ ...iconHeight }}> window.location.href = "/files"} sx={{ ...iconHeight }}> window.location.href = "/unprocessed"} sx={{ ...iconHeight }}> window.location.href = "/tasks"} sx={{ ...iconHeight }}> } /> } /> } /> } /> } />