From 5da60596992e75ab6644a8aa0765a260a0ae2206 Mon Sep 17 00:00:00 2001
From: Vinicius Gabriel Machado <vgm18@inf.ufpr.br>
Date: Sun, 25 Jul 2021 22:48:19 -0300
Subject: [PATCH] Fixed error when receiving nilClass on feed/notifications and
 removed teste page

---
 package-lock.json                             |   8 --
 package.json                                  |   1 -
 public/manifest.webmanifest                   |  16 ++-
 src/App.js                                    |  16 ---
 src/Components/AboutCarouselPartner.js        |   4 +-
 src/Components/Notifications.js               |   1 +
 .../TabPanels/UserPageTabs/PanelAtividades.js |   1 +
 src/Pages/ResourcePage.js                     |  14 --
 src/Pages/Teste.js                            | 135 ------------------
 9 files changed, 18 insertions(+), 178 deletions(-)
 delete mode 100644 src/Pages/Teste.js

diff --git a/package-lock.json b/package-lock.json
index e4fb1c54..5fdb3179 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -14234,14 +14234,6 @@
         "scheduler": "^0.19.1"
       }
     },
-    "react-dropdown": {
-      "version": "1.9.2",
-      "resolved": "https://registry.npmjs.org/react-dropdown/-/react-dropdown-1.9.2.tgz",
-      "integrity": "sha512-g4eufErTi5P5T5bGK+VmLl//qvAHy79jm6KKx8G2Tl3mG90bpigb+Aw85P+C2JUdAnIIQdv8kP/oHN314GvAfw==",
-      "requires": {
-        "classnames": "^2.2.3"
-      }
-    },
     "react-easy-swipe": {
       "version": "0.0.21",
       "resolved": "https://registry.npmjs.org/react-easy-swipe/-/react-easy-swipe-0.0.21.tgz",
diff --git a/package.json b/package.json
index 3406c486..b2d73017 100644
--- a/package.json
+++ b/package.json
@@ -14,7 +14,6 @@
     "piwik-react-router": "^0.12.1",
     "react": "^16.14.0",
     "react-dom": "^16.14.0",
-    "react-dropdown": "^1.9.2",
     "react-google-login": "^5.1.25",
     "react-grid-system": "^4.4.11",
     "react-icons": "^3.11.0",
diff --git a/public/manifest.webmanifest b/public/manifest.webmanifest
index 6fed6c58..1f321e7c 100644
--- a/public/manifest.webmanifest
+++ b/public/manifest.webmanifest
@@ -3,16 +3,28 @@
     "name": "Platafoma Integrada MEC RED",
     "icons": [
         {
-            "src": "/img/maskable_icon_192x192.png",
+            "src": "/img/logo_small_192x192.png",
             "type": "image/png",
             "sizes": "192x192",
             "purpose": "any"
         },
         {
-            "src": "/img/maskable_icon_512x512.png",
+            "src": "/img/logo_small_512x512.png",
             "type": "image/png",
             "sizes": "512x512",
             "purpose": "any"
+        },
+        {
+            "src": "/img/maskable_icon_192x192.png",
+            "type": "image/png",
+            "sizes": "192x192",
+            "purpose": "maskable"
+        },
+        {
+            "src": "/img/maskable_icon_512x512.png",
+            "type": "image/png",
+            "sizes": "512x512",
+            "purpose": "maskable"
         }
     ],
     "start_url": "/",
diff --git a/src/App.js b/src/App.js
index 1fab5adc..5f23ceaa 100644
--- a/src/App.js
+++ b/src/App.js
@@ -23,7 +23,6 @@ import { Store } from './Store'
 import LoadingSpinner from './Components/LoadingSpinner';
 import { BrowserRouter, Switch, Route, Redirect } from "react-router-dom";
 import createBrowserHistory from 'history/createBrowserHistory'
-//import {Helmet} from "react-helmet";
 
 const AdminTemplate = React.lazy(() => import('./Admin/Components/Components/AdminTemplate'));
 const Header = React.lazy(() => import("./Components/Header"));
@@ -34,7 +33,6 @@ const GNUAGPLfooter = React.lazy(() => import("./Components/AGPLFooter"));
 const UserPage = React.lazy(() => import("./Pages/UserPage"));
 const UserTerms = React.lazy(() => import("./Pages/UserTerms"));
 const Contact = React.lazy(() => import("./Pages/Contact"));
-const Teste = React.lazy(() => import("./Pages/Teste"));
 const AboutPage = React.lazy(() => import("./Pages/AboutPage"));
 const HelpCenter = React.lazy(() => import("./Pages/HelpCenter"));
 const TabResoursePub = React.lazy(() => import("./Pages/TabsHelp/TabResoursePub"));
@@ -189,19 +187,6 @@ export default function App() {
                     href="https://fonts.googleapis.com/css?family=Kalam|Pompiere|Roboto&display=swap"
                     rel="stylesheet"
                 />
-                {
-                //<Helmet>
-                //    <meta name="twitter:card" content="summary_large_image" />
-                //    <meta name="twitter:title" content="Plataforma MEC de Recursos Educacionais Digitais." />
-                //    <meta name="twitter:image" content={String(window.location.origin) + "/img/maskable_logo.png"} />
-                //    <meta name="twitter:description" content="Encontre e compartilhe vídeos, animações e muitos outros Recursos" />
-                //    <meta property="og:url" content={String(window.location.href)} />
-                //    <meta property="og:type" content="website" />
-                //    <meta property="og:title" content="Plataforma MEC de Recursos Educacionais Digitais." />
-                //    <meta property="og:description" content="Encontre e compartilhe vídeos, animações e muitos outros Recursos" />
-                //    <meta property="og:image" content={String(window.location.origin) + "/img/maskable_logo.png"} />   
-                //</Helmet>
-                }
                 <Switch>
                     <Redirect from="/home" to="/" />
                     <Route path="/" exact={true} component={Home} />
@@ -215,7 +200,6 @@ export default function App() {
                     <Route path="/ajuda" component={HelpCenter} />
                     <Route path="/contato" component={Contact} />
                     <Route path="/termos" component={UserTerms} />
-                    <Route path="/teste" component={Teste} />
                     <Route path="/sobre" component={AboutPage} />
                     <Route path="/mapa-site" component={SiteMap} />
                     <Route path="/acessibilidade" component={Accessibility} />
diff --git a/src/Components/AboutCarouselPartner.js b/src/Components/AboutCarouselPartner.js
index 910d2c72..ba4800d6 100644
--- a/src/Components/AboutCarouselPartner.js
+++ b/src/Components/AboutCarouselPartner.js
@@ -42,7 +42,7 @@ import { Telefonica } from "ImportImages.js";
 function AboutCarouselPartner(props) {
 
 
-  const itens = [
+  const items = [
     <a href="http://portaldoprofessor.mec.gov.br/index.html" rel="noreferrer" target="_blank">
       <img src={LogoPortalDoProfessor} alt="LogoPortalDoProfessor"/>
     </a>,
@@ -101,7 +101,7 @@ function AboutCarouselPartner(props) {
   var rows = []
   var partner_per_page = partnerPerPage()
   for(let i = 0; i < 15/partner_per_page; i++){
-    rows.push(itens.slice(i*partner_per_page, partner_per_page*(i+1)))
+    rows.push(items.slice(i*partner_per_page, partner_per_page*(i+1)))
   }
 
   return (
diff --git a/src/Components/Notifications.js b/src/Components/Notifications.js
index c8fbe2ae..854eb980 100644
--- a/src/Components/Notifications.js
+++ b/src/Components/Notifications.js
@@ -205,6 +205,7 @@ export default function Notification(props) {
                     {
                         notifications.map((notification) =>
                             (notification.viewed === false) &&
+                            (notification.recipient_type !== "NilClass") &&
                             <ActivityListItem
                                 onMenuBar={true}
                                 avatar={notification.owner.avatar ? apiDomain + notification.owner.avatar : null}
diff --git a/src/Components/TabPanels/UserPageTabs/PanelAtividades.js b/src/Components/TabPanels/UserPageTabs/PanelAtividades.js
index 2816f2fd..90b62680 100644
--- a/src/Components/TabPanels/UserPageTabs/PanelAtividades.js
+++ b/src/Components/TabPanels/UserPageTabs/PanelAtividades.js
@@ -188,6 +188,7 @@ export default function TabPanelAtividades(props) {
                                                             <List height={400} width={300}>
                                                                 {
                                                                     notifications.map((notification, id) =>
+                                                                    (notification.recipient_type !== "NilClass") &&
                                                                         <ActivityListItem
                                                                             key={id}
                                                                             onMenuBar={false}
diff --git a/src/Pages/ResourcePage.js b/src/Pages/ResourcePage.js
index 26a6e7f2..e4a6c80f 100644
--- a/src/Pages/ResourcePage.js
+++ b/src/Pages/ResourcePage.js
@@ -37,7 +37,6 @@ import ModalConfirmarCuradoria from "../Components/ModalConfirmarCuradoria";
 import { getRequest } from "../Components/HelperFunctions/getAxiosConfig";
 import Button from '@material-ui/core/Button';
 import { Link } from 'react-router-dom';
-//import {Helmet} from "react-helmet";
 
 //Image Import
 import { noAvatar } from "ImportImages.js";
@@ -178,19 +177,6 @@ export default function LearningObjectPage(props) {
             {snackbarText[snackbarIndex]}
           </Alert>
         </Snackbar>
-        {
-        //<Helmet>
-        //    <meta name="twitter:card" content="summary_large_image" />
-        //    <meta name="twitter:title" content={recurso.name} />
-        //    <meta name="twitter:image" content={recurso.thumbnail ? apiDomain + recurso.thumbnail : String(window.location.origin) + "/public/img/maskable_logo.png"} />
-        //    <meta name="twitter:description" content="Plataforma MEC de Recursos Educacionais Digitais." />   
-        //    <meta property="og:url" content={String(window.location.href)} />
-        //    <meta property="og:type" content="website" />
-        //    <meta property="og:title" content={recurso.name} />
-        //    <meta property="og:description" content="Plataforma MEC de Recursos Educacionais Digitais." />
-        //    <meta property="og:image" content={recurso.thumbnail ? apiDomain + recurso.thumbnail : String(window.location.origin) + "/public/img/maskable_logo.png"} />   
-        //</Helmet>
-        }
         <ModalAvaliarRecurso
           open={modalCuradoriaOpen}
           handleClose={() => {
diff --git a/src/Pages/Teste.js b/src/Pages/Teste.js
deleted file mode 100644
index 0652c42d..00000000
--- a/src/Pages/Teste.js
+++ /dev/null
@@ -1,135 +0,0 @@
-/*Copyright (C) 2019 Centro de Computacao Cientifica e Software Livre
-Departamento de Informatica - Universidade Federal do Parana
-
-This file is part of Plataforma Integrada MEC.
-
-Plataforma Integrada MEC is free software: you can redistribute it and/or modify
-it under the terms of the GNU Affero General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-Plataforma Integrada MEC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU Affero General Public License for more details.
-
-You should have received a copy of the GNU Affero General Public License
-along with Plataforma Integrada MEC.  If not, see <http://www.gnu.org/licenses/>.*/
-
-import React, { Component } from 'react'
-import Dropdown from 'react-dropdown'
-
-class ObjectArrayExample extends Component {
-  constructor (props) {
-    super(props)
-    this.state = {
-      selected: { value: 'two', label: 'Two'}
-    }
-    this._onSelect = this._onSelect.bind(this)
-  }
-
-  _onSelect (option) {
-    console.log('You selected ', option.label)
-    this.setState({selected: option})
-  }
-
-  render () {
-    const { toggleClassName, togglePlaholderClassName, toggleMenuClassName, toggleOptionsClassName } = this.state
-
-    const options = [
-      { value: 'one', label: 'One' },
-      { value: 'two', label: 'Two', className: toggleOptionsClassName && 'my-custom-class' },
-      {
-       type: 'group', name: 'group1', items: [
-         { value: 'three', label: 'Three', className: toggleOptionsClassName && 'my-custom-class' },
-         { value: 'four', label: 'Four' }
-       ]
-      },
-      {
-       type: 'group', name: 'group2', items: [
-         { value: 'five', label: 'Five' },
-         { value: 'six', label: 'Six' }
-       ]
-      }
-    ]
-
-
-    const defaultOption = this.state.selected
-    const placeHolderValue = typeof this.state.selected === 'string' ? this.state.selected : this.state.selected.label
-
-    return (
-      <section>
-        <h3>Object Array and Custom ClassNames Example </h3>
-        <div className="buttons">
-          <button onClick={() => this.setState({ toggleClassName: !toggleClassName })}>
-            Toggle dropdown custom class
-          </button>
-          <button onClick={() => this.setState({ togglePlaholderClassName: !togglePlaholderClassName })}>
-            Toggle placeholder custom class
-          </button>
-          <button onClick={() => this.setState({ toggleMenuClassName: !toggleMenuClassName })}>
-            Toggle menu custom class
-          </button>
-          <button onClick={() => this.setState({ toggleOptionsClassName: !toggleOptionsClassName })}>
-            Toggle options custom class
-          </button>
-        </div>
-        <Dropdown
-          options={options}
-          onChange={this._onSelect}
-          value={defaultOption}
-          placeholder="Select an option"
-          className={ toggleClassName ? 'my-custom-class' : '' }
-          placeholderClassName={ togglePlaholderClassName ? 'my-custom-class' : '' }
-          menuClassName={ toggleMenuClassName ? 'my-custom-class' : '' }
-        />
-        <div className='result'>
-          You selected
-          <strong> {placeHolderValue} </strong>
-        </div>
-        <section>
-          <h4>Options: </h4>
-          <div className='code'>
-            <pre>
-              {`
-const options = [
-  { value: 'one', label: 'One' },
-  { value: 'two', label: 'Two'${toggleOptionsClassName ? ', classNames \'my-custom-class\'' : ''} },
-  {
-    type: 'group', name: 'group1', items: [
-      { value: 'three', label: 'Three' },
-      { value: 'four', label: 'Four'${toggleOptionsClassName ? ', className: \'my-custom-class\'' : ''} }
-    ]
-  },
-  {
-    type: 'group', name: 'group2', items: [
-      { value: 'five', label: 'Five' },
-      { value: 'six', label: 'Six' }
-    ]
-  }
-]
-`}
-            </pre>
-          </div>
-          <h4>Usage with custom classeNames: </h4>
-          <div className='code'>
-            <pre>{
-`
-<Dropdown
-  options={options}
-  value={defaultOption}
-  placeholder="Select an option"
-  className=${ toggleClassName ? '"my-custom-class"' : '""' }
-  placeholderClassName=${ togglePlaholderClassName ? '"my-custom-class"' : '""' }
-  menuClassName=${ toggleMenuClassName ? '"my-custom-class"' : '""' }
-/>
-`}
-            </pre>
-          </div>
-        </section>
-      </section>
-    )
-  }
-}
-
-export default ObjectArrayExample
\ No newline at end of file
-- 
GitLab