diff --git a/README.md b/README.md index 6a0009d..77b9cb2 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,41 @@ -# github-graphs +# Github-Graphs + Website for visualizing a persons github network. +![Example Graph](./doc/graphExample.png) + +If you are lucky, you can find the site live +[here](https://github-graphs.com/); + # Built With + - [BootStrap](https://getbootstrap.com/) CSS Framework - [jQuery](https://jquery.com/) - [Vis JS](http://visjs.org/) -- [Github v3 API](https://developer.github.com/v3/) \ No newline at end of file +- [Github v3 API](https://developer.github.com/v3/) +- [Node.js](https://nodejs.org/en/) + + +![javascript](./doc/javaScript.jpg) + +# Running + +Update your conf.json file to contain your preferred port and github +api credentials. + +```bash +npm install +``` + +```bash +node server.js +``` + + +# Contributing + +If you want to contribute to this project and don't know where to start, +look at the open issues. Once you know what you want to work on, +just discuss it in the issues and file a pull request. We are very open +to new contributes. \ No newline at end of file diff --git a/doc/graphExample.png b/doc/graphExample.png new file mode 100644 index 0000000..1245354 Binary files /dev/null and b/doc/graphExample.png differ diff --git a/doc/javaScript.jpg b/doc/javaScript.jpg new file mode 100644 index 0000000..3db457e Binary files /dev/null and b/doc/javaScript.jpg differ diff --git a/public/404.html b/public/404.html index 9b0e616..34dfde3 100644 --- a/public/404.html +++ b/public/404.html @@ -1,4 +1,4 @@ - + @@ -10,28 +10,30 @@
- +
- +
diff --git a/public/FriendsGraph.html b/public/FriendsGraph.html index 9115b43..e1b0db9 100644 --- a/public/FriendsGraph.html +++ b/public/FriendsGraph.html @@ -15,7 +15,7 @@ - + @@ -30,7 +30,7 @@
-
+
@@ -73,15 +73,26 @@ \ No newline at end of file diff --git a/public/TimeLineGraph.html b/public/TimeLineGraph.html new file mode 100644 index 0000000..9c70585 --- /dev/null +++ b/public/TimeLineGraph.html @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+ +
+
+

+
+

+        
+
+
+
+
+ + + + + \ No newline at end of file diff --git a/public/about.css b/public/about.css index 9a537e0..60bf34f 100644 --- a/public/about.css +++ b/public/about.css @@ -20,6 +20,12 @@ position: relative; padding-top: 20px; } +.card { + background-color: rgb(208, 208, 208); +} +.card-body { + background-color: rgb(242, 242, 242); +} .rounder { border-radius: 20px !important; } @@ -29,6 +35,20 @@ position: relative; width: 70%; } +.links { + padding: 10px; +} +.links a { + text-decoration: none; +} +.link-ico { + width: 40px; +} .plink { color: rgb(250, 152, 33); +} +@media (max-width: 767px) { + #content-title { + height: 40px; + } } \ No newline at end of file diff --git a/public/about.html b/public/about.html index cfcaea9..514bb34 100644 --- a/public/about.html +++ b/public/about.html @@ -3,6 +3,7 @@ + GitHub Graphs @@ -13,28 +14,30 @@
@@ -51,7 +54,7 @@

- This project was made for participation in BrickHack V. + This project was completed in 24 hours for participation in BrickHack V at the Rochester Institute of Technology.

@@ -68,6 +71,23 @@ did stuff

+
@@ -79,6 +99,23 @@ also did stuff

+
@@ -90,6 +127,23 @@ kinda did stuff

+
diff --git a/public/img/email.png b/public/img/email.png new file mode 100644 index 0000000..9a51d0f Binary files /dev/null and b/public/img/email.png differ diff --git a/public/img/github.png b/public/img/github.png new file mode 100644 index 0000000..9490ffc Binary files /dev/null and b/public/img/github.png differ diff --git a/public/img/graphExample.png b/public/img/graphExample.png index 1245354..b817384 100644 Binary files a/public/img/graphExample.png and b/public/img/graphExample.png differ diff --git a/public/img/linkedin.png b/public/img/linkedin.png new file mode 100644 index 0000000..2dfaaca Binary files /dev/null and b/public/img/linkedin.png differ diff --git a/public/index.html b/public/index.html index 472de73..0e8271e 100644 --- a/public/index.html +++ b/public/index.html @@ -12,42 +12,48 @@
- +
- +
-
-
-
-
+
+
+
+

How to get started:

-

- Head over to the 'Generate graphs' page and enter the username of the user you want to generate your graph around. +

+ Head over to the 'Generate graphs' page and enter + the username of a GitHub user. The space on that + page will then populate with the requested GitHub + user and all the related user, visualizing the + connections between them.

- +
diff --git a/public/js/friendsGraph.js b/public/js/friendsGraph.js index fe10394..b41c876 100644 --- a/public/js/friendsGraph.js +++ b/public/js/friendsGraph.js @@ -193,7 +193,8 @@ function createConnections() resolve(); }).catch(function(error) { - reject(error); + console.log(error); + resolve(); }); }); } @@ -246,6 +247,7 @@ function createFriendsGraph(username, containerName, graphsTitle) edges = []; addSelfToGraph(username).then(function() { + console.log("added self"); addFriends(username, API_FOLLOWERS).then(function() { addFriends(username, API_FOLLOWING).then(function() @@ -260,9 +262,9 @@ function createFriendsGraph(username, containerName, graphsTitle) }; var network = new vis.Network(container, data, options); - network.on("click", function (params) { + network.on("click", function (params) + { params.event = "[original event]"; - document.getElementById('eventSpan').innerHTML = '

Click event:

' + JSON.stringify(params, null, 4); if(Number(this.getNodeAt(params.pointer.DOM)) !== NaN) { bringUpProfileView(Number(this.getNodeAt(params.pointer.DOM))); @@ -273,7 +275,7 @@ function createFriendsGraph(username, containerName, graphsTitle) }) }).catch(function(error) { - console.log(error); $("#" + graphsTitle).html("Error Fetching Data From API"); + alert("Invalid User"); }); } \ No newline at end of file diff --git a/public/js/githubAPI.js b/public/js/githubAPI.js index 7aab59d..d2dc060 100644 --- a/public/js/githubAPI.js +++ b/public/js/githubAPI.js @@ -38,6 +38,7 @@ function queryAPIByUser(apiPath, user, successCallBack, errorCallBack) { crossDomain: true, dataType: "json", success: successCallBack, - error:errorCallBack + error:errorCallBack, + timeout: 1500 }); } \ No newline at end of file diff --git a/public/js/profileTimeLine.js b/public/js/profileTimeLine.js new file mode 100644 index 0000000..477e516 --- /dev/null +++ b/public/js/profileTimeLine.js @@ -0,0 +1,57 @@ +var events = []; + +// {id: 0, group: 0, start: new Date(2013,7,1), end: new Date(2017,5,15), content: 'High School'}, +function addRepositories(userName, groupID) +{ + return new Promise(function(resolve, reject) + { + + }) +} + + +function addOrgs(userName, groupID) +{ + return new Promise(function(resolve, reject) + { + + }) +} + + +function createProfileTimeLine(username, containerName) +{ + var container = document.getElementById(containerName); + + + var prom = [addRepositories(username, 1), addOrgs(username, 1)]; + + var groups = new vis.DataSet([ + {id: 0, content: 'Organizations', value: 1}, + {id: 1, content: 'Repositories', value: 2} + ]); + + Promise.all(prom).then(function() + { + // note that months are zero-based in the JavaScript Date object + var items = new vis.DataSet(events); + var options = { + // option groupOrder can be a property name or a sort function + // the sort function must compare two groups and return a value + // > 0 when a > b + // < 0 when a < b + // 0 when a == b + groupOrder: function (a, b) { + return a.value - b.value; + }, + margin: { + item: 20, + axis: 40 + } + }; + var timeline = new vis.Timeline(container); + timeline.setOptions(options); + timeline.setGroups(groups); + timeline.setItems(items); + }); +} \ No newline at end of file diff --git a/public/js/utilities.js b/public/js/utilities.js new file mode 100644 index 0000000..99bb2b8 --- /dev/null +++ b/public/js/utilities.js @@ -0,0 +1,11 @@ +function findGetParameter(parameterName) +{ + var result = null, + tmp = []; + var items = location.search.substr(1).split("&"); + for (var index = 0; index < items.length; index++) { + tmp = items[index].split("="); + if (tmp[0] === parameterName) result = decodeURIComponent(tmp[1]); + } + return result; +} \ No newline at end of file diff --git a/public/style.css b/public/style.css index 630de8f..f640648 100644 --- a/public/style.css +++ b/public/style.css @@ -19,7 +19,6 @@ background-color: rgb(208, 208, 208); } #header-title { - width: 30%; font-size: 25px; } #logo { @@ -31,36 +30,25 @@ color: rgb(208, 208, 208); } #navigation { - width: 70%; - padding-right: 20px !important; -} -.error { - color: rgb(208, 208, 208); + position: absolute; + right: 20px; } #dcimg { width: 300px; } +.error { + color: rgb(208, 208, 208); +} .big-title { font-family: Comfortaa; font-weight: bold; font-size: 60px; - text-wrap: avoid; } .m-title { font-family: Comfortaa; font-weight: normal; font-size: 150%; } -.text-title { - height: 60px; - background-color: rgb(208, 208, 208); - border-radius: 20px 0px 0px 0px; -} -.text-content { - height: 335px; - background-color: rgb(242, 242, 242); - border-radius: 0px 0px 0px 20px; -} .nav-sep { position: relative; left: 10px; @@ -81,16 +69,31 @@ color: rgb(250, 152, 33); text-decoration: none; } +.home-content { + padding: 20px; + max-height: 40px; +} .side-img { - display: grid; + display: block; position: relative; width: 50%; - border-radius: 0px 20px 20px 0px; + height: 100%; + max-height: 500px; + max-width: 500px; } .side-txt { - display: grid; + display: block; position: relative; width: 50%; + max-width: 500px; +} +.text-title { + background-color: rgb(208, 208, 208); + border-radius: 20px 20px 0px 0px; +} +.text-content { + background-color: rgb(242, 242, 242); + border-radius: 0px 0px 20px 20px; } .main { position: relative; @@ -98,4 +101,35 @@ } body { background-color: #232323; +} +@media (max-width: 767px) { + .big-title { + font-size: 30px; + } + .side-img { + display: none; + } + #navigation { + position: absolute; + top: 50px; + left: 50%; + transform: translate(-50%, 0%); + width: 400px + } + .nav-item { + font-size: 19px; + } + #header-bar { + height: 100px; + } + #header-title { + left: 0px; + width: 20%; + } + #logo { + position: absolute; + left: 50%; + transform: translate(-50%, 0%); + height: 60px; + } } \ No newline at end of file diff --git a/routes/api.js b/routes/api.js index 418652c..ab26aea 100644 --- a/routes/api.js +++ b/routes/api.js @@ -33,8 +33,10 @@ function queryGitHubAPI(requestURL) cache.put(requestURL, response.body); }).catch(error => { - resolve(response.body); - cache.put(requestURL, response.body); + // resolve(response.body); + // cache.put(requestURL, response.body); + console.log(error); + reject(error); }); }