From 4c080d63a6a5c54ef246e0fa02b47ebcd0fcd6a8 Mon Sep 17 00:00:00 2001 From: Saugat Acharya Date: Fri, 16 Jun 2017 05:05:27 +0545 Subject: [PATCH] UI and other changes (#1) * Use bootstrap-v4 * Add favicon * Change showError to showMsg * Make it bookmarkable * Few changes * Show spinner while loading * Hide spinner by default --- favicon.ico | Bin 0 -> 370070 bytes index.html | 61 +++++++++++++++-------- js/main.js | 136 ++++++++++++++++++++++++++++++++++++++-------------- 3 files changed, 143 insertions(+), 54 deletions(-) create mode 100644 favicon.ico diff --git a/favicon.ico b/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..58816493781ae6184e498ba8525bc23be905837f GIT binary patch literal 370070 zcmeHQ2bk?txjh#yT>7Ob9S13bQlu(Hooj!BfSoEL2r3|;;1lZ%f`APvPn3s95fl*> z8wi39pnwz+!HUQL`T%Jc5E$Tc=dG1<_RKz+Bq!NP_DOQq|9xw6lHLA){rlfZc6KtY z)~wdzEy}Fc+N}-Op4~bCzn5RWz5jvPt=0)Rw%KOw{qxsvwVqsWc5CgmJNwA@%^ha9 zMn^m4mzdRh!=AHS^X7H-U(;$GvfpB@4N)f=Xtfq;ALnkXHM_Oa(yajPef<>!Vn7Ut z0Wly3#DEwO17bi7hygJm2E>3E5CdXB42S_SAO^&M7!U(uKn#chF(3xSfEW-1Vn7Ut z0Wly3#DEwO17bi7hygJm2E>3E5CdXB42S_SAO^&M7!U(uKn#chF(3xSfEW-1Vn7Ut z0Wly3#6aa4;1`wF1KtLF3^)Zi5BMSQW8gyI4B$B6{lGA=93T+`VxXQ3Fn;$0z6(46 zOlHJF9@q-t7$Ok^VxZa#Yz*~yE`I{Z8uLl{|AhJu1eO9MVn7U3i-C2a&ILeH z3>T4hAKEwwz!zU7Vn7V^nSsU7{-=Sbfg<8NZ5_9uy{!R>7!U*fVc>;m_Ie;~%od$* z0owjJfUmVn#DEy^$N>IhLhE6m=$Lk??;_}d|Ii>217g4f1G}M(X91U3EvpQ#Lss%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=K$N*@b3l4o8=m)E1^jvXB~^I52fD?916S_;B}zy^AehrhygJm2GTLm`&$K9cCvInez36fxr+sz z&pepz#0%P=t(bUK%y!N8ag*O{O?{K*;|ilA?FMIThdakRpT`*OeEcE!Dh859J0Bhy z?R>Cf6lWv~w!@w6P_XTM!DMuzU0`&w{RNWI$+6&b5u=ms&jgK5PIUI$p9LD7Y<~`@ z_jW;G3d&DysQ~KThTGQ2{7(%{PQvbB3m&?*6Kl>5@`1+*DsF9qddV{_H~g9H3?9dj Hski(;CP;7g literal 0 HcmV?d00001 diff --git a/index.html b/index.html index 8ac52b6..1f19556 100644 --- a/index.html +++ b/index.html @@ -1,36 +1,59 @@ - Find Active Github Forks - + + Active GitHub Forks + + + + + + + +
-
-
-
-

Find Active Github Forks

+
+
+
+

+ + + + Active GitHub Forks +

-
-
-
- - - - -
-
- -
+
+
+
+
+ + + + +
+
+ +
+
-
-
diff --git a/js/main.js b/js/main.js index f379e7d..9f76e33 100644 --- a/js/main.js +++ b/js/main.js @@ -1,44 +1,85 @@ +window.addEventListener('load', () => { + const repo = getQueryParams().q; + if (repo) { + document.getElementById('q').value = repo; + fetchData(); + } +}); + document.getElementById('form').addEventListener('submit', (e) => { - e.preventDefault() - fetchData() -}) + e.preventDefault(); + fetchData(); +}); function fetchData() { - const repo = document.getElementById('repo').value - const re = /[-_\w]+\/[-_.\w]+/ + const repo = document.getElementById('q').value; + const re = /[-_\w]+\/[-_.\w]+/; + + window.history.pushState('', '', `?q=${repo}`); if (re.test(repo)) { - fetchAndShow(repo) + fetchAndShow(repo); } else { - showError('Invalid github repo given. Format is /') + showMsg('Invalid GitHub repository! Format is <username>/<repo>', 'danger'); } } function fetchAndShow(repo) { + document.getElementById('find').disabled = true; + document.getElementById('spinner').removeAttribute('hidden'); + fetch(`https://api.github.com/repos/${repo}/forks?sort=stargazers`) - .then(function(response) { - response.json() - .then(function(data) { - showData(data) - }) - }) + .then((response) => response.json()) + .then((data) => { + showData(data); + + document.getElementById('find').disabled = false; + document.getElementById('spinner').setAttribute('hidden', 'hidden'); + }); } -function showError(msg) { - document.getElementById('data-body').innerHTML = `
${msg}
` +function showMsg(msg, type) { + let alert_type = 'alert-info'; + + if (type === 'danger') { + alert_type = 'alert-danger'; + } + + document.getElementById('footer').innerHTML = ''; + + document.getElementById('data-body').innerHTML = ` + + `; } function showData(data) { if (!Array.isArray(data)) { - showError('Github Repo does not exist') - return + showMsg('GitHub repository does not exist', 'danger'); + return; } + if (data.length === 0) { - document.getElementById('data-body').innerHTML = `
No forks exist
` - return + showMsg('No forks exist!'); + return; } - const thead = 'RepositoryStargazersForksLast Update' - const html = [] + + const html = []; + const thead = ` + + + Repository + Stargazers + Forks + Last Update + + + `; + for (const fork of data) { const item = ` @@ -47,41 +88,66 @@ function showData(data) { ${fork.forks_count} ${timeSince(fork.updated_at)} ago - ` - html.push(item) + `; + html.push(item); } + document.getElementById('data-body').innerHTML = ` - - ${thead} - ${html.join('')} -
- ` +
+ + ${thead} + ${html.join('')} +
+
+ `; + + document.getElementById('footer').innerHTML = `${data.length} ${data.length == 1 ? 'result' : 'results'}`; +} + +function getQueryParams() { + let query = location.search; + if (!query) { + return { }; + } + + return (/^[?#]/.test(query) ? query.slice(1) : query) + .split('&') + .reduce((params, param) => { + let [ key, value ] = param.split('='); + params[key] = value ? decodeURIComponent(value.replace(/\+/g, ' ')) : ''; + return params; + }, { }); } function timeSince(date_str) { - const date = new Date(date_str) + const date = new Date(date_str); const seconds = Math.floor((new Date() - date) / 1000); let interval = Math.floor(seconds / 31536000); if (interval > 1) { - return interval + " years"; + return interval + ' years'; } + interval = Math.floor(seconds / 2592000); if (interval > 1) { - return interval + " months"; + return interval + ' months'; } + interval = Math.floor(seconds / 86400); if (interval > 1) { - return interval + " days"; + return interval + ' days'; } + interval = Math.floor(seconds / 3600); if (interval > 1) { - return interval + " hours"; + return interval + ' hours'; } + interval = Math.floor(seconds / 60); if (interval > 1) { - return interval + " minutes"; + return interval + ' minutes'; } - return Math.floor(seconds) + " seconds"; + + return Math.floor(seconds) + ' seconds'; }