Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/iampavangandhi/TradeByte
Browse files Browse the repository at this point in the history
…into fix_Cart/iampavangandhi#29
  • Loading branch information
fabcodingzest committed Aug 18, 2020
2 parents e105ea1 + 1d055bf commit 4b97491
Show file tree
Hide file tree
Showing 9 changed files with 344 additions and 118 deletions.
16 changes: 0 additions & 16 deletions config/data-total.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
[
{
"Company Name": "iShares MSCI All Country Asia Information Technology Index Fund",
"Symbol": "AAIT"
},
{
"Company Name": "American Airlines Group, Inc.",
"Symbol": "AAL"
Expand Down Expand Up @@ -31,10 +27,6 @@
"Company Name": "Atlas Air Worldwide Holdings",
"Symbol": "AAWW"
},
{
"Company Name": "iShares MSCI All Country Asia ex Japan Index Fund",
"Symbol": "AAXJ"
},
{
"Company Name": "Aoxin Tianli Group, Inc.",
"Symbol": "ABAC"
Expand Down Expand Up @@ -167,14 +159,6 @@
"Company Name": "Acura Pharmaceuticals, Inc.",
"Symbol": "ACUR"
},
{
"Company Name": "iShares MSCI ACWI Index Fund",
"Symbol": "ACWI"
},
{
"Company Name": "iShares MSCI ACWI ex US Index Fund",
"Symbol": "ACWX"
},
{
"Company Name": "Acxiom Corporation",
"Symbol": "ACXM"
Expand Down
5 changes: 5 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"mongoose": "^5.9.25",
"mongoose-float": "^1.0.4",
"morgan": "^1.10.0",
"nodemailer": "^6.4.11",
"npm": "^6.14.7",
"passport": "^0.4.1",
"passport-google-oauth20": "^2.0.0",
Expand Down
9 changes: 6 additions & 3 deletions routes/api/done.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ const { ensureAuth, ensureGuest } = require("../../middleware/auth");
// @desc Done page
// @route GET /done
// @access Private
router.get("/", ensureGuest, (req, res) => {
res.status(200).render("done");
router.get("/", ensureAuth, (req, res) => {
res.status(200)
.render("done");
});

module.exports = router;


module.exports = router;
58 changes: 38 additions & 20 deletions routes/api/market.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,10 @@

const express = require("express");
const router = express.Router();
const alpha = require("alphavantage")({ key: process.env.ALPHA_VANTAGE_KEY });

var jsonData = [];
const jsonData1 = require("../../config/data-compact.json");
const jsonData2 = require("../../config/data-total.json");
const { ensureAuth, ensureGuest } = require("../../middleware/auth");

const dataCnt1 = jsonData1.length;
const dataCnt2 = jsonData2.length;
const dataLast1 = dataCnt1 + 1;
const dataStart2 = dataCnt1 + 1;

jsonData.push({ data1: dataCnt1, data2: dataCnt2, dataLast1: dataLast1, dataStart2: dataStart2 })
for (var i = 0; i < dataCnt1; i++) {
jsonData.push(jsonData1[i]);
};
for (var i = 0; i < dataCnt2; i++) {
jsonData.push(jsonData2[i]);
};
const compactData = require("../../config/data-compact.json");
const totalData = require("../../config/data-total.json");

// TODO
// Implement Stocks Search
Expand All @@ -29,9 +14,42 @@ for (var i = 0; i < dataCnt2; i++) {
// @desc Market page
// @route GET /Market
// @access Privat
router.get("/", ensureAuth, async(req, res) => {
res.status(200).render("market", { layout: "layouts/app", jsonData, href: '/market', avatar: req.user.image });
router.get("/", ensureAuth, async (req, res) => {
let min = 0;
let max = 75;

res.status(200).render("market", {
layout: "layouts/app",
compactData,
totalData,
min,
max,
href: "/market",
avatar: req.user.image,
});
});

// @desc Market page
// @route GET /Market/:page
// @access Private
router.get("/:page", ensureAuth, async (req, res) => {
let page = req.params.page - 1;
let min = page * 75;
let max = page * 75 + 75;

if (page <= 0 || page >= 39) {
res.status(200).redirect("/market");
} else {
res.status(200).render("market", {
layout: "layouts/app",
compactData,
totalData,
min,
max,
href: "/market",
avatar: req.user.image,
});
}
});

module.exports = router;
module.exports = router;
186 changes: 185 additions & 1 deletion views/done.ejs
Original file line number Diff line number Diff line change
@@ -1 +1,185 @@
<h1>DONE!!!</h1>
<!--Thankyou PAGE -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Tradebyte</title>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.0-2/css/all.min.css"
integrity="sha256-46r060N2LrChLLb5zowXQ72/iKKNiw/lAmygmHExk/o="
crossorigin="anonymous"
/>
<link
href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css"
rel="stylesheet"
/>
<link rel="stylesheet" href="css/style.css" />
<!--stylesheet -->
<style>
/* paragraph in the done page*/
p {
margin: 10px 0 !important;
font-weight: 600;
font-size: 1.5rem;
color: black;
}
/* Heading in the done page*/
.heading {
font-size: 50px;
text-align: center;
color: green;
}
/* The main container or card in the done page*/
.done-container {
width: 400px;
text-align: center;
height: 400px;
border: black;
}
/* check icon*/
#check {
color: rgb(155, 245, 155);
padding-bottom: 5px;
text-shadow: rgb(101, 245, 101);
}
/* share button container*/
.share > .container {
position: absolute;
width: 200px;
background: white;
box-shadow: #ada5a5;
margin-top: 12px;
margin-bottom: 15px;
border-radius: 5px;
opacity: 0;
visibility: hidden;
transition: 1s;
transform: translateY(10%);
}
/*Share button showdatabutton*/
.share.showAddThisButtons > .container {
opacity: 1;
visibility: visible;
transform: translateY(0);
}
.addthis_inline_share_toolbox,
.addthis_sharing_toolbox {
text-align: center;
}
</style>
</head>

<body style="display: flex; justify-content: center; align-items: center;">
<!---Card component-->
<div
style="display: flex; justify-content: center; align-items: center;"
class="done-container max-w-sm mx-auto flex p-5 bg-white rounded-lg shadow-2xl"
>
<div class="py-4">
<h1 class="heading font-bold mb-2 text-center6+">Done</h1>
<div>
<i id="check" class="far fa-check-circle fa-7x"></i>
</div>
<div>
<p class="text-black-700 text-center">
Thankyou for using TradeByte
</p>
</div>
<div style="display: flex; justify-content: center;">
<button
onclick="back()"
class="bg-gray-700 hover:bg-red-400 text-white font-bold py-2 px-5 mx-2 mt-4 mb-3 rounded-full"
>
<i class="far fa-times-circle"></i> Cancel
</button>

<button
class="share bg-gray-700 hover:bg-blue-400 text-white font-bold py-2 px-5 mx-2 mt-4 mb-3 rounded-full cursor-pointer"
onclick="share(this)"
>
<i class="fas fa-share-alt"></i> Share
<div class="container">
<div class="addthis_inline_share_toolbox"></div>
<div class="addthis_sharing_toolbox"></div>
</div>
</button>
</div>
</div>
</div>

<!---------------------java script-------------------------->
<script>
var AddThisJSLoaded = false; // Addthis not loaded yet
var clickedOnShare = false; // share button is not clicked
function back() {
window.location.href = "/";
}
//this is a publicer id
var AddthisPubID = "ra-5f3af90d32b2c7af";
var AddThisJS =
"//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-5f3af90d32b2c7af";
function share(button) {
if (!AddThisJSLoaded && !clickedOnShare) {
//when AddThis not loaded
clickedOnShare = true; // shsre button is clicked
showLoading(button);
shareByAddThis(button);
} else {
toogleAddThisButtons(button);
}
}
function shareByAddThis(button) {
var script = document.createElement("script");
script.async = true;
script.src = AddThisJS;
script.onload = function () {
clickedOnShare = false; // AddTHis js is loaded
addthis.user.ready(function (data) {
AddThisJSLoaded = true; //loaded and ready to use
hideLoading(button);
showAddThisButtons(button);
});
};
script.onerror = function () {
clickedOnShare = false; // Addthis JS failed to laod
hideLoading(button);
};
document.body.appendChild(script);
}
function showLoading(button) {
button.classList.add("loading");
}
function hideLoading(button) {
//hide the loading
button.classList.remove("loading");
}
function showAddThisButtons(button) {
button.classList.add("showAddThisButtons");
}
function toogleAddThisButtons(button) {
button.classList.toogle("showAddThisButtons");
}
</script>
<script src="javascript/script.js"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion views/layouts/app.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
<div class="md:flex flex-col bg-gray-300 md:flex-row min-h-screen w-full">
<%- include('../partials/_nav.ejs') %> <%- body %>
</div>
<script src="javascript/script.js"></script>
<script type="application/javascript" src="javascript/script.js"></script>
</body>
</html>
22 changes: 10 additions & 12 deletions views/layouts/login.ejs
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
<!DOCTYPE html>
<html lang="en">
<head>

<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.0-2/css/all.min.css"
integrity="sha256-46r060N2LrChLLb5zowXQ72/iKKNiw/lAmygmHExk/o="
crossorigin="anonymous"
/>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.0-2/css/all.min.css" integrity="sha256-46r060N2LrChLLb5zowXQ72/iKKNiw/lAmygmHExk/o=" crossorigin="anonymous" />
<link rel="stylesheet" href="css/style.css" />
<title>TradeByte</title>
</head>
<body>
</head>

<body>
<%- body %>

<script src="javascript/script.js"></script>
</body>
</html>
<script src="javascript/script.js"></script>
</body>

</html>
Loading

0 comments on commit 4b97491

Please sign in to comment.