Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed some bugs in tree and profile card #84

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
}
]
}
5 changes: 5 additions & 0 deletions backend/family_tree/node_modules/django/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 7 additions & 6 deletions frontend/family_tree/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ function App() {
}
});

const [details, setDetails] = useState({ name:"name", branch:"branch", year:"year", email:"email", picture:"picture", linkedIn:"", hometown:"", coCurriculars:"", socialMedia:"", display:true});
const [details, setDetails] = useState({ name:"IIT JODHPUR", branch:"FAMILY", year:"TREE", email:"email", picture:"picture", linkedIn:"", hometown:"", coCurriculars:"", socialMedia:"", display:false});
const [TreeData, setTreeData] = useState({});
const [clickedNode, setClickedNode] = useState("");

async function FetchPath(rollNo) {
const response = await client.query({
Expand All @@ -32,21 +33,21 @@ function App() {
}

useEffect(() => {
(FetchPath("Root"))
.then(value => {setTreeData(value);})
, [TreeData]})
(FetchPath("Root")).then(value => {setTreeData(value);})
},[TreeData])

return (
<ThemeProvider theme={theme}>
<div className="App">
<SearchBar placeholder="Enter the Name or Roll Number..." />
<SearchBar placeholder="Enter the Name or Roll Number..." setClickedNode={setClickedNode}/>
<div className="help">
<Help />
</div>
{TreeData[0] &&
<D3Tree
TreeData = {TreeData}
setDetails = {setDetails}
clickedNode = {clickedNode}
/>}

<PCard
Expand All @@ -58,7 +59,7 @@ function App() {
linkedIn={details.linkedIn}
hometown={details.hometown}
coCurriculars={details.coCurriculars}
socialMedia={details.socialMedia}
// socialMedia={details.socialMedia}
display= {details.display}
/>
</div>
Expand Down
17 changes: 10 additions & 7 deletions frontend/family_tree/src/Components/ProfileCard.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from "react";
import React, { useEffect } from "react";
import {
Typography,
Card,
Expand Down Expand Up @@ -43,15 +43,18 @@ const useStyles = makeStyles((theme) => ({

function PCard(props) {
const classes = useStyles();
const [isVisible, setisVisible] = React.useState(props.display?true:false);
const toggle = () => setisVisible(!isVisible);
const [isVisible, setisVisible] = React.useState(false);
useEffect(()=>{
setisVisible(true);
},[props.display])

return (
<React.Fragment>
{ isVisible && (
<Card className={classes.root} variant="outlined" >
<Box sx={{ display: "flex", justifyContent: "right" }}>
<CardActions>
<IconButton aria-label="close" onClick={toggle} >
<IconButton aria-label="close" onClick={() => {setisVisible(false);}} >
<CloseOutlinedIcon />
</IconButton>
</CardActions>
Expand Down Expand Up @@ -113,7 +116,7 @@ function PCard(props) {
<Divider variant="middle" />
<br />
<Box sx={{ color: "#2a4158" ,textAlign:"center"}}>
{props.coCurriculars.map((item) => (
{props.coCurriculars.split(",").map((item) => (
<Typography variant="body2" key={item} gutterBottom>
{item}
</Typography>
Expand All @@ -130,7 +133,7 @@ function PCard(props) {
flexWrap: "wrap"
}}
>
<CardActions>
{/* <CardActions>
{props.email && (
<IconButton
className={classes.socialMediaButton}
Expand Down Expand Up @@ -200,7 +203,7 @@ function PCard(props) {
<TwitterIcon color="primary" />
</IconButton>
)}
</CardActions>
</CardActions> */}
</Box>
</Card>
)}
Expand Down
8 changes: 6 additions & 2 deletions frontend/family_tree/src/Components/SearchBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import CloseIcon from "@material-ui/icons/Close";
import {client} from "../index.js";
import {SEARCH_QUERY} from "../Queries.js";

function SearchBar({ placeholder}) {
function SearchBar({ placeholder, setClickedNode}) {
const [wordEntered, setWordEntered] = useState("");
const [retrievedData, setRetrievedData] = useState([]);

Expand Down Expand Up @@ -34,6 +34,10 @@ function SearchBar({ placeholder}) {
setWordEntered("");
};

var getRollNo = (e) => {
setClickedNode(e.target.innerHTML.slice(-10,-2));
}

return (
<div className="search">
<div className="searchInputs">
Expand All @@ -55,7 +59,7 @@ function SearchBar({ placeholder}) {
<div className="dataResult">
{retrievedData.slice(0, 5).map((value) => {
return (
<p className="dataItem" >{`${value.name} (${value.rollNo})`} </p>
<p className="dataItem" onClick={getRollNo}>{`${value.name} (${value.rollNo})`} </p>
);
})}
</div>
Expand Down
Loading