diff --git a/config/auth.js b/config/auth.js index a11b0c1..17c3cec 100644 --- a/config/auth.js +++ b/config/auth.js @@ -1,14 +1,14 @@ module.exports = { - ensureAuthenticated: function(req, res, next) { - if (req.isAuthenticated()) { - return next(); - } - res.redirect('/login'); - }, - forwardAuthenticated: function(req, res, next) { - if (!req.isAuthenticated()) { - return next(); - } - res.redirect('/dashboard'); + ensureAuthenticated: function (req, res, next) { + if (req.isAuthenticated()) { + return next(); } - }; \ No newline at end of file + res.redirect("/login"); + }, + forwardAuthenticated: function (req, res, next) { + if (!req.isAuthenticated()) { + return next(); + } + res.redirect("/dashboard"); + }, +}; diff --git a/config/passport.js b/config/passport.js index baf7764..a04b21e 100644 --- a/config/passport.js +++ b/config/passport.js @@ -1,16 +1,16 @@ -const LocalStrategy = require('passport-local').Strategy; -const bcrypt = require('bcryptjs'); +const LocalStrategy = require("passport-local").Strategy; +const bcrypt = require("bcryptjs"); -const User = require('../models/userSchema'); +const User = require("../models/userSchema"); -module.exports = function(passport) { +module.exports = function (passport) { passport.use( - new LocalStrategy({ usernameField: 'email' }, (email, password, done) => { + new LocalStrategy({ usernameField: "email" }, (email, password, done) => { User.findOne({ - email: email - }).then(user => { + email: email, + }).then((user) => { if (!user) { - return done(null, false, { message: 'That email is not registered' }); + return done(null, false, { message: "That email is not registered" }); } bcrypt.compare(password, user.password, (err, isMatch) => { @@ -18,20 +18,20 @@ module.exports = function(passport) { if (isMatch) { return done(null, user); } else { - return done(null, false, { message: 'Password incorrect' }); + return done(null, false, { message: "Password incorrect" }); } }); }); }) ); - passport.serializeUser(function(user, done) { + passport.serializeUser(function (user, done) { done(null, user.id); }); - passport.deserializeUser(function(id, done) { - User.findById(id, function(err, user) { + passport.deserializeUser(function (id, done) { + User.findById(id, function (err, user) { done(err, user); }); }); -}; \ No newline at end of file +}; diff --git a/controllers/authController.js b/controllers/authController.js index f20a138..1d74528 100644 --- a/controllers/authController.js +++ b/controllers/authController.js @@ -1,53 +1,62 @@ -const User = require("../models/userSchema") -const bcrypt = require("bcryptjs") +const User = require("../models/userSchema"); +const bcrypt = require("bcryptjs"); -const register = async(req, res)=>{ - let errors = []; - const {username, email, password, modelNumber, emergencyContact} = req.body - if(!username || !email || !password){ - errors.push({msg:"Please Fill in all the fields"}) - } +const register = async (req, res) => { + const errors = []; + const { username, email, password, modelNumber, emergencyContact } = req.body; + if (!username || !email || !password) { + errors.push({ msg: "Please Fill in all the fields" }); + } - if(username.length < 5 || username.length > 17 ){ - errors.push({msg:"username should be in between 6 and 16 characters"}) - } + if (username.length < 5 || username.length > 17) { + errors.push({ msg: "username should be in between 6 and 16 characters" }); + } - if(password.length < 5 || password.length > 17 ){ - errors.push({msg: "Password should be in between 6 and 16 characters"}) - } + if (password.length < 5 || password.length > 17) { + errors.push({ msg: "Password should be in between 6 and 16 characters" }); + } - if(errors.length > 0){ - res.render("register", {errors, username, email, password, modelNumber, emergencyContact}) - }else{ - User.findOne({email:email}) - .then(user => { - if(user){ - errors.push({msg:"User already exists, try logging in instead."}) - res.render("register", {error}) - }else{ - const newUser = new User({ - "username": username, - "email": email, - "password": password, - "modelNumber": modelNumber, - "emergencyContact": emergencyContact - }) - bcrypt.genSalt(10, (err, salt)=> bcrypt.hash(newUser.password, salt, (err, hash)=>{ - if(err) throw err + if (errors.length > 0) { + res.render("register", { + errors, + username, + email, + password, + modelNumber, + emergencyContact, + }); + } else { + User.findOne({ email: email }).then((user) => { + if (user) { + errors.push({ msg: "User already exists, try logging in instead." }); + res.render("register", { error }); + } else { + const newUser = new User({ + username: username, + email: email, + password: password, + modelNumber: modelNumber, + emergencyContact: emergencyContact, + }); + bcrypt.genSalt(10, (err, salt) => + bcrypt.hash(newUser.password, salt, (err, hash) => { + if (err) throw err; - newUser.password = hash; + newUser.password = hash; - newUser.save() - .then(user => { - res.redirect("/dashboard") - }) - .catch(err=>console.log(err)); - })) - } - }) - } -} + newUser + .save() + .then((user) => { + res.redirect("/dashboard"); + }) + .catch((err) => ); + }) + ); + } + }); + } +}; module.exports = { - register -} \ No newline at end of file + register, +}; diff --git a/controllers/spotifyController.js b/controllers/spotifyController.js index 102190c..be0e36c 100644 --- a/controllers/spotifyController.js +++ b/controllers/spotifyController.js @@ -1,44 +1,36 @@ -const spotifyApi = require("../routes/spotifyRoute") -var spotifyData = null; - +const spotifyApi = require("../routes/spotifyRoute"); +const spotifyData = null; const spotifyAuth = async (req, res, next) => { + var code = req.query.code; + if (req.query.code !== null) { var code = req.query.code; - if (req.query.code != null) { - var code = req.query.code; - - await spotifyApi.spotifyApi.authorizationCodeGrant(code).then( - data=>{ - const access_token = data.body['access_token']; - const refresh_token = data.body['refresh_token']; - spotifyApi.spotifyApi.setAccessToken(access_token); - spotifyApi.spotifyApi.setRefreshToken(refresh_token); - console.log('Spotify Authorized') - } - ).catch(err => { - console.log(err); - }) - // spotifyApi.spotifyApi.setAccessToken(code); - spotifyApi.spotifyApi.getMyCurrentPlaybackState().then( - function(data) { - if(data.body && data.body.is_playing){ - console.log(data.body["item"]["name"]) - res.render('index') - } else { - console.log('Nothing is Playing right now'); - res.render('index') - } - }, function(err) { - console.log('Something Went Wrong', err) - } - ) - - } - else { - res.render("index") - } -} + + await spotifyApi.spotifyApi + .authorizationCodeGrant(code) + .then((data) => { + const access_token = data.body.access_token; + const refresh_token = data.body.refresh_token; + spotifyApi.spotifyApi.setAccessToken(access_token); + spotifyApi.spotifyApi.setRefreshToken(refresh_token); + }) + .catch((err) => {}); + // spotifyApi.spotifyApi.setAccessToken(code); + spotifyApi.spotifyApi.getMyCurrentPlaybackState().then( + function (data) { + if (data.body && data.body.is_playing) { + res.render("index"); + } else { + res.render("index"); + } + }, + function (err) {} + ); + } else { + res.render("index"); + } +}; module.exports = { - spotifyAuth, -} \ No newline at end of file + spotifyAuth, +}; diff --git a/controllers/weatherController.js b/controllers/weatherController.js index e031553..e10007b 100644 --- a/controllers/weatherController.js +++ b/controllers/weatherController.js @@ -1,42 +1,37 @@ -const https = require("https") +const https = require("https"); - -const getWeather = (req, res)=>{ +const getWeather = (req, res) => { return new Promise((resolve, reject) => { - https.get("https://api.myip.com/", function(response){ - response.on("data", function(data){ - const ipData = JSON.parse(data) - const ip = ipData.ip - https.get(`https://ipwhois.app/json/${ip}`, (ipResponse) => { - ipResponse.on("data", (locData) => { - const resp = JSON.parse(locData) - const location = resp.city - const query = location; - const apiKey = process.env.WEATHER_API_KEY - const units = "metric"; - const url = - "https://api.openweathermap.org/data/2.5/weather?q=" + - query + - "&appid=" + - apiKey + - "&units=" + - units; - - https.get(url, function (response) { - console.log(response.statusCode); - - response.on("data", function (data) { - const weatherData = JSON.parse(data); - resolve(weatherData); - }) - }) - }) - }) - }) - }) - }) -} - + https.get("https://api.myip.com/", function (response) { + response.on("data", function (data) { + const ipData = JSON.parse(data); + const ip = ipData.ip; + https.get(`https://ipwhois.app/json/${ip}`, (ipResponse) => { + ipResponse.on("data", (locData) => { + const resp = JSON.parse(locData); + const location = resp.city; + const query = location; + const apiKey = process.env.WEATHER_API_KEY; + const units = "metric"; + const url = + "https://api.openweathermap.org/data/2.5/weather?q=" + + query + + "&appid=" + + apiKey + + "&units=" + + units; + https.get(url, function (response) { + response.on("data", function (data) { + const weatherData = JSON.parse(data); + resolve(weatherData); + }); + }); + }); + }); + }); + }); + }); +}; -module.exports = { getWeather } +module.exports = { getWeather }; diff --git a/index.js b/index.js index fe56674..7982bfc 100644 --- a/index.js +++ b/index.js @@ -1,55 +1,54 @@ -//importing modules -require('dotenv').config() -const express = require("express") -const ejs = require("ejs") -const mongoose = require("mongoose") -//middleware +// importing modules +require("dotenv").config(); +const express = require("express"); +const ejs = require("ejs"); +const mongoose = require("mongoose"); +// middleware const app = express(); -app.use(express.static(__dirname + '/public')); -app.set('view engine', 'ejs') +app.use(express.static(__dirname + "/public")); +app.set("view engine", "ejs"); const session = require("express-session"); -const passport = require('passport'); -const User = require("./models/userSchema") +const passport = require("passport"); +const User = require("./models/userSchema"); app.use(express.json()); -app.use(express.urlencoded({extended:true})) -app.use(session({ - secret:process.env.SECRET, - resave:true, - saveUninitialized:true -})); - -require('./config/passport')(passport); - - -//db config -const DB_PASSWORD = process.env.DB_PASSWORD -const db = `mongodb+srv://encryptid-dev:${DB_PASSWORD}@cluster0.510gr.mongodb.net/core-prelims` -mongoose.connect(db, { +app.use(express.urlencoded({ extended: true })); +app.use( + session({ + secret: process.env.SECRET, + resave: true, + saveUninitialized: true, + }) +); + +require("./config/passport")(passport); + +// db config +const DB_PASSWORD = process.env.DB_PASSWORD; +const db = `mongodb+srv://encryptid-dev:${DB_PASSWORD}@cluster0.510gr.mongodb.net/core-prelims`; +mongoose + .connect(db, { useNewUrlParser: true, useUnifiedTopology: true, -}) -.then(console.log("Connected to Mongo DB")) + }) + .then(); -//passport +// passport app.use(passport.initialize()); app.use(passport.session()); -//route imports -const homeRoute = require("./routes/homeRoute") -const spotifyRoute = require('./routes/spotifyRoute') -const registerRoute = require("./routes/authRoute") -const dashboardRoute = require("./routes/dashboardRoute") - - -//routes -app.use(homeRoute) -app.use(spotifyRoute.all) -app.use("/", registerRoute) -app.use("/dashboard", dashboardRoute) - -//listening -const PORT = process.env.PORT || 5000 -app.listen(PORT, ()=>{ - console.log(`App Listening on port ${PORT}`); -}) \ No newline at end of file +// route imports +const homeRoute = require("./routes/homeRoute"); +const spotifyRoute = require("./routes/spotifyRoute"); +const registerRoute = require("./routes/authRoute"); +const dashboardRoute = require("./routes/dashboardRoute"); + +// routes +app.use(homeRoute); +app.use(spotifyRoute.all); +app.use("/", registerRoute); +app.use("/dashboard", dashboardRoute); + +// listening +const PORT = process.env.PORT || 5000; +app.listen(PORT, () => {}); diff --git a/models/userSchema.js b/models/userSchema.js index e1edbc2..abaf532 100644 --- a/models/userSchema.js +++ b/models/userSchema.js @@ -1,23 +1,22 @@ const mongoose = require("mongoose"); const passportLocalMongoose = require("passport-local-mongoose"); -const reqString = { type:String, required:true } -const moment = require("moment") -let now = new Date() -let dateStringWithTime = moment(now).format('YYYY-MM-DD HH:MM:SS'); +const reqString = { type: String, required: true }; +const moment = require("moment"); +const now = new Date(); +const dateStringWithTime = moment(now).format("YYYY-MM-DD HH:MM:SS"); const userSchema = new mongoose.Schema({ - email:reqString, - username:reqString, - password:reqString, - date: { - type:String, - default: dateStringWithTime - }, - emergencyContact: reqString, - modelNumber: reqString, -}) + email: reqString, + username: reqString, + password: reqString, + date: { + type: String, + default: dateStringWithTime, + }, + emergencyContact: reqString, + modelNumber: reqString, +}); -userSchema.plugin(passportLocalMongoose) - -module.exports = mongoose.model("User", userSchema) +userSchema.plugin(passportLocalMongoose); +module.exports = mongoose.model("User", userSchema); diff --git a/public/css/index.css b/public/css/index.css index 776498d..466e197 100644 --- a/public/css/index.css +++ b/public/css/index.css @@ -1,529 +1,537 @@ -@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@100;200;300;400;500;600;700;800;900&display=swap'); -*{ - margin:0; - padding:0; - box-sizing: border-box; +@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@100;200;300;400;500;600;700;800;900&display=swap"); +* { + margin: 0; + padding: 0; + box-sizing: border-box; } -body{ - background: url('https://media.discordapp.net/attachments/873467037979131904/875788443127525446/unknown.png?width=788&height=593') no-repeat; - background-size: cover; - color: #eee !important; - font-family: 'Montserrat', sans-serif !important; - overflow-x: hidden; +body { + background: url("https://media.discordapp.net/attachments/873467037979131904/875788443127525446/unknown.png?width=788&height=593") + no-repeat; + background-size: cover; + color: #eee !important; + font-family: "Montserrat", sans-serif !important; + overflow-x: hidden; } -.dashboard{ - width: 100%; - height: 100%; - display: flex; +.dashboard { + width: 100%; + height: 100%; + display: flex; } .dashboard-welcome-div, .dashboard-register, .dashboard-login, -.user-div{ - height: 50vw; - background: rgba(0,0,0,0.8); - width: 75vw; - border-radius: 3.5vw; - margin-top: 10.5vw; - margin-left: 11vw; -} -.dashboard-welcome-div h1{ - text-align: center; - padding-top: 15vw; - font-size: 5vw !important; - animation: up 2s ease; - transition: all 1s ease; +.user-div { + height: 50vw; + background: rgba(0, 0, 0, 0.8); + width: 75vw; + border-radius: 3.5vw; + margin-top: 10.5vw; + margin-left: 11vw; +} +.dashboard-welcome-div h1 { + text-align: center; + padding-top: 15vw; + font-size: 5vw !important; + animation: up 2s ease; + transition: all 1s ease; } @keyframes up { - from{ - opacity: 0; - transform: translateY(5px); - } - to{ - opacity: 1; - transform: translateY(0); - } -} -.dashboard-welcome-div .btn{ - background: #7A95FF !important; - color: #eee; - height: 3.5vw; - width: 20vw; - border-radius: 2.5vw; - font-weight: 700; - margin-top: 7.5vw; - margin-left: 27.5vw; -} -span{ - font-family: 'Material Icons'; -} -.dashboard-language-div , -.dashboard-feature-div{ - display: none; + from { + opacity: 0; + transform: translateY(5px); + } + to { + opacity: 1; + transform: translateY(0); + } +} +.dashboard-welcome-div .btn { + background: #7a95ff !important; + color: #eee; + height: 3.5vw; + width: 20vw; + border-radius: 2.5vw; + font-weight: 700; + margin-top: 7.5vw; + margin-left: 27.5vw; +} +span { + font-family: "Material Icons"; +} +.dashboard-language-div, +.dashboard-feature-div { + display: none; } @keyframes leftTransition { - from{ - opacity: 0; - transform: translateX(15px); - } - to{ - opacity: 1; - transform: translateX(0); - } -} -.dashboard-language-div .row{ - margin-top: 5vw; -} -.dashboard-language-div .col-sm-4{ - position: absolute; -} -.dashboard-language-div .col-sm-4:nth-child(1){ - margin-left: 10vw; -} -.dashboard-language-div .col-sm-4:nth-child(2){ - margin-left: 40vw; -} -.dashboard-language-div .card,.user-div .col-sm-4{ - padding:10px; - height: 25vw; - background: rgba(0,0,0,0.8); - backdrop-filter: blur(30px); - border-radius: 2.5vw; -} -.dashboard-language-div .card:first-child{ - margin-right: 5vw; -} -.dashboard-language-div .card span{ - color: #7A95FF; - font-size: 7.5vw; - text-align: center; - margin-bottom: 3.5vw; -} -.dashboard-language-div .card h2,h4{ - text-align: center; -} -.dashboard-language-div .card h4{ - transform: scale(0.75); -} -.dashboard-language-div .card h2{ - color: #7A95FF; - margin-top: -5vw; -} -.dashboard-language-div h2{ - text-align: center; - padding-top: 5vw; - font-weight: 700; -} -.dashboard-language-div p{ - font-size: 1vw; - padding-top: 1vw; - text-align: center; -} -.dashboard-language-div .btn{ - margin-top: 27.5vw; - margin-left: 60vw; - width: 10vw; - position: absolute; -} -.dashboard-model-div h2,p{ - text-align: center; -} -.dashboard-model-div h2{ - padding-top: 5vw; - font-weight: 700; -} -.dashboard-model-div p{ - margin-top: 2.5vw; -} -.dashboard-model-div .row{ - margin-top: 7.5vw; -} -.dashboard-model-div .row .col-sm-4{ - margin-left: 7.5vw !important; -} -.dashboard-model-div .row .col-sm-5{ - padding-left: 5vw; - margin-top: -5vw; -} -.dashboard-model-div .card{ - padding:10px; - height: 20vw; - background: rgba(0,0,0,0.8); - backdrop-filter: blur(30px); - border-radius: 2.5vw; - margin-top: -2.5vw; - margin-left: -2.5vw; -} -.dashboard-model-div .card span{ - text-align: center; - margin-top: 1.5vw; - font-size: 5vw; - color: #7A95FF; -} -.dashboard-model-div .card a{ - color: #7A95FF; - text-decoration: none; -} -.dashboard-model-div .btn{ - margin-left: 60vw; - width: 10vw; -} -.dashboard-login .dashboard-model-div .car-register-div{ - position: relative; -} -.dashboard-login .dashboard-model-div .car-register-div input:nth-child(1){ - margin-left: 1.5vw; -} -.dashboard-model-div .car-register-div form{ - margin-top: 5vw; - position: absolute; - display: block; - margin-left: -3.5vw; -} -.dashboard-model-div .car-register-div form input,.call-div input, .map-component form input{ - background: transparent; - color: #eee; - border: none; - padding:10px; - border-bottom: 2px solid #7A95FF; - margin-bottom: .5vw; -} -.map-component form{ - margin-top: 1.5vw; -} -.map-component form input{ - margin-left: 5vw; -} -.route-connect{ - background: #eee; - padding:10px; - border:none; - border-radius: 2.5vw; - margin-top: 5vw; - position: absolute; - font-weight: 600; + from { + opacity: 0; + transform: translateX(15px); + } + to { + opacity: 1; + transform: translateX(0); + } +} +.dashboard-language-div .row { + margin-top: 5vw; +} +.dashboard-language-div .col-sm-4 { + position: absolute; +} +.dashboard-language-div .col-sm-4:nth-child(1) { + margin-left: 10vw; +} +.dashboard-language-div .col-sm-4:nth-child(2) { + margin-left: 40vw; +} +.dashboard-language-div .card, +.user-div .col-sm-4 { + padding: 10px; + height: 25vw; + background: rgba(0, 0, 0, 0.8); + backdrop-filter: blur(30px); + border-radius: 2.5vw; +} +.dashboard-language-div .card:first-child { + margin-right: 5vw; +} +.dashboard-language-div .card span { + color: #7a95ff; + font-size: 7.5vw; + text-align: center; + margin-bottom: 3.5vw; +} +.dashboard-language-div .card h2, +h4 { + text-align: center; +} +.dashboard-language-div .card h4 { + transform: scale(0.75); +} +.dashboard-language-div .card h2 { + color: #7a95ff; + margin-top: -5vw; +} +.dashboard-language-div h2 { + text-align: center; + padding-top: 5vw; + font-weight: 700; +} +.dashboard-language-div p { + font-size: 1vw; + padding-top: 1vw; + text-align: center; +} +.dashboard-language-div .btn { + margin-top: 27.5vw; + margin-left: 60vw; + width: 10vw; + position: absolute; +} +.dashboard-model-div h2, +p { + text-align: center; +} +.dashboard-model-div h2 { + padding-top: 5vw; + font-weight: 700; +} +.dashboard-model-div p { + margin-top: 2.5vw; +} +.dashboard-model-div .row { + margin-top: 7.5vw; +} +.dashboard-model-div .row .col-sm-4 { + margin-left: 7.5vw !important; +} +.dashboard-model-div .row .col-sm-5 { + padding-left: 5vw; + margin-top: -5vw; +} +.dashboard-model-div .card { + padding: 10px; + height: 20vw; + background: rgba(0, 0, 0, 0.8); + backdrop-filter: blur(30px); + border-radius: 2.5vw; + margin-top: -2.5vw; + margin-left: -2.5vw; +} +.dashboard-model-div .card span { + text-align: center; + margin-top: 1.5vw; + font-size: 5vw; + color: #7a95ff; +} +.dashboard-model-div .card a { + color: #7a95ff; + text-decoration: none; +} +.dashboard-model-div .btn { + margin-left: 60vw; + width: 10vw; +} +.dashboard-login .dashboard-model-div .car-register-div { + position: relative; +} +.dashboard-login .dashboard-model-div .car-register-div input:nth-child(1) { + margin-left: 1.5vw; +} +.dashboard-model-div .car-register-div form { + margin-top: 5vw; + position: absolute; + display: block; + margin-left: -3.5vw; +} +.dashboard-model-div .car-register-div form input, +.call-div input, +.map-component form input { + background: transparent; + color: #eee; + border: none; + padding: 10px; + border-bottom: 2px solid #7a95ff; + margin-bottom: 0.5vw; +} +.map-component form { + margin-top: 1.5vw; +} +.map-component form input { + margin-left: 5vw; +} +.route-connect { + background: #eee; + padding: 10px; + border: none; + border-radius: 2.5vw; + margin-top: 5vw; + position: absolute; + font-weight: 600; } .dashboard-model-div .car-register-div form input:nth-child(2), -.dashboard-model-div .car-register-div form input:nth-child(4){ - margin-left: 1.5vw; -} -.dashboard-model-div .register{ - position: absolute; - padding:10px; - border: none; - border-radius: 2.5vw; - width: 15vw; - background: #608bff; - color: #eee; - margin-left: -17.5vw; - margin-top: 10vw; +.dashboard-model-div .car-register-div form input:nth-child(4) { + margin-left: 1.5vw; +} +.dashboard-model-div .register { + position: absolute; + padding: 10px; + border: none; + border-radius: 2.5vw; + width: 15vw; + background: #608bff; + color: #eee; + margin-left: -17.5vw; + margin-top: 10vw; } .dashboard-model-div input:focus, .map-component form input:focus, -.call-div input:focus{ - outline: none; - border-bottom: 2px solid #4164f1 !important; +.call-div input:focus { + outline: none; + border-bottom: 2px solid #4164f1 !important; } -.dashboard-feature-div h2{ - padding-top: 2.5vw; - text-align: center; - font-weight:700; +.dashboard-feature-div h2 { + padding-top: 2.5vw; + text-align: center; + font-weight: 700; } -.dashboard-feature-div p{ - margin-top: 2.5vw; +.dashboard-feature-div p { + margin-top: 2.5vw; } -.dashboard-feature-div .row{ - margin-top: 5vw; +.dashboard-feature-div .row { + margin-top: 5vw; } -.ft-icon span{ - color: #608bff; - font-size: 3.5vw; +.ft-icon span { + color: #608bff; + font-size: 3.5vw; } -.ft-icon , .ft-desc{ - list-style: none; - position: absolute; +.ft-icon, +.ft-desc { + list-style: none; + position: absolute; } -.ft-icon{ - margin-left: 17.5vw; +.ft-icon { + margin-left: 17.5vw; } -.ft-icon li:nth-child(2), .ft-icon li:nth-child(3){ - margin-top: 2.5vw; +.ft-icon li:nth-child(2), +.ft-icon li:nth-child(3) { + margin-top: 2.5vw; } .ft-desc { - margin-left: 27.5vw; -} -.ft-desc p{ - text-align: left; - margin-top: .5vw; -} -.next-2{ - width: 10vw !important; - margin-top: 30vw !important; - margin-left: 60vw !important; -} -.back-2{ - width: 10vw !important; - margin-top: -5.5vw !important; - margin-left: 7.5vw !important; -} -.dashboard-main-div{ - width: 100%; - margin-top: 3vw; - height: 100% ; - border-radius: 2.5vw; -} -.weather-component{ - padding: 10px; - box-shadow: -1px 1px 60px -20px rgba(83,131,231,0.75); - background: rgba(0,0,0,0.8); - position: absolute; - width: 25vw; - padding: 10px; - height: 10vw; - border-radius: 1.5vw; - margin-left: 52.5vw; - margin-top: 5.5vw; -} -.weather-component span{ - border: 2px solid #608bff; - border-radius: 100%; - margin-left: 17.5vw; - width: 4vw; - height: 4vw; - position: absolute; - font-size: 2.5vw; - text-align: center; - margin-top: 2vw !important; -} -.weather-component h4{ - position: absolute; - font-weight: 200 !important; - margin-left: 2.5vw; - margin-top: 2vw; -} -.weather-component h2{ - position: absolute; - margin-top: 4.5vw; - font-size: 1.5vw; - margin-left: 2.75vw; -} -.song-component{ - box-shadow: -1px 1px 60px -20px rgba(83,131,231,0.75); - background : rgba(0,0,0,0.8); - position: absolute; - border-radius: 1vw; - margin-left: 15vw; - margin-top:5vw; - height: 22.5vw; - width: 35vw; -} -.song-component span{ - cursor: pointer; + margin-left: 27.5vw; +} +.ft-desc p { + text-align: left; + margin-top: 0.5vw; +} +.next-2 { + width: 10vw !important; + margin-top: 30vw !important; + margin-left: 60vw !important; +} +.back-2 { + width: 10vw !important; + margin-top: -5.5vw !important; + margin-left: 7.5vw !important; +} +.dashboard-main-div { + width: 100%; + margin-top: 3vw; + height: 100%; + border-radius: 2.5vw; +} +.weather-component { + padding: 10px; + box-shadow: -1px 1px 60px -20px rgba(83, 131, 231, 0.75); + background: rgba(0, 0, 0, 0.8); + position: absolute; + width: 25vw; + padding: 10px; + height: 10vw; + border-radius: 1.5vw; + margin-left: 52.5vw; + margin-top: 5.5vw; +} +.weather-component span { + border: 2px solid #608bff; + border-radius: 100%; + margin-left: 17.5vw; + width: 4vw; + height: 4vw; + position: absolute; + font-size: 2.5vw; + text-align: center; + margin-top: 2vw !important; +} +.weather-component h4 { + position: absolute; + font-weight: 200 !important; + margin-left: 2.5vw; + margin-top: 2vw; +} +.weather-component h2 { + position: absolute; + margin-top: 4.5vw; + font-size: 1.5vw; + margin-left: 2.75vw; +} +.song-component { + box-shadow: -1px 1px 60px -20px rgba(83, 131, 231, 0.75); + background: rgba(0, 0, 0, 0.8); + position: absolute; + border-radius: 1vw; + margin-left: 15vw; + margin-top: 5vw; + height: 22.5vw; + width: 35vw; +} +.song-component span { + cursor: pointer; } .song-component h4, -.song-component h3 -{ - position: absolute; -} -.song-component h4{ - margin-left: 4.5vw; - margin-top: 4vw; - font-weight: 100; -} -.song-component h3{ - margin-left: 4.5vw; - margin-top: 9vw; -} -.song-component h3:nth-child(2){ - margin-top: 6.5vw; -} -.song-component .song-list{ - position: absolute; - list-style: none; - padding: 10px; - height: 16vw; - width: 5vw; - padding: 10px; - background: rgba(0,0,0,0.5); - border-radius: .5vw; - margin-left: 25vw; - margin-top: 2.5vw; - padding-top: 1.5vw; -} -.song-component .song-list li{ - position: absolute; - text-align: center; - font-size: 2.5vw; - margin-left: 0.5vw; -} -.song-component .song-list li:nth-child(1){ - margin-left: 0.75vw; -} -.song-component .song-list li:nth-child(2){ - margin-top: 5vw; -} -.song-component .song-list li:nth-child(3){ - margin-top: 10vw; - margin-left: 0.75vw; -} -.song-component .song-widget{ - position: absolute; - width: 17.5vw; - height: 5.5vw; - border-radius: .5vw; - background:red; - margin-left: 4.5vw; - margin-top: 13vw; -} -.song-component .song-widget .song-album{ - background: black; - position: absolute; - height: 3.5vw; - width: 3.5vw; - border-radius: 0.5vw; - margin-top: 1vw; - margin-left: 1vw; -} -.song-component .song-widget .song-title , -.song-component .song-widget .song-author{ - position: absolute;; -} -.song-component .song-widget .song-title -{ - margin-top: 1vw; - margin-left: 5.5vw -} -.song-component .song-widget .song-author{ - transform: scale(0.75); - margin-top: 2.5vw; - margin-left: 5vw; -} -.gcse-search{ - position: absolute; - width: 45vw !important; -} -.map-component{ - height: 25vw; - width: 35vw; - position: absolute; - box-shadow: -0.5px 5px 30px -10px rgba(83,131,231,0.75); - background : rgba(0,0,0,0.8);; - border-radius: 1.5vw; - margin-left: 15vw; - margin-top: 30vw; -} -.map-component h3{ - margin-left: 2.5vw; -} -.map-component h3:nth-child(1){ - font-weight: 200; - font-size: 1.5vw; - margin-top: 3.5vw; -} -.calendar-component{ - width: 25vw; - height: 37.5vw; - position: absolute; - background : rgba(0,0,0,0.8);; - box-shadow: -0.5px -0.5px 30px -10px rgba(83,131,231,0.75); - margin-left: 52.5vw; - margin-top: 17.5vw; - padding:10px; - border-radius: 1.5vw !important; -}.calendar-event h4{ - position: absolute; - margin-top: 8.5vw; - margin-left: 1.5vw; -} -.calendar-component h3{ - position: absolute; - color: #a0a0a0; - margin-left:1.5vw; - margin-top: 3.5vw; -} -.calendar-component p{ - position: absolute; - margin-left: 1.5vw; - margin-top: 7vw; -} -.btn-connect{ - border:none; - padding:10px; - border-radius: 2.5vh; - background: #eee; - width: 20vw; - margin-left: 1.5vw; - margin-top: 5vw; - font-weight: 600; -} -.play-btn{ - position: absolute; - margin-left: 13.5vw; - font-size: 2.5vw; - margin-top: .75vw; -} -.connect{ - background: #1DB954; - font-weight: 600; - color:#eee; - padding:10px; - border: none; - border-radius: 2.5vw; - width: 15vw; - position: absolute; - margin-top: 15vw; - margin-left: 5vw; -} -.call-div{ - display: none; - margin-top: 20vw; -} -.call-div button{ - width: 7.5vw; - margin-left: 2.5vw; - border: none; - border-radius:2.5vw; - padding:10px; - position: absolute; - margin-top: 5vw; -} -.call-div .call-btn{ - margin-left: -7.5vw; -} -.call-div input{ - margin-left: 5vw; -}.call-btn .call-close{ - position: absolute; - margin-top: -5vw !important; - margin-left: 15vw !important; +.song-component h3 { + position: absolute; +} +.song-component h4 { + margin-left: 4.5vw; + margin-top: 4vw; + font-weight: 100; +} +.song-component h3 { + margin-left: 4.5vw; + margin-top: 9vw; +} +.song-component h3:nth-child(2) { + margin-top: 6.5vw; +} +.song-component .song-list { + position: absolute; + list-style: none; + padding: 10px; + height: 16vw; + width: 5vw; + padding: 10px; + background: rgba(0, 0, 0, 0.5); + border-radius: 0.5vw; + margin-left: 25vw; + margin-top: 2.5vw; + padding-top: 1.5vw; +} +.song-component .song-list li { + position: absolute; + text-align: center; + font-size: 2.5vw; + margin-left: 0.5vw; +} +.song-component .song-list li:nth-child(1) { + margin-left: 0.75vw; +} +.song-component .song-list li:nth-child(2) { + margin-top: 5vw; +} +.song-component .song-list li:nth-child(3) { + margin-top: 10vw; + margin-left: 0.75vw; +} +.song-component .song-widget { + position: absolute; + width: 17.5vw; + height: 5.5vw; + border-radius: 0.5vw; + background: red; + margin-left: 4.5vw; + margin-top: 13vw; +} +.song-component .song-widget .song-album { + background: black; + position: absolute; + height: 3.5vw; + width: 3.5vw; + border-radius: 0.5vw; + margin-top: 1vw; + margin-left: 1vw; +} +.song-component .song-widget .song-title, +.song-component .song-widget .song-author { + position: absolute; +} +.song-component .song-widget .song-title { + margin-top: 1vw; + margin-left: 5.5vw; +} +.song-component .song-widget .song-author { + transform: scale(0.75); + margin-top: 2.5vw; + margin-left: 5vw; +} +.gcse-search { + position: absolute; + width: 45vw !important; +} +.map-component { + height: 25vw; + width: 35vw; + position: absolute; + box-shadow: -0.5px 5px 30px -10px rgba(83, 131, 231, 0.75); + background: rgba(0, 0, 0, 0.8); + border-radius: 1.5vw; + margin-left: 15vw; + margin-top: 30vw; +} +.map-component h3 { + margin-left: 2.5vw; +} +.map-component h3:nth-child(1) { + font-weight: 200; + font-size: 1.5vw; + margin-top: 3.5vw; +} +.calendar-component { + width: 25vw; + height: 37.5vw; + position: absolute; + background: rgba(0, 0, 0, 0.8); + box-shadow: -0.5px -0.5px 30px -10px rgba(83, 131, 231, 0.75); + margin-left: 52.5vw; + margin-top: 17.5vw; + padding: 10px; + border-radius: 1.5vw !important; +} +.calendar-event h4 { + position: absolute; + margin-top: 8.5vw; + margin-left: 1.5vw; +} +.calendar-component h3 { + position: absolute; + color: #a0a0a0; + margin-left: 1.5vw; + margin-top: 3.5vw; +} +.calendar-component p { + position: absolute; + margin-left: 1.5vw; + margin-top: 7vw; +} +.btn-connect { + border: none; + padding: 10px; + border-radius: 2.5vh; + background: #eee; + width: 20vw; + margin-left: 1.5vw; + margin-top: 5vw; + font-weight: 600; +} +.play-btn { + position: absolute; + margin-left: 13.5vw; + font-size: 2.5vw; + margin-top: 0.75vw; +} +.connect { + background: #1db954; + font-weight: 600; + color: #eee; + padding: 10px; + border: none; + border-radius: 2.5vw; + width: 15vw; + position: absolute; + margin-top: 15vw; + margin-left: 5vw; +} +.call-div { + display: none; + margin-top: 20vw; +} +.call-div button { + width: 7.5vw; + margin-left: 2.5vw; + border: none; + border-radius: 2.5vw; + padding: 10px; + position: absolute; + margin-top: 5vw; +} +.call-div .call-btn { + margin-left: -7.5vw; +} +.call-div input { + margin-left: 5vw; +} +.call-btn .call-close { + position: absolute; + margin-top: -5vw !important; + margin-left: 15vw !important; } .user-div .col-sm-4 { - margin-top: 10vw; - margin-left: 5vw; + margin-top: 10vw; + margin-left: 5vw; } -.user-div .col-sm-4 span{ - font-size: 10vw; - position: absolute; - margin-left: 6.5vw; +.user-div .col-sm-4 span { + font-size: 10vw; + position: absolute; + margin-left: 6.5vw; } -.user-desc{ - margin-top: 15vw; - text-align: center; +.user-desc { + margin-top: 15vw; + text-align: center; } -.user-desc b{ - color: #608bff; +.user-desc b { + color: #608bff; } -.user-div .col-sm-4:nth-child(2){ - background: transparent; - padding-top: 7.5vw; +.user-div .col-sm-4:nth-child(2) { + background: transparent; + padding-top: 7.5vw; } -.user-div .col-sm-4:nth-child(2) b{ - color: #608bff; +.user-div .col-sm-4:nth-child(2) b { + color: #608bff; } -.event-desc{ +.event-desc { margin-bottom: 2.5vw; - margin-top: 2.5vw; + margin-top: 2.5vw; } diff --git a/public/js/dashboard.js b/public/js/dashboard.js index 20642c4..0bef334 100644 --- a/public/js/dashboard.js +++ b/public/js/dashboard.js @@ -1,121 +1,120 @@ - -const timeComponent = document.createElement('div'); +const timeComponent = document.createElement("div"); const songDate = new Date(); const day = songDate.getDay(); -switch(day){ - case 0: - currentDay = 'Sunday'; - break; - case 1: - currentDay = 'Monday'; - break; - case 2: - currentDay = 'Tuesday'; - break; - case 3: - currentDay = 'Wednesday'; - break; - case 4: - currentDay = 'Thursday'; - break; - case 5: - currentDay = 'Friday'; - break; - case 6: - currentDay = 'Saturday'; - break; +switch (day) { + case 0: + currentDay = "Sunday"; + break; + case 1: + currentDay = "Monday"; + break; + case 2: + currentDay = "Tuesday"; + break; + case 3: + currentDay = "Wednesday"; + break; + case 4: + currentDay = "Thursday"; + break; + case 5: + currentDay = "Friday"; + break; + case 6: + currentDay = "Saturday"; + break; } -const hours = songDate.getHours(); +const hours = songDate.getHours(); const minutes = songDate.getMinutes(); -const h = (songDate.getHours()<10?'0':'') + songDate.getHours(); -const m = (songDate.getMinutes()<10?'0':'') + songDate.getMinutes(); +const h = (songDate.getHours() < 10 ? "0" : "") + songDate.getHours(); +const m = (songDate.getMinutes() < 10 ? "0" : "") + songDate.getMinutes(); const month = songDate.getMonth(); -switch(month){ - case 0: - currentMonth = 'January'; - break; - case 1: - currentMonth = 'Feburary'; - break; - case 2: - currentMonth = 'March'; - break; - case 3: - currentMonth = 'April'; - break; - case 4: - currentMonth = 'May'; - break; - case 5: - currentMonth = 'June'; - break; - case 6: - currentMonth = 'July'; - break; - case 7: - currentMonth = 'August'; - break; - case 8: - currentMonth = 'September'; - break; - case 9: - currentMonth = 'October'; - break; - case 10: - currentMonth = 'November'; - break; - case 11: - currentMonth = 'December'; - break; +switch (month) { + case 0: + currentMonth = "January"; + break; + case 1: + currentMonth = "Feburary"; + break; + case 2: + currentMonth = "March"; + break; + case 3: + currentMonth = "April"; + break; + case 4: + currentMonth = "May"; + break; + case 5: + currentMonth = "June"; + break; + case 6: + currentMonth = "July"; + break; + case 7: + currentMonth = "August"; + break; + case 8: + currentMonth = "September"; + break; + case 9: + currentMonth = "October"; + break; + case 10: + currentMonth = "November"; + break; + case 11: + currentMonth = "December"; + break; } -switch(songDate.getDate()){ - case 1: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - case 10: - case 11: - case 12: - case 13: - case 14: - case 15: - case 16: - case 17: - case 18: - case 19: - case 20: - case 21: - case 23: - case 24: - case 25: - case 26: - case 27: - case 28: - case 29: - case 30: - case 31: - currentDate = ` ${songDate.getDate()}th` - break; - case 2: - case 22: - currentDate = ` ${songDate.getDate()}nd` - break; +switch (songDate.getDate()) { + case 1: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + case 17: + case 18: + case 19: + case 20: + case 21: + case 23: + case 24: + case 25: + case 26: + case 27: + case 28: + case 29: + case 30: + case 31: + currentDate = ` ${songDate.getDate()}th`; + break; + case 2: + case 22: + currentDate = ` ${songDate.getDate()}nd`; + break; } timeComponent.innerHTML = `
Lorem ipsum dolor sit amet consectetur adipisicing elit. Eos, mintam sed dolores? Odit, architecto ducimus!
@@ -120,15 +120,21 @@ featureDiv.innerHTML = ` `; -dashboard.appendChild(featureDiv) -const [nextLanguageBtn, nextFeatureBtn] = [document.querySelector('.next'), document.querySelector('.next-2')]; -const [backBtn, backBtn1] = [document.querySelector('.back-1'), document.querySelector('.back-2')]; -startBtn.addEventListener('click',()=>{ - displayWelcome.style.display= 'none'; - languageDiv.style.display = 'block'; - languageDiv.style.animation = 'leftTransition 2s 0.5s ease;'; - languageDiv.style.transition = 'all 1s ease'; -}) +dashboard.appendChild(featureDiv); +const [nextLanguageBtn, nextFeatureBtn] = [ + document.querySelector(".next"), + document.querySelector(".next-2"), +]; +const [backBtn, backBtn1] = [ + document.querySelector(".back-1"), + document.querySelector(".back-2"), +]; +startBtn.addEventListener("click", () => { + displayWelcome.style.display = "none"; + languageDiv.style.display = "block"; + languageDiv.style.animation = "leftTransition 2s 0.5s ease;"; + languageDiv.style.transition = "all 1s ease"; +}); // backBtn.addEventListener('click',()=>{ // languageDiv.style.display='block'; // modelDiv.style.display='none'; @@ -137,14 +143,14 @@ startBtn.addEventListener('click',()=>{ // modelDiv.style.display='block'; // featureDiv.style.display='none'; // }) -nextLanguageBtn.addEventListener('click',()=>{ - languageDiv.style.display='none'; - featureDiv.style.display='block'; -}) -backBtn1.addEventListener('click',()=>{ - languageDiv.style.display = 'none'; - featureDiv.style.display='none'; -}) -nextFeatureBtn.addEventListener('click',()=>{ - window.location.href = '/register'; -}) \ No newline at end of file +nextLanguageBtn.addEventListener("click", () => { + languageDiv.style.display = "none"; + featureDiv.style.display = "block"; +}); +backBtn1.addEventListener("click", () => { + languageDiv.style.display = "none"; + featureDiv.style.display = "none"; +}); +nextFeatureBtn.addEventListener("click", () => { + window.location.href = "/register"; +}); diff --git a/public/js/login.js b/public/js/login.js index 1158a2c..d91dc13 100644 --- a/public/js/login.js +++ b/public/js/login.js @@ -1,6 +1,6 @@ -const dashboard = document.querySelector('.dashboard-login') -const modelDiv = document.createElement('div'); -modelDiv.classList.add('dashboard-model-div'); +const dashboard = document.querySelector(".dashboard-login"); +const modelDiv = document.createElement("div"); +modelDiv.classList.add("dashboard-model-div"); dashboard.appendChild(modelDiv); modelDiv.innerHTML = `