From 7e5b870b94c49355438bc25a5e9047cc489dc8fd Mon Sep 17 00:00:00 2001 From: FilipPaskalev <77507389+FilipPaskalev@users.noreply.github.com> Date: Fri, 9 Feb 2024 22:56:00 +0000 Subject: [PATCH 1/6] refactor - change some var names --- index.html | 1 + script.js | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index dc7a4eb..20a73f5 100644 --- a/index.html +++ b/index.html @@ -93,6 +93,7 @@

PULSE

EVENTS

+
diff --git a/script.js b/script.js index e5921ac..d96e4b5 100644 --- a/script.js +++ b/script.js @@ -8,10 +8,13 @@ $(document).ready(function () { const eventsSectionRowContainer = $("#events-row-container"); var cityName = ""; // remove name after finish with dev + var eventsList = []; + var seatGeekData = []; + var thistleData = []; - function serializedSeatgeekData(hasUpcomingEvents) { + function serializedSeatgeekData(hasUpcomingEvents = true) { seatGeekData.forEach((obj) => { if (obj.venue.has_upcoming_events === hasUpcomingEvents) { eventsList.push({ @@ -32,7 +35,7 @@ $(document).ready(function () { description: obj.description, }, imagesUrls: [obj.performers[0].image, obj.performers[0].images.huge], - thicketsUrls: { + websiteUrl: { buyThicketsUrl: obj.url, findThicketsUrl: obj.venue.url, }, @@ -76,7 +79,6 @@ $(document).ready(function () { return response.json(); }) .then(function (data) { - serializedSeatgeekData(data, true); data.events.forEach((event) => { seatGeekData.push(event); }); @@ -125,6 +127,7 @@ $(document).ready(function () { cityName = "Chicago"; getSeatgeekEventsByVenue(cityName); + serializedSeatgeekData(true); renderEventsSection(); }); From 20dcc99b920a0a983b0b9f747499168b929fbd0c Mon Sep 17 00:00:00 2001 From: FilipPaskalev <77507389+FilipPaskalev@users.noreply.github.com> Date: Fri, 9 Feb 2024 22:58:10 +0000 Subject: [PATCH 2/6] remove unused console logs --- script.js | 7 ------- 1 file changed, 7 deletions(-) diff --git a/script.js b/script.js index d96e4b5..7fc149d 100644 --- a/script.js +++ b/script.js @@ -40,13 +40,6 @@ $(document).ready(function () { findThicketsUrl: obj.venue.url, }, }); - // console.log(obj.title); - // console.log(obj.type); - // console.log(obj.datetime_utc); - // console.log(obj.venue.address); - // console.log(obj.venue.city); - // console.log(obj.venue.country); - // console.log(obj.url); } }); } From 7d22b7e4eee1d1c47986c8599177cfb8b88a5caa Mon Sep 17 00:00:00 2001 From: FilipPaskalev <77507389+FilipPaskalev@users.noreply.github.com> Date: Fri, 9 Feb 2024 23:06:16 +0000 Subject: [PATCH 3/6] add data to thistle data when API call to getDatathistleEventsByLocation() is executed --- script.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/script.js b/script.js index 7fc149d..84bbbb2 100644 --- a/script.js +++ b/script.js @@ -44,6 +44,9 @@ $(document).ready(function () { }); } + // TODO finish- combine seatgeek data and thistle Data in eventsList + function mergeEventsData() {} + function getDatathistleEventsByLocation(cityName) { var headers = new Headers(); @@ -56,7 +59,7 @@ $(document).ready(function () { return response.json(); }) .then(function (data) { - return data; + thistleData.push(data); }); } @@ -120,6 +123,7 @@ $(document).ready(function () { cityName = "Chicago"; getSeatgeekEventsByVenue(cityName); + serializedSeatgeekData(true); renderEventsSection(); From 691c2f5839f7bf79dbdce6dc0d5658842c89aeaa Mon Sep 17 00:00:00 2001 From: FilipPaskalev <77507389+FilipPaskalev@users.noreply.github.com> Date: Fri, 9 Feb 2024 23:10:39 +0000 Subject: [PATCH 4/6] refactor name in seatgeek obj + add comments what needs to be done --- index.html | 1 + script.js | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index 20a73f5..95b6c21 100644 --- a/index.html +++ b/index.html @@ -70,6 +70,7 @@

PULSE


+
From 42637b1b86dcc306b5fac5f9fadd18ee83cc4202 Mon Sep 17 00:00:00 2001 From: FilipPaskalev <77507389+FilipPaskalev@users.noreply.github.com> Date: Fri, 9 Feb 2024 23:27:34 +0000 Subject: [PATCH 6/6] add some comments --- script.js | 49 +++++++++++++++++++++++++++++++++++-------------- 1 file changed, 35 insertions(+), 14 deletions(-) diff --git a/script.js b/script.js index 0a717de..d76e28c 100644 --- a/script.js +++ b/script.js @@ -82,14 +82,37 @@ $(document).ready(function () { console.log(seatGeekData); } - function createCard( - cardIndex, - websiteUrl, - imgUrl, - altDescription, - eventTitle, - footerText - ) { + function createCard(eventData) { + eventsList.push({ + eventId: obj.id, + location: { + country: obj.venue.country, + city: obj.venue.city, + state: obj.venue.state, + address: obj.venue.address, + postCode: obj.venue.postal_code, + lat: obj.venue.location.lat, + lon: obj.venue.location.lon, + }, + eventIfo: { + title: obj.title, + category: obj.type, + dateTimeUTC: obj.datetime_utc, + description: obj.description, + }, + imagesUrls: [obj.performers[0].image, obj.performers[0].images.huge], + websiteUrl: { + buyThicketsUrl: obj.url, + findThicketsUrl: obj.venue.url, + }, + }); + + var websiteUrl = eventData.websiteUrl; + var imgUrl = eventData.imagesUrls; + var altDescription = "TODO: alt text dynamically"; //? how to do dynamically img description + var eventTitle = eventData.eventInfo.title; + var footerText = "Some description, location, etc..."; //? to choose correct props etc + var card = `
`; + return card; } function renderEventsSection() { - // get arr form data and save it in eventsList - - // populate cards information - eventsList.forEach((eventData, cardIndex) => { - populateEventCardData(eventData, cardIndex); + eventsList.forEach((eventData) => { + // createCard() }); } searchBtn.click(function () { cityName = $(inputEl).val(); - // TODO add get user location + // TODO add get user location before clicking the button // ? if user have turn off location add default location cityName = "Chicago";