Skip to content

Commit

Permalink
Feature: MASSIVE REAFACTOR :) Tailwind css in and working, project se…
Browse files Browse the repository at this point in the history
…t up correctly finally in react, all package management now works as intended and many other smaller tweeks
  • Loading branch information
William-Papantoniou committed Oct 30, 2023
1 parent b547ae7 commit 17efc65
Show file tree
Hide file tree
Showing 56 changed files with 66,573 additions and 12,223 deletions.
File renamed without changes.
File renamed without changes.
20,112 changes: 20,112 additions & 0 deletions frontend-react-tsx/package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion frontend/package.json → frontend-react-tsx/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "frontend-new",
"name": "frontend-react-tsx",
"version": "0.1.0",
"private": true,
"dependencies": {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#142449" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Bluesat groundstation frontend v1"
content="Web site created using create-react-app"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!--
Expand All @@ -24,7 +24,7 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>Groundstation</title>
<title>React App</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
38 changes: 38 additions & 0 deletions frontend-react-tsx/src/App.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
.App {
text-align: center;
}

.App-logo {
height: 40vmin;
pointer-events: none;
}

@media (prefers-reduced-motion: no-preference) {
.App-logo {
animation: App-logo-spin infinite 20s linear;
}
}

.App-header {
background-color: #282c34;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: calc(10px + 2vmin);
color: white;
}

.App-link {
color: #61dafb;
}

@keyframes App-logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
9 changes: 9 additions & 0 deletions frontend-react-tsx/src/App.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from 'react';
import { render, screen } from '@testing-library/react';
import App from './App';

test('renders learn react link', () => {
render(<App />);
const linkElement = screen.getByText(/learn react/i);
expect(linkElement).toBeInTheDocument();
});
5 changes: 3 additions & 2 deletions frontend/src/App.tsx → frontend-react-tsx/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React from 'react';
import Plot from 'react-plotly.js';
import './App.css';

import Home from './pages/Home'
import Home from './Home'

import { useWebsocket } from './Websocket';
import Plot from 'react-plotly.js';

const App: React.FC = () => {

Expand All @@ -13,6 +13,7 @@ const App: React.FC = () => {
return (
<div className="App">
{/* <p>hello</p> */}
<h1 className='text-3xl font-bold underline'>TEST</h1>
{state === undefined && <p>State not yet initialised</p>}
{/* {state && <p>{`${JSON.stringify(state)}`}</p>} */}
{<Home/>}
Expand Down
File renamed without changes.
30 changes: 16 additions & 14 deletions frontend/src/pages/Home.tsx → frontend-react-tsx/src/Home.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import React, { useState } from 'react';
import Sidebar from '../components/Sidebar';
import { Button, Dialog, DialogContent, Divider, Snackbar } from "@mui/material"
import { Button, Dialog, DialogContent, Divider, Grid, Snackbar } from "@mui/material"
import type { gps_pos } from '../types/hardwareTypes';
import type { targetSat } from '../types/targetSat';
import LocationModal from '../components/LocationModal';
import {
n2yo_visual_passes, n2yo_radio_passes,
n2yo_get_visual_passes, n2yo_get_radio_passes
} from '../types/n2yotypes';
import { getRadioPasses, getVisualPasses } from '../logic/backend_req';
import SelectTargetModal from '../components/SelectTargetModal';
import WhatsUpModal from '../components/WhatsUpModal/WhatsUpModal';
import Grid from '@mui/material/Grid';
import EncounterSub from '../components/EncounterSub/EncounterSub';
import MapSub from '../components/MapSub/MapSub';
import MonitorSub from '../components/MonitorSub/MonitorSub';
import LogSub from '../components/LogSub/LogSub';
import { sendAction, useWebsocket } from '../Websocket';
import { sendAction, useWebsocket } from './Websocket';
import SelectTargetModal from './components/SelectTargetModal';
import WhatsUpModal from './components/WhatsUpModal/WhatsUpModal';
import EncounterSub from './components/EncounterSub/EncounterSub';
import MapSub from './components/MapSub/MapSub';
import MonitorSub from './components/MonitorSub/MonitorSub';
import LoggingSub from './components/LogSub/LogSub';
import LocationModal from './components/LocationModal';
import SideBar from './components/Sidebar';
import { getRadioPasses, getVisualPasses } from './logic/backend_req';



const Index: React.FC = () => {
Expand Down Expand Up @@ -115,6 +115,8 @@ const Index: React.FC = () => {
export interface SelectSatellite {
satellite: Satellite,
} */}

<h1 className="text-3xl font-bold underline">TEST WITH TAILWIND</h1>



Expand Down Expand Up @@ -164,7 +166,7 @@ const Index: React.FC = () => {
{/* Dashboard layout */}
<Grid container spacing={1} xs={12} sx={{ margin: "20px", width: "100%" }}>
<Grid item xs={12}>
<Sidebar setWhatsUpModal={setWhatsUpModal} onFindId={findId}
<SideBar setWhatsUpModal={setWhatsUpModal} onFindId={findId}
setTargetModal={setTargetModal} onCalcEn={calcEncounter} />
<Divider sx={{ margin: "10px" }} />
</Grid>
Expand All @@ -178,7 +180,7 @@ const Index: React.FC = () => {
<MonitorSub tab={monitorTab} setTab={setMonitorTab} connected={beConnected} setConnected={setBeConnected} location={loc} setLocModal={setLocModal} />
</Grid>
<Grid item xs={4} sx={{ height: "50%" }}>
<LogSub />
<LoggingSub />
</Grid>
</Grid>
</div>
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useEffect, useState } from "react";
import {State, StateAction} from "./State"
import {applyPatch, Operation} from "fast-json-patch"
import { State, StateAction } from "./State";
interface Patch {
type: "Patch";
ops: Operation[]; // from fast-json-patch
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@

import {useEffect} from 'react';
import { Grid, Table, TableBody, TableCell, TableContainer, TableRow, Typography } from "@mui/material"
import { n2yo_radio_passes, n2yo_visual_passes } from '../../../types/n2yotypes';

import UTCtoD from '../../../logic/utility';
import { n2yo_radio_passes, n2yo_visual_passes } from '../../../../types/n2yotypes';



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

import React from 'react';
import { Card, CardContent, Divider, Grid, Stack } from "@mui/material"
import { targetSat } from '../../types/targetSat';
import { n2yo_radio_passes, n2yo_visual_passes } from '../../types/n2yotypes';
import TargetInfo from './TargetInfo/TargetInfo';
import EncounterInfo from './EncounterInfo/EncounterInfo';
import { n2yo_radio_passes, n2yo_visual_passes } from '../../../types/n2yotypes';
import { targetSat } from '../../../types/targetSat';

interface EncounterSubProps {
sat: targetSat,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
// Matt

import React from 'react';
import type { targetSat } from '../../../types/targetSat';
import { Grid, Typography } from '@mui/material';
import Table from '@mui/material/Table';
import TableBody from '@mui/material/TableBody';
import TableCell from '@mui/material/TableCell';
import TableContainer from '@mui/material/TableContainer';
import TableRow from '@mui/material/TableRow';
import { targetSat } from '../../../../types/targetSat';

interface TargetInfoProps {
sat: targetSat
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
// implementing acquisition asynchronously.

import { Button, TextField } from '@mui/material';
import { gps_pos } from '../types/hardwareTypes';

import React from 'react';
import styled from '@emotion/styled';
import Stack from "@mui/material/Stack";
import { Container, Body } from './Common';
import { gps_pos } from '../../types/hardwareTypes';


const Field = styled.div`
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import React from 'react';
import { Card, CardContent, Grid } from "@mui/material"
import { targetSat } from '../../types/targetSat';
import { targetSat } from '../../../types/targetSat';
import Clock from '../Common/Clock';

interface MapSubProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import ToggleButton from '@mui/material/ToggleButton';
import ToggleButtonGroup from '@mui/material/ToggleButtonGroup';
import BackendMonitor from './SystemInfo/BackendMonitor/BackendMonitor';
import SysLocation from './SystemInfo/SysLocation';
import { gps_pos } from '../../types/hardwareTypes';
import Tracking from './Tracking/Tracking';
import { gps_pos } from '../../../types/hardwareTypes';

interface MonitorSubProps {
location: gps_pos,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

import React, { useEffect } from 'react';
import { Stack, Typography } from "@mui/material"
import { getStatus } from '../../../../logic/backend_req'
import type { backend_status } from '../../../../types/hardwareTypes';
import { backend_status } from '../../../../../types/hardwareTypes';
import { getStatus } from '../../../../logic/backend_req';

interface Props {
connected: boolean,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import { Button, Grid, Stack, TextField, Typography } from '@mui/material';
import React from 'react';
import { backend_setPort } from '../../../../logic/backend_req'
import BackendConnection from './BackendConnection';


Expand Down Expand Up @@ -44,4 +43,8 @@ const BackendMonitor: React.FC<Props> = ({ connected, setConnected }) => {
)
}

export default BackendMonitor;
export default BackendMonitor;

function backend_setPort(port: number) {
throw new Error('Function not implemented.');
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import React from 'react';
import { Button, Card, CardActions, CardContent, Grid, Typography } from "@mui/material"
import { gps_pos } from '../../../types/hardwareTypes';
import { gps_pos } from '../../../../types/hardwareTypes';
import Clock from '../../Common/Clock';
interface SysLocationProps {
location: gps_pos;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
// implementing acquisition asynchronously.

import { Button, TextField, Card, CardContent, Typography } from '@mui/material';
import { gps_pos } from '../types/hardwareTypes';
import React from 'react';
import styled from '@emotion/styled';
import Stack from "@mui/material/Stack";
import { Container, Body } from './Common';
import { targetSat } from '../types/targetSat';
import { targetSat } from '../../types/targetSat';
import { gps_pos } from '../../types/hardwareTypes';
import { getPositions } from '../logic/backend_req';


Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

import { Avatar, Chip, Tooltip } from '@mui/material';
import React from 'react';
import { n2yo_above } from '../../types/n2yotypes';
import { deepOrange, green } from '@mui/material/colors';
import { n2yo_above } from '../../../types/n2yotypes';

interface SatChipProps {
sat : n2yo_above,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

import React from 'react';
import styled from '@emotion/styled';
import { n2yo_above } from '../../types/n2yotypes';
import SatChip from './SatChip';
import { n2yo_above } from '../../../types/n2yotypes';



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import React from 'react';
import styled from '@emotion/styled';
import SatSelector from './SatSelector';
import { categories } from './Category'
import { n2yo_above } from '../../types/n2yotypes';
import { gps_pos } from '../../types/hardwareTypes';
import type { targetSat } from '../../types/targetSat';
import { gps_pos } from '../../../types/hardwareTypes';
import { n2yo_above } from '../../../types/n2yotypes';
import { targetSat } from '../../../types/targetSat';
import { getPositions, getWhatsUp } from '../../logic/backend_req';

const Container = styled.div`
Expand Down
3 changes: 3 additions & 0 deletions frontend-react-tsx/src/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
11 changes: 6 additions & 5 deletions frontend/src/index.tsx → frontend-react-tsx/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import React from 'react';
import ReactDOM from 'react-dom';
import ReactDOM from 'react-dom/client';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';


ReactDOM.render(
const root = ReactDOM.createRoot(
document.getElementById('root') as HTMLElement
);
root.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById('root')
</React.StrictMode>
);

// If you want to start measuring performance in your app, pass a function
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
// Matt Rossouw (omeh-a)
// 05/2022

import { gps_pos, backend_status } from "../types/hardwareTypes";
import { n2yo_get_radio_passes, n2yo_get_visual_passes, n2yo_positions, n2yo_whats_up } from "../types/n2yotypes";
import { gps_pos } from "../../types/hardwareTypes";
import { n2yo_get_radio_passes, n2yo_get_visual_passes, n2yo_positions, n2yo_whats_up } from "../../types/n2yotypes";


// Parameters set by frontend to communicate with backend
let port: number = 4999
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions frontend-react-tsx/src/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions frontend-react-tsx/src/setupTests.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// jest-dom adds custom jest matchers for asserting on DOM nodes.
// allows you to do things like:
// expect(element).toHaveTextContent(/react/i)
// learn more: https://github.com/testing-library/jest-dom
import '@testing-library/jest-dom';
11 changes: 11 additions & 0 deletions frontend-react-tsx/tailwind.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
"./src/**/*.{js,jsx,ts,tsx}",
],
theme: {
extend: {},
},
plugins: [],
}

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "preserve"
"jsx": "react-jsx"
},
"include": [
"src"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 17efc65

Please sign in to comment.