Skip to content

Commit

Permalink
Merge pull request #241 from 4201VitruvianBots/240-repository-cleanup
Browse files Browse the repository at this point in the history
240 repository cleanup
  • Loading branch information
Mevanessa authored May 15, 2024
2 parents 2e222b0 + 557d256 commit fd70c4d
Show file tree
Hide file tree
Showing 94 changed files with 3,102 additions and 2,089 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
IMAGE_NAME=scouting-database
CONTAINER_NAME=LAR-quals
CONTAINER_NAME=offseason_test
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ These instructions will get you a copy of the project up and running on your loc

### Prerequisites

- Node.js
- npm
- Docker (server only)
- Node.js
- npm
- Docker (server only)

### Installation

Expand Down Expand Up @@ -58,4 +58,4 @@ If you don't have real scouting data to use to test the picklist interface/other

```
npm run --workspace server gen-fake-json
```
```
13 changes: 8 additions & 5 deletions client/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@
<link rel="icon" type="image/svg+xml" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vitruvian Scouting</title>
<meta name="description" content="Vitruvian Scouting system">
<link rel="icon" href="/favicon.ico">
<link rel="apple-touch-icon" href="/apple-touch-icon.png" sizes="180x180">
<link rel="mask-icon" href="/mask-icon.svg" color="#48CA5D">
<meta name="theme-color" content="#48ca5d">
<meta name="description" content="Vitruvian Scouting system" />
<link rel="icon" href="/favicon.ico" />
<link
rel="apple-touch-icon"
href="/apple-touch-icon.png"
sizes="180x180" />
<link rel="mask-icon" href="/mask-icon.svg" color="#48CA5D" />
<meta name="theme-color" content="#48ca5d" />
</head>
<body>
<div id="root"></div>
Expand Down
11 changes: 10 additions & 1 deletion client/src/BatteryManager.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,16 @@ export interface BatteryManager extends EventTarget {
/** A number representing the system's battery charge level scaled to a value between 0.0 and 1.0. */
readonly level: number;

addEventListener(type: string | 'chargingchange' | 'chargingtimechange' | 'dischargingtimechange' | 'levelchange', callback: EventListenerOrEventListenerObject | null, options?: AddEventListenerOptions | boolean): void;
addEventListener(
type:
| string
| 'chargingchange'
| 'chargingtimechange'
| 'dischargingtimechange'
| 'levelchange',
callback: EventListenerOrEventListenerObject | null,
options?: AddEventListenerOptions | boolean
): void;
}

declare global {
Expand Down
76 changes: 42 additions & 34 deletions client/src/RootMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,47 +8,55 @@ const images = [
'bg-field-red-endgame',
'bg-field-blue-endgame',
'bg-field-blue-super',
'bg-field-red-super'
'bg-field-red-super',
];

function RootMenu() {
return (
<main className='min-h-screen bg-[#171c26] text-white text-center
grid grid-cols-2 grid-rows-[auto] auto-rows-fr gap-10 pb-10 px-10 select-none'>
<h1 className='bg-[#2f3646] col-span-2 text-4xl text-[#48c55c] font-bold p-5'>
<main
className='grid min-h-screen select-none auto-rows-fr
grid-cols-2 grid-rows-[auto] gap-10 bg-[#171c26] px-10 pb-10 text-center text-white'>
<h1 className='col-span-2 bg-[#2f3646] p-5 text-4xl font-bold text-[#48c55c]'>
Vitruvian Scouting
</h1>
<div className='fixed bottom-2 left-1/2 -translate-x-1/2'> Version {import.meta.env.VITE_SCOUT_VERSION} </div>
<LinkButton link='/match'
className='text-5xl bg-[#2f3646] rounded-3xl'>
Match
</LinkButton>
<LinkButton link='/super'
className='text-5xl bg-[#2f3646] rounded-3xl'>
Super
</LinkButton>
<LinkButton link='/pit'
className='text-5xl bg-[#2f3646] rounded-3xl'>
Pit
</LinkButton>
<LinkButton link='/recon'
className='text-5xl bg-[#2f3646] rounded-3xl'>
Recon
</LinkButton>
<LinkButton link='/picklist'
className='text-5xl bg-[#2f3646] rounded-3xl'>
Picklist
</LinkButton>
<LinkButton link='/games'
className='text-5xl bg-[#2f3646] rounded-3xl'>
Games
</LinkButton>
<LinkButton link='/score_calculator'
className='text-5xl bg-[#2f3646] rounded-3xl col-span-2'>
Scoring Calculator
</LinkButton>
<div className='fixed bottom-2 left-1/2 -translate-x-1/2'>
{' '}
Version {import.meta.env.VITE_SCOUT_VERSION}{' '}
</div>
<LinkButton
link='/match'
className='rounded-3xl bg-[#2f3646] text-5xl'>
Match
</LinkButton>
<LinkButton
link='/super'
className='rounded-3xl bg-[#2f3646] text-5xl'>
Super
</LinkButton>
<LinkButton
link='/pit'
className='rounded-3xl bg-[#2f3646] text-5xl'>
Pit
</LinkButton>
<LinkButton
link='/recon'
className='rounded-3xl bg-[#2f3646] text-5xl'>
Recon
</LinkButton>
<LinkButton
link='/picklist'
className='rounded-3xl bg-[#2f3646] text-5xl'>
Picklist
</LinkButton>
<LinkButton
link='/score_calculator'
className='rounded-3xl bg-[#2f3646] text-5xl'>
Scoring Calculator
</LinkButton>
<div className='absolute opacity-0'>
{images.map(e => <div className={e} />)}
{images.map(e => (
<div className={e} />
))}
<MaterialSymbol icon='search' />
</div>
</main>
Expand Down
21 changes: 9 additions & 12 deletions client/src/apps/admin/AdminApp.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
import { MaterialSymbol } from "react-material-symbols";
import LinkButton from "../../components/LinkButton";
import { MaterialSymbol } from 'react-material-symbols';
import LinkButton from '../../components/LinkButton';
import { useStatusRecieve } from '../../lib/useStatus';
import { ScouterTable } from "./components/ScouterTable";
import { MatchTable } from "./components/MatchTable";
import { ScouterTable } from './components/ScouterTable';
import { MatchTable } from './components/MatchTable';
//import { useFetchJson } from "../../lib/useFetch";

function AdminApp() {
const status = useStatusRecieve();

console.log(status.matches)
// const [schedule] = useFetchJson<MatchSchedule>('/matchSchedule.json');

// const [schedule] = useFetchJson<MatchSchedule>('/matchSchedule.json');


return (
<main className='flex select-none flex-col items-center text-center w-screen h-screen'>
<main className='flex h-screen w-screen select-none flex-col items-center text-center'>
<h1 className='col-span-4 my-8 text-3xl'>Admin Interface</h1>

<div className='fixed left-4 top-4 z-20 flex gap-2 rounded-md p-2'>
Expand All @@ -30,14 +27,14 @@ function AdminApp() {
</LinkButton>
</div>

<div className="grid grid-cols-2 gap-4 items-center justify-center">
<div className='grid grid-cols-2 items-center justify-center gap-4'>
<div>
<ScouterTable scouters={status.scouters} />
<p className="my-6">Connected Tablets</p>
<p className='my-6'>Connected Tablets</p>
</div>
<div>
<p>Match Display</p>
<div className="table-container">
<div className='table-container'>
<MatchTable matches={status.matches}></MatchTable>
</div>
</div>
Expand Down
40 changes: 22 additions & 18 deletions client/src/apps/admin/components/MatchRow.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
import { RobotPosition, SuperPosition } from "requests";
import PositionCell from "./PositionCell";
import { RobotPosition, SuperPosition } from 'requests';
import PositionCell from './PositionCell';


function MatchRow ({matchNumber, scouters} : {matchNumber:string, scouters:Record<RobotPosition, {schedule: number, real:number[]}> & Record<SuperPosition, boolean>}){
return(
function MatchRow({
matchNumber,
scouters,
}: {
matchNumber: string;
scouters: Record<RobotPosition, { schedule: number; real: number[] }> &
Record<SuperPosition, boolean>;
}) {
return (
<tr>
<th>
{matchNumber}
</th>
<PositionCell scouter={scouters.red_1}/>
<PositionCell scouter={scouters.red_2}/>
<PositionCell scouter={scouters.red_3}/>
<PositionCell scouter={scouters.red_ss}/>
<PositionCell scouter={scouters.blue_1}/>
<PositionCell scouter={scouters.blue_2}/>
<PositionCell scouter={scouters.blue_3}/>
<PositionCell scouter={scouters.blue_ss}/>
<th>{matchNumber}</th>
<PositionCell scouter={scouters.red_1} />
<PositionCell scouter={scouters.red_2} />
<PositionCell scouter={scouters.red_3} />
<PositionCell scouter={scouters.red_ss} />
<PositionCell scouter={scouters.blue_1} />
<PositionCell scouter={scouters.blue_2} />
<PositionCell scouter={scouters.blue_3} />
<PositionCell scouter={scouters.blue_ss} />
</tr>
)
);
}

export default MatchRow
export default MatchRow;
50 changes: 26 additions & 24 deletions client/src/apps/admin/components/MatchTable.tsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
import { StatusRecieve } from "requests"
import MatchRow from "./MatchRow"
import { StatusRecieve } from 'requests';
import MatchRow from './MatchRow';


function MatchTable({matches}:{matches : StatusRecieve['matches']}) {

return(
<table className="match-status overflow-auto h-72">
<thead><tr>
<th>Match</th>
<th className="status-red col-span-1">Red 1</th>
<th className="status-red col-span-1">Red 2</th>
<th className="status-red col-span-1">Red 3</th>
<th className="status-red col-span-1">Red SS</th>
<th className="status-blue col-span-1">Blue 1</th>
<th className="status-blue col-span-1">Blue 2</th>
<th className="status-blue col-span-1">Blue 3</th>
<th className="status-blue col-span-1">Blue SS</th>
</tr></thead>
<tbody>
{Object.entries(matches).map(([matchNumber, scouters]) => <MatchRow matchNumber={matchNumber} scouters={scouters}/>)}
</tbody>
</table>
)
function MatchTable({ matches }: { matches: StatusRecieve['matches'] }) {
return (
<table className='match-status h-72 overflow-auto'>
<thead>
<tr>
<th>Match</th>
<th className='status-red col-span-1'>Red 1</th>
<th className='status-red col-span-1'>Red 2</th>
<th className='status-red col-span-1'>Red 3</th>
<th className='status-red col-span-1'>Red SS</th>
<th className='status-blue col-span-1'>Blue 1</th>
<th className='status-blue col-span-1'>Blue 2</th>
<th className='status-blue col-span-1'>Blue 3</th>
<th className='status-blue col-span-1'>Blue SS</th>
</tr>
</thead>
<tbody>
{Object.entries(matches).map(([matchNumber, scouters]) => (
<MatchRow matchNumber={matchNumber} scouters={scouters} />
))}
</tbody>
</table>
);
}

export {MatchTable}
export { MatchTable };
31 changes: 20 additions & 11 deletions client/src/apps/admin/components/PositionCell.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
import { MaterialSymbol } from "react-material-symbols"
import { MaterialSymbol } from 'react-material-symbols';

function PositionCell ({scouter}:{scouter:{schedule: number, real:number[]} | boolean }){
const isBoolean = typeof scouter==='boolean'
function PositionCell({
scouter,
}: {
scouter: { schedule: number; real: number[] } | boolean;
}) {
const isBoolean = typeof scouter === 'boolean';
return (
<td className={`border-2 border-slate-700 text-center w-auto ${(isBoolean? scouter: scouter.real.length > 0)? 'bg-amber-400': ''}`}>{
isBoolean
?scouter&&<MaterialSymbol icon='check'/>
:scouter.real.length===0?scouter.schedule
:scouter.real.length===1?scouter.real[0]
:<MaterialSymbol icon="warning"/>}
<td
className={`w-auto border-2 border-slate-700 text-center ${(isBoolean ? scouter : scouter.real.length > 0) ? 'bg-amber-400' : ''}`}>
{isBoolean ? (
scouter && <MaterialSymbol icon='check' />
) : scouter.real.length === 0 ? (
scouter.schedule
) : scouter.real.length === 1 ? (
scouter.real[0]
) : (
<MaterialSymbol icon='warning' />
)}
</td>
)
);
}
export default PositionCell
export default PositionCell;
Loading

0 comments on commit fd70c4d

Please sign in to comment.