Skip to content

Commit

Permalink
Add skeleton folder structure
Browse files Browse the repository at this point in the history
  • Loading branch information
kwokieee committed Sep 6, 2023
1 parent 50f9745 commit 2f17c4d
Show file tree
Hide file tree
Showing 7 changed files with 92 additions and 140 deletions.
42 changes: 0 additions & 42 deletions frontend/src/App.css

This file was deleted.

31 changes: 3 additions & 28 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,34 +1,9 @@
import { useState } from 'react'
import reactLogo from './assets/react.svg'
import viteLogo from '/vite.svg'
import './App.css'
import Router from './routes'
import { RouterProvider } from 'react-router-dom'

function App() {
const [count, setCount] = useState(0)

return (
<>
<div>
<a href="https://vitejs.dev" target="_blank">
<img src={viteLogo} className="logo" alt="Vite logo" />
</a>
<a href="https://react.dev" target="_blank">
<img src={reactLogo} className="logo react" alt="React logo" />
</a>
</div>
<h1>Vite + React</h1>
<div className="card">
<button onClick={() => setCount((count) => count + 1)}>
count is {count}
</button>
<p>
Edit <code>src/App.tsx</code> and save to test HMR
</p>
</div>
<p className="read-the-docs">
Click on the Vite and React logos to learn more
</p>
</>
<RouterProvider router={Router} />
)
}

Expand Down
69 changes: 0 additions & 69 deletions frontend/src/index.css

This file was deleted.

1 change: 0 additions & 1 deletion frontend/src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react'
import ReactDOM from 'react-dom/client'
import App from './App.tsx'
import './index.css'

ReactDOM.createRoot(document.getElementById('root')!).render(
<React.StrictMode>
Expand Down
56 changes: 56 additions & 0 deletions frontend/src/pages/Dashboard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import { Box, Button, Paper, Table, TableBody, TableCell, TableContainer, TableHead, TableRow, Typography } from "@mui/material";

// TODO: Replace this with a real table
function createData(
id: number,
title: string,
description: string,
category: string,
complexity: string
) {
return { id, title, description, category, complexity };
}

const rows = [
createData(1, "Reverse a String", "Description 1", "Strings, Algorithms", "Easy"),
createData(1, "Repeated DNA Sequences", "Description 2", "Data Structures, Algorithms", "Medium"),
createData(1, "Sliding Window Maximum", "Description 3", "Arrays, Algorithms", "Hard")
];

export default function Dashboard() {
return (
<Box>
<Typography variant="h2">PeerPrep Dashboard</Typography>
<Button href={`/login`}>Log out</Button>
<TableContainer component={Paper}>
<Table sx={{ minWidth: 650 }} aria-label="simple table">
<TableHead>
<TableRow>
<TableCell>ID</TableCell>
<TableCell align="left">Title</TableCell>
<TableCell align="left">Category&nbsp;(g)</TableCell>
<TableCell align="left">Complexity&nbsp;(g)</TableCell>
{/* <TableCell align="right">Protein&nbsp;(g)</TableCell> */}
</TableRow>
</TableHead>
<TableBody>
{rows.map((row) => (
<TableRow
key={row.id}
sx={{ '&:last-child td, &:last-child th': { border: 0 } }}
>
<TableCell component="th" scope="row">
{row.id}
</TableCell>
<TableCell align="left">{row.title}</TableCell>
<TableCell align="left">{row.category}</TableCell>
<TableCell align="left">{row.complexity}</TableCell>
{/* <TableCell align="right">{row.protein}</TableCell> */}
</TableRow>
))}
</TableBody>
</Table>
</TableContainer>
</Box>
);
}
18 changes: 18 additions & 0 deletions frontend/src/pages/Login.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Box, Button, TextField, Typography } from "@mui/material";

export default function Login() {
return (
<>
<Box sx={{
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
}}>
<Typography variant="h1" gutterBottom>PeerPrep</Typography>
<TextField id="outlined-basic" label="Username" variant="outlined" />
<TextField id="outlined-basic" label="Password" variant="outlined" />
<Button href={`/dashboard`} variant="contained">Log in</Button>
</Box>
</>
);
}
15 changes: 15 additions & 0 deletions frontend/src/routes/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Navigate, createBrowserRouter } from 'react-router-dom';
import Login from '../pages/Login';
import Dashboard from '../pages/Dashboard';

export default createBrowserRouter([
{
path: '/login',
element: <Login />
},
{
path: '/dashboard',
element: <Dashboard />
},
{ path: '*', element: <Navigate to="/login" replace /> },
])

0 comments on commit 2f17c4d

Please sign in to comment.