Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PortalMEC-React
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PortalMEC
PortalMEC-React
Commits
c329845f
Commit
c329845f
authored
4 years ago
by
mrp19
Browse files
Options
Downloads
Patches
Plain Diff
remove search helper page
parent
beeaf7d0
No related branches found
No related tags found
4 merge requests
!57
Merge of develop into master
,
!56
Fixed buttons reportar, seguir, compartilhar, guardar and entrar (in comments...
,
!39
Update admin system
,
!32
Homologa
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Pages/SearchOld.js
+0
-94
0 additions, 94 deletions
src/Pages/SearchOld.js
with
0 additions
and
94 deletions
src/Pages/SearchOld.js
deleted
100644 → 0
+
0
−
94
View file @
beeaf7d0
/*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
,
{
useEffect
,
useState
,
useContext
}
from
'
react
'
;
import
axios
from
'
axios
'
;
// import ResourceCard from '../Components/ResourceCard'
// import CollectionCard from '../Components/CollectionCard'
// import UserCard from '../Components/UserCard'
import
{
apiUrl
}
from
'
../env
'
;
import
'
./Styles/Home.css
'
;
import
{
Store
}
from
'
../Store
'
;
export
default
function
Search
(
props
){
const
{
state
,
dispatch
}
=
useContext
(
Store
)
const
[
results
,
setResults
]
=
useState
([])
const
[
page
,
]
=
useState
(
0
)
const
[
resultsPerPage
,
]
=
useState
(
12
)
const
[
order
,
]
=
useState
(
'
score
'
)
useEffect
(()
=>
{
dispatch
({
type
:
'
HANDLE_SEARCH_BAR
'
,
opened
:
true
})
const
urlParams
=
new
URLSearchParams
(
window
.
location
.
search
)
const
query
=
urlParams
.
get
(
'
query
'
)
const
searchClass
=
urlParams
.
get
(
'
search_class
'
)
if
(
state
.
search
.
query
!==
query
||
state
.
search
.
class
!==
searchClass
){
dispatch
({
type
:
'
SAVE_SEARCH
'
,
newSearch
:
{
query
:
query
,
class
:
searchClass
}
})
}
return
()
=>
dispatch
({
type
:
'
HANDLE_SEARCH_BAR
'
,
opened
:
false
})
},[])
useEffect
(()
=>
{
axios
.
get
(
`
${
apiUrl
}
/search?page=
${
page
}
&results_per_page=
${
resultsPerPage
}
&order=
${
order
}
&query=
${
state
.
search
.
query
}
&search_class=
${
state
.
search
.
class
}
`
)
.
then
(
res
=>
{
setResults
(
res
.
data
)
})
},[
state
.
search
])
return
(
<
React
.
Fragment
>
<
h1
>
Search
for
{
state
.
search
.
query
!==
'
*
'
?
state
.
search
.
query
:
'
all
'
}
in
{
state
.
search
.
class
}
<
/h1
>
{
state
.
search
.
class
=== '
LearningObject
'
&&
<ul>
{results.map((res)=><li key={res.id}> {res.name} </li>)}
</ul>
}
{state.search.class ===
'
Collection
'
&&
<ul>
{results.map((res)=><li key={res.id}> {res.name} </li>)}
</ul>
}
{state.search.class ===
'
User
'
&&
<ul>
{results.map((res)=><li key={res.id}> {res.name} </li>)}
</ul>
}
</React.Fragment>
)
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment