Skip to content

Commit

Permalink
Fix frontend (#881)
Browse files Browse the repository at this point in the history
* Fixed Lint

* Correção temporaria para o build do frontend, foi removido a separação entre os bundles publico o e dashboard
  • Loading branch information
glaubervila authored Feb 25, 2024
1 parent 8196b4d commit bfce2d1
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 49 deletions.
22 changes: 11 additions & 11 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ RUN yarn -v
RUN yarn --non-interactive --ignore-optional --network-timeout 500000
# RUN yarn run build

FROM builder as builder_public
RUN yarn run build_public
# FROM builder as builder_public
# RUN yarn run build_public

FROM builder as builder_dashboard
RUN yarn run build_dashboard
# FROM builder as builder_dashboard
# RUN yarn run build_dashboard

# FROM builder as builder_all
# RUN yarn run build
FROM builder as builder_all
RUN yarn run build

# Ngnix
FROM nginx:latest
Expand All @@ -30,11 +30,11 @@ RUN chmod -R g+w /var/cache/nginx/
# Write the PID file to a location where regular users have write access.
RUN sed --regexp-extended --in-place=.bak 's%^pid\s+/var/run/nginx.pid;%pid /var/tmp/nginx.pid;%' /etc/nginx/nginx.conf

COPY --from=builder_public /build/public_page /var/www/html
COPY --from=builder_dashboard /build/dashboard /var/www/html/dashboard
# COPY --from=builder_all /app/build /var/www/frontend
# COPY --from=builder_public --chmod=775 /build/public_page /var/www/html/home
# COPY --from=builder_dashboard --chmod=775 /build/dashboard /var/www/html/dashboard
COPY --from=builder_all /app/build /var/www/frontend

RUN chgrp nginx /var/www
RUN chmod -R g+w /var/www
RUN chgrp nginx /var/www/frontend
RUN chmod -R g+w /var/www/frontend
# ADD ./nginx/production.conf /etc/nginx/conf.d/default.conf
USER nginx
2 changes: 0 additions & 2 deletions frontend/src/components/GeoFilter/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

import PropTypes from 'prop-types';
import TextField from '@mui/material/TextField';
import Stack from '@mui/material/Stack';
import FormControlLabel from '@mui/material/FormControlLabel';
import Switch from '@mui/material/Switch';
import { useEffect, useState } from 'react';
Expand All @@ -11,7 +10,6 @@ import Select from '@mui/material/Select';
import MenuItem from '@mui/material/MenuItem';
import { geoFilterIsValid } from '../../services/api/Occultation';
import Grid from '@mui/material/Grid'
import Typography from '@mui/material/Typography';
import Alert from '@mui/material/Alert';
function GeoFilter({ value, onChange }) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function PredictEventCard({ data }) {
}

const handleShare = () => {
const url = getDetailUrl();
// const url = getDetailUrl();
// TODO: Copiar a url para area de transferencia e avisar.
}
const getDetailUrl = () => {
Expand Down
7 changes: 2 additions & 5 deletions frontend/src/components/PredictionEventsDataGrid/Toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,12 @@ import SearchAsteroid from '../SearchAsteroid'
import ViewListIcon from '@mui/icons-material/ViewList';
import ViewModuleIcon from '@mui/icons-material/ViewModule';
import { PredictionEventsContext } from '../../contexts/PredictionContext';
import useBreakpoint from '../../hooks/useBreakpoint';


function PredictEventToolbar({ }) {
function PredictEventToolbar() {

const { viewLayoyt, setViewLayoyt, isMobile } = useContext(PredictionEventsContext)
// const currentBreakpoint = useBreakpoint()
// const isMobile = ['xs', 'sm', 'md', 'lg'].indexOf(currentBreakpoint.getBreakPointName()) !== -1 ? true : false
// console.log("isMobile: %o", isMobile)

const handleChangeLayout = (e, value) => {
if (value !== null) {
setViewLayoyt(value)
Expand Down
12 changes: 5 additions & 7 deletions frontend/src/pages/PublicPortal/Header/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import React from 'react'
import { AppBar, Toolbar, IconButton, Button, Box } from '@mui/material'
import { Brightness4, Brightness7 } from '@mui/icons-material'
import { useNavigate } from 'react-router-dom'
import AppBar from '@mui/material/AppBar'
import Toolbar from '@mui/material/Toolbar'
import Button from '@mui/material/Button'
import Box from '@mui/material/Box'

const PublicHeader = ({ darkMode, toggleTheme }) => {
const PublicHeader = () => {
const navigate = useNavigate()

const menus = [
Expand All @@ -13,10 +15,6 @@ const PublicHeader = ({ darkMode, toggleTheme }) => {
{ description: 'Contact', href: '/contact-us', target: '_self' },
]

const handleToggleDarkMode = () => {
toggleTheme()
}

const handleCardClick = (pathname) => navigate(pathname)

return (
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import { Routes, Route, Navigate } from 'react-router-dom'
import { PublicPageRoutes } from './public_page'
import { DashboardPageRoutes } from './dashboard'

export default function AppRoutes({ toggleTheme, darkMode }) {
export default function AppRoutes() {
return (
<Routes>
{PublicPageRoutes({ toggleTheme, darkMode })}
{PublicPageRoutes()}
{DashboardPageRoutes()}
<Route path='*' element={<Navigate to='/' />} />
</Routes>
Expand Down
33 changes: 12 additions & 21 deletions frontend/src/routes/public_page.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ import FooterSupporters from '../pages/PublicPortal/Footer/FooterSupporters'
import PredictionEventDetail from '../pages/PredictionEvents/Detail'
import Container from '@mui/material/Container'

const PublicPortalPage = ({ children, toggleTheme, darkMode }) => {

const PublicPortalPage = ({ children}) => {
return (
<>
<PublicHeader toggleTheme={toggleTheme} darkMode={darkMode} />
<PublicHeader />
<Container maxWidth="lg">
{children}
</Container>
Expand All @@ -21,7 +22,8 @@ const PublicPortalPage = ({ children, toggleTheme, darkMode }) => {
)
}

export function PublicPageRoutes({ toggleTheme, darkMode }) {

export function PublicPageRoutes() {
return (
<>
{/* Public Portal Layout*/}
Expand All @@ -30,7 +32,7 @@ export function PublicPageRoutes({ toggleTheme, darkMode }) {
exact
path='/'
element={
<PublicPortalPage toggleTheme={toggleTheme} darkMode={darkMode}>
<PublicPortalPage>
<PublicHome />
</PublicPortalPage>
}
Expand All @@ -39,7 +41,7 @@ export function PublicPageRoutes({ toggleTheme, darkMode }) {
exact
path='/prediction-event-detail/:id'
element={
<PublicPortalPage toggleTheme={toggleTheme} darkMode={darkMode}>
<PublicPortalPage>
<PredictionEventDetail />
</PublicPortalPage>
}
Expand All @@ -50,7 +52,7 @@ export function PublicPageRoutes({ toggleTheme, darkMode }) {
exact
path='/about-us'
element={
<PublicPortalPage toggleTheme={toggleTheme} darkMode={darkMode}>
<PublicPortalPage>
<PublicAboutUs />
</PublicPortalPage>
}
Expand All @@ -60,7 +62,7 @@ export function PublicPageRoutes({ toggleTheme, darkMode }) {
exact
path='/contact-us'
element={
<PublicPortalPage toggleTheme={toggleTheme} darkMode={darkMode}>
<PublicPortalPage>
<PublicContact />
</PublicPortalPage>
}
Expand All @@ -70,30 +72,19 @@ export function PublicPageRoutes({ toggleTheme, darkMode }) {
exact
path='/documentation'
element={
<PublicPortalPage toggleTheme={toggleTheme} darkMode={darkMode}>
<PublicPortalPage>
<PublicDocumentation />
</PublicPortalPage>
}
/>
{/* Landing Page Layout*/}
<Route
isHomePage
exact
path='/'
element={
<PublicPortalPage toggleTheme={toggleTheme} darkMode={darkMode}>
<PublicHome />
</PublicPortalPage>
}
/>
</>
)
}

export default function PublicRoutes({ toggleTheme, darkMode }) {
export default function PublicRoutes() {
return (
<Routes>
<PublicPageRoutes toggleTheme={toggleTheme} darkMode={darkMode} />
<PublicPageRoutes />
<Route path='*' element={<Navigate to='/' />} />
</Routes>
)
Expand Down

0 comments on commit bfce2d1

Please sign in to comment.