Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
bdnr
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
Nicolas Fripp Rodriguez
bdnr
Commits
687f9ff1
Commit
687f9ff1
authored
1 year ago
by
nico20
Browse files
Options
Downloads
Patches
Plain Diff
compas altos
parent
d9fdb0cc
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
ui/src/components/CompasZurdos.tsx
+19
-41
19 additions, 41 deletions
ui/src/components/CompasZurdos.tsx
ui/src/index.tsx
+8
-8
8 additions, 8 deletions
ui/src/index.tsx
with
27 additions
and
49 deletions
ui/src/components/CompasZurdos.tsx
+
19
−
41
View file @
687f9ff1
import
{
Autocomplete
,
Button
,
TextField
}
from
"
@mui/material
"
;
import
{
Autocomplete
,
Button
,
Stack
,
TextField
}
from
"
@mui/material
"
;
import
{
CategoryScale
,
Chart
as
ChartJS
,
Legend
,
LineElement
,
LinearScale
,
PointElement
,
Title
,
Tooltip
,
}
from
"
chart.js
"
;
import
{
useState
}
from
"
react
"
;
import
{
useState
}
from
"
react
"
;
import
{
Line
}
from
"
react-chartjs-2
"
;
import
{
useLazyReadCypher
,
useReadCypher
}
from
"
use-neo4j
"
;
import
{
useLazyReadCypher
,
useReadCypher
}
from
"
use-neo4j
"
;
const
CompasZurdos
=
()
=>
{
const
CompasZurdos
=
()
=>
{
const
query
=
`MATCH (p:Player {gender: "Female"}) RETURN p LIMIT 100`
;
const
queryString
=
`MATCH (p:Player {gender: "Male"}) RETURN p LIMIT 100`
;
const
queryValoracionString
=
`MATCH (p1:Player {long_name: $playerName})-[:PLAYED_WITH]-(p2:Player {preferred_foot: 'Left'})
const
queryJugadoresQueJugaronConJugadorYSonMasAltosQueEl
=
`MATCH (p1:Player {long_name: $playerName})-[:FIFA_17 | :FIFA_18 | :FIFA_19 | :FIFA_20 | :FIFA_21 | :FIFA_22]->(e:Statistics)-[:PLAY_FOR_CLUB]->(cl:Clubs)<-[:PLAY_FOR_CLUB]-(e2:Statistics)<-[:FIFA_17 | :FIFA_18 | :FIFA_19 | :FIFA_20 | :FIFA_21 | :FIFA_22]-(p2:Player) where p2.height_cm > p1.height_cm and p1 <> p2 RETURN p2, COUNT(DISTINCT p2) AS cantidad_jugadores_distintos`
;
RETURN COUNT(DISTINCT p2) AS numberOfPlayers
MATCH (p)-[:FIFA_17]->(e2017:Statistics)
MATCH (p)-[:FIFA_18]->(e2018:Statistics)
MATCH (p)-[:FIFA_19]->(e2019:Statistics)
MATCH (p)-[:FIFA_20]->(e2020:Statistics)
MATCH (p)-[:FIFA_21]->(e2021:Statistics)
MATCH (p)-[:FIFA_22]->(e2022:Statistics)
RETURN e2017, e2018, e2019, e2020, e2021, e2022`
;
const
[
player
,
setPlayer
]
=
useState
(
""
);
const
[
player
,
setPlayer
]
=
useState
(
""
);
const
[
query
Valoracion
,
queryValoracion
State
]
=
useLazyReadCypher
(
const
[
query
Search
,
querySearch
State
]
=
useLazyReadCypher
(
query
ValoracionString
query
JugadoresQueJugaronConJugadorYSonMasAltosQueEl
);
);
const
{
loading
,
records
,
result
}
=
useReadCypher
(
query
);
const
{
loading
,
records
,
result
}
=
useReadCypher
(
query
String
);
if
(
loading
)
return
<
div
>
Loading...
</
div
>;
if
(
loading
)
return
<
div
>
Loading...
</
div
>;
const
players
=
records
?.
map
((
record
)
=>
record
.
get
(
"
p
"
));
const
players
=
records
?.
map
((
record
)
=>
record
.
get
(
"
p
"
));
ChartJS
.
register
(
CategoryScale
,
LinearScale
,
PointElement
,
LineElement
,
Title
,
Tooltip
,
Legend
);
const
handleSearch
=
()
=>
{
const
handleSearch
=
()
=>
{
query
Valoracion
({
playerName
:
player
});
query
Search
({
playerName
:
player
});
};
};
return
(
return
(
<>
<>
<
h2
>
Cantidad de compañer
as zurdas
</
h2
>
<
h2
>
Cantidad de compañer
os mas altos que jugador
</
h2
>
<
Autocomplete
<
Autocomplete
disablePortal
disablePortal
id
=
"combo-box-demo"
id
=
"combo-box-demo"
...
@@ -64,13 +35,20 @@ const CompasZurdos = () => {
...
@@ -64,13 +35,20 @@ const CompasZurdos = () => {
sx
=
{
{
marginTop
:
"
1rem
"
}
}
sx
=
{
{
marginTop
:
"
1rem
"
}
}
variant
=
"contained"
variant
=
"contained"
onClick
=
{
handleSearch
}
onClick
=
{
handleSearch
}
disabled
=
{
!
player
||
query
Valoracion
State
.
loading
}
disabled
=
{
!
player
||
query
Search
State
.
loading
}
>
>
Buscar
Buscar
</
Button
>
</
Button
>
{
queryValoracionState
.
result
&&
(
{
querySearchState
.
result
&&
<
p
>
Number of Left-footed Players:
{
queryValoracionState
.
result
.
records
[
0
].
get
(
"
numberOfPlayers
"
)
}
</
p
>
querySearchState
.
result
.
records
.
map
((
record
)
=>
{
)
}
const
player
=
record
.
get
(
"
p2
"
);
return
(
<
Stack
flexDirection
=
"row"
>
<
p
>
{
player
.
properties
.
long_name
}
:
</
p
>
<
p
>
{
player
.
properties
.
height_cm
.
toString
()
}
</
p
>
</
Stack
>
);
})
}
</>
</>
);
);
};
};
...
...
This diff is collapsed.
Click to expand it.
ui/src/index.tsx
+
8
−
8
View file @
687f9ff1
...
@@ -10,15 +10,15 @@ const root = ReactDOM.createRoot(
...
@@ -10,15 +10,15 @@ const root = ReactDOM.createRoot(
document
.
getElementById
(
"
root
"
)
as
HTMLElement
document
.
getElementById
(
"
root
"
)
as
HTMLElement
);
);
// Este es para conectarse con aura
// Este es para conectarse con aura
const
driver
=
createDriver
(
//
const driver = createDriver(
"
neo4j+s
"
,
//
"neo4j+s",
"
28fbdf37.databases.neo4j.io
"
,
//
"28fbdf37.databases.neo4j.io",
"
7687
"
,
//
"7687",
"
neo4j
"
,
//
"neo4j",
"
0zk61H06n1WT-zr8BW7iOyggB5cme-YQgt_ofieMXlw
"
//
"0zk61H06n1WT-zr8BW7iOyggB5cme-YQgt_ofieMXlw"
);
//
);
//
const driver = createDriver("bolt", "localhost", "7687", "neo4j", "nicomarti");
const
driver
=
createDriver
(
"
bolt
"
,
"
localhost
"
,
"
7687
"
,
"
neo4j
"
,
"
nicomarti
"
);
root
.
render
(
root
.
render
(
<
React
.
StrictMode
>
<
React
.
StrictMode
>
...
...
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