Skip to content

Commit

Permalink
Run lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sam9291 committed Mar 23, 2024
1 parent 2c68b0a commit ada85b3
Show file tree
Hide file tree
Showing 6 changed files with 2,668 additions and 2,511 deletions.
5 changes: 5 additions & 0 deletions canopeum_frontend/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ module.exports = {
'beslogic/typescript',
'beslogic/dprint',
],
parser: '@typescript-eslint/parser',
parserOptions: {
project: ['tsconfig?(.*).json'],
},
ignorePatterns: [
'.eslintrc.cjs',
// Auto-generated
Expand All @@ -24,5 +28,6 @@ module.exports = {
'no-autofix/no-relative-import-paths/no-relative-import-paths': 'off',
// Using Bootraps directly without a React wrapper will cause us to have to add classes to React Components
'react/forbid-component-props': 'off',
'@typescript-eslint/no-unsafe-member-access': 'warn',
},
}
24 changes: 12 additions & 12 deletions canopeum_frontend/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import 'bootstrap/js/index.umd.js';
import './App.scss';
import 'bootstrap/js/index.umd.js'
import './App.scss'

import { BrowserRouter, Route, Routes } from 'react-router-dom';
import { BrowserRouter, Route, Routes } from 'react-router-dom'

import AuthenticationContextProvider from './components/context/AuthenticationContext';
import Navbar from './components/Navbar';
import Analytics from './pages/Analytics';
import Home from './pages/Home';
import Login from './pages/Login';
import Map from './pages/Map';
import MapSite from './pages/MapSite';
import UserManagement from './pages/UserManagement';
import Utilities from './pages/Utilities';
import AuthenticationContextProvider from './components/context/AuthenticationContext'
import Navbar from './components/Navbar'
import Analytics from './pages/Analytics'
import Home from './pages/Home'
import Login from './pages/Login'
import Map from './pages/Map'
import MapSite from './pages/MapSite'
import UserManagement from './pages/UserManagement'
import Utilities from './pages/Utilities'

const App = () => (
<AuthenticationContextProvider>
Expand Down
23 changes: 13 additions & 10 deletions canopeum_frontend/src/components/site/SiteSummaryCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,37 @@ import headerLogo from '@assets/images/map/MARR4059.png'
import type { SiteSocial } from '../../services/api'

type Props = {
readonly site: SiteSocial
readonly site: SiteSocial,
}

const SiteSummaryCard = ({ site }: Props) => (
<div className='bg-white rounded-4 d-flex flex-row gap-0'>

{/* TODO: replace img source when backend offers an image endpoint */}

Check warning on line 11 in canopeum_frontend/src/components/site/SiteSummaryCard.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected 'TODO' comment: 'TODO: replace img source when backend...'
<img alt='header logo' height={352} src={headerLogo} width={553} />
<div className='d-flex flex-column px-5 py-5'>
<h1 className='fw-bold'>{site.name}</h1>

<div className='d-flex flex-row gap-1'>
<div className='text-bg-primary rounded-4 text=center h-75 px-1'>
<span className='material-symbols-outlined text-light align-middle'
style={{ width: 21, fontSize: 24, marginLeft: -2, marginRight: 2 }}>school</span>
<span
className='material-symbols-outlined text-light align-middle'
style={{ width: 21, fontSize: 24, marginLeft: -2, marginRight: 2 }}
>
school
</span>
</div>
<h4 className='fw-bold text-primary'>{site.type.en}</h4>

Check warning on line 25 in canopeum_frontend/src/components/site/SiteSummaryCard.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unsafe member access .en on an `any` value
</div>
<p>{site.description ?? ''}</p>
<div className="container">
<div className="row row-cols-5 fw-bold">
<div className="col"><span className='material-symbols-outlined align-middle'>person</span>Sponsors: </div>
{site.sponsors.map((sponsorName) => <div className="col" key={sponsorName}>{sponsorName}</div>)}
<div className='container'>
<div className='row row-cols-5 fw-bold'>
<div className='col'>
<span className='material-symbols-outlined align-middle'>person</span>Sponsors:
</div>
{site.sponsors.map(sponsorName => <div className='col' key={sponsorName}>{sponsorName}</div>)}
</div>
</div>
</div>


</div>
)
export default SiteSummaryCard
15 changes: 3 additions & 12 deletions canopeum_frontend/src/pages/MapSite.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ import api from '../services/apiInterface'

const fetchSite = async (siteId: number, setSite: (site: SiteSocial) => void) => {
try {
const site = await api().social.site(siteId);
const site = await api().social.site(siteId)
setSite(site)
} catch (error) {
console.log(error)

Check warning on line 13 in canopeum_frontend/src/pages/MapSite.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected console statement
}
}
const MapSite = () => {
const { siteId } = useParams();
const { siteId } = useParams()
const [site, setSite] = useState<SiteSocial>()

useEffect(() => {

Check failure on line 20 in canopeum_frontend/src/pages/MapSite.tsx

View workflow job for this annotation

GitHub Actions / Lint

Consider removing braces around the arrow function's body. If it really needs to return `void` you can mark its return type explicitely with `(param): void => { statement }` to disable this warning
Expand All @@ -23,30 +23,21 @@ const MapSite = () => {

return (
<div className='container mt-2 d-flex flex-column gap-2'>

{site && <SiteSummaryCard site={site} />}

<div className='container px-0'>
<div className='row'>
<div className='col-4'>

<div className='bg-white rounded-2 2 py-2'>

<h1>Left</h1>

</div>
</div>
<div className='col-8' >

<div className='col-8'>
<div className='bg-white rounded-2 px-3 py-2'>

<h1>Right</h1>

</div>
</div>
</div>


</div>
</div>
)
Expand Down
Loading

0 comments on commit ada85b3

Please sign in to comment.