Skip to content

Commit fe994a6

Browse files
committed
(feat:HTML): move elements with class menu-icon and navigation into wrapper container
1 parent 2bcdcc3 commit fe994a6

5 files changed

Lines changed: 20 additions & 63 deletions

File tree

public/index.html

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,26 +20,21 @@
2020
<body>
2121

2222
<div class="container">
23-
<!-- Navigation -->
24-
<div class="menu-icon">
25-
<div class="line line-1"></div>
26-
<div class="line line-2"></div>
27-
</div>
28-
<nav class="navigation">
29-
<div class="nav-items">
30-
<a href="#recipe-section">Select Cuisine</a>
31-
<a href="#picture-section">Take a picture of your ingredients</a>
32-
</div>
33-
</nav>
34-
<!-- Content Sections -->
35-
<!-- <section id="cusine-options">Select Cuisine</section>
36-
<section id="picture-section">Take a picture of your ingredients</section> -->
37-
3823
</div>
3924
<div class="stream"></div>
4025

4126
<div aria-label="parent container" class="parent-container">
4227
<div class="wrapper">
28+
<div class="menu-icon">
29+
<div class="line line-1"></div>
30+
<div class="line line-2"></div>
31+
</div>
32+
<nav class="navigation">
33+
<div class="nav-items">
34+
<a href="#recipe-section">Select Cuisine</a>
35+
<a href="#picture-section">Take a picture of your ingredients</a>
36+
</div>
37+
</nav>
4338

4439
<div id="recipe-section" class="recipe-section">
4540

public/index.js

Lines changed: 7 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import {
1313
createAudio,
1414
createUserRecipe,
1515
cacheData,
16-
CACHE_NAME_URL,
1716
CACHE_NAME_AUDIO,
1817
audioElement,
1918
alert_message
@@ -24,28 +23,24 @@ import {
2423
backgroundImg,
2524
gptResponseElement,
2625
headline,
27-
lactoseIntolerant,
2826
loadingContainer,
2927
allergies,
3028
darkLightButton,
3129
userWantAnotherRecipe,
3230
tryAgainBtn,
3331
recipeButtons,
3432
sendRecipeToUserInboxBtn,
35-
loadingText,
3633
recording,
3734
userEmail,
3835
emailSection,
3936
sendToUserInboxBtn,
4037
dietaryRequirements,
4138
otherDietaryRequirements,
4239
userText,
43-
pictureSection,
4440
video,
4541
canvas,
4642
takePicture,
4743
context,
48-
constraint,
4944
chatGptVisionText,
5045
videoBtnCanvas,
5146
pictureSectionHeadline,
@@ -54,7 +49,7 @@ import {
5449
pictureEmailSection,
5550
previousPage,
5651
sendToUserInbox,
57-
emailUserRecipeSection,
52+
wrapper
5853
} from "./js_utilities/query_selector.js";
5954

6055
let currentCameraIndex = 0;
@@ -143,7 +138,6 @@ sendToUserInbox.addEventListener("click", () => {
143138
});
144139

145140
sendToUserInboxBtn.addEventListener("click", () => {
146-
// console.log(`userEmail ${userEmail.value}`);
147141
console.log(emailObject);
148142
fetch(`/email?${createQuery(emailObject)}`)
149143
.then((response) => response.json())
@@ -196,29 +190,20 @@ recipeButtons.forEach((button) => {
196190
if (eventData.image) {
197191
data.image = eventData.image;
198192
}
199-
// console.log("cacheObject", data);
193+
200194
console.log("data.audio", eventData.audio);
201195
console.log("data.image", eventData.image);
202196

203197
if (data.audio && data.image) {
204-
console.log(typeof data.image);
205198
removeElements([loadingContainer]);
206199
const imageUrl = data.image.data[0].url;
207-
console.log(`imageURL ${imageUrl}`);
208200
// await cacheData(imageUrl, CACHE_NAME_URL, "image");
209201
backgroundImg.src = imageUrl;
210-
backgroundImg.onload = () => {
211-
console.log("Image loaded successfully");
212-
213-
};
214-
backgroundImg.onerror = () => {
215-
console.error("Error loading image");
216-
};
217-
202+
203+
218204
///
219-
console.log(data.audio);
205+
220206
const audio_data = createAudio(data.audio);
221-
console.log(`line 261: ${audio_data}`);
222207
await cacheData(audio_data, CACHE_NAME_AUDIO, "audio");
223208
displayElementsFlex([recording]);
224209
displayElements([sendRecipeToUserInboxBtn, userWantAnotherRecipe]);
@@ -257,27 +242,11 @@ recipeButtons.forEach((button) => {
257242
});
258243
});
259244
}
260-
261-
// if (data.image) {
262-
// console.log(typeof data.image);
263-
// removeElements([loadingContainer]);
264-
// const imageUrl = data.image.data[0].url;
265-
// console.log(`imageURL ${imageUrl}`);
266-
// // await cacheData(imageUrl, CACHE_NAME_URL, "image");
267-
// backgroundImg.src = imageUrl;
268-
// backgroundImg.onload = () => {
269-
// console.log("Image loaded successfully");
270-
// };
271-
// backgroundImg.onerror = () => {
272-
// console.error("Error loading image");
273-
// };
274-
// }
275245
};
276246
});
277247
});
278248

279249
// Picture section
280-
281250
async function getVideoDevices() {
282251
const devices = await navigator.mediaDevices.enumerateDevices();
283252
return devices.filter((device) => device.kind === "videoinput");
@@ -328,15 +297,6 @@ async function initializeCamera() {
328297

329298
initializeCamera();
330299

331-
// navigator.mediaDevices
332-
// .getUserMedia(constraint)
333-
// .then((stream) => {
334-
// video.srcObject = stream;
335-
// video.play();
336-
// })
337-
// .catch((error) => {
338-
// console.error("Error accessing camera:", error);
339-
// });
340300

341301
function capturePhoto() {
342302
context.drawImage(video, 0, 0, 400, 100);
@@ -375,8 +335,8 @@ takePicture.addEventListener("click", () => {
375335

376336
// Menu icon toggle
377337
const menuIcon = document.querySelector(".menu-icon");
378-
const container = document.querySelector(".container");
338+
379339

380340
menuIcon.addEventListener("click", () => {
381-
container.classList.toggle("change");
341+
wrapper.classList.toggle("change");
382342
});

public/js_utilities/query_selector.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const emailRecipe = document.querySelector(".email-recipe");
2+
const wrapper = document.querySelector(".wrapper");
23
const emailUserRecipeSection = document.querySelector(".user-email-recipe-section");
34
const sendToUserInbox = document.querySelector(".send-to-user-inbox");
45
const previousPage = document.querySelector(".previous-page");
@@ -86,6 +87,7 @@ export {
8687
previousPage,
8788
sendToUserInbox,
8889
emailUserRecipeSection,
90+
wrapper
8991
};
9092

9193

public/url_folder.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
https://oaidalleapiprodscus.blob.core.windows.net/private/org-nYbqgo3O0LNnYYAoKAmApBfx/user-58Je7efi0iy880e2UYCdYpBm/img-1wpjmjhOyCV8QTN9mWJBvyFQ.png?st=2024-08-02T12%3A29%3A05Z&se=2024-08-02T14%3A29%3A05Z&sp=r&sv=2023-11-03&sr=b&rscd=inline&rsct=image/png&skoid=6aaadede-4fb3-4698-a8f6-684d7786b067&sktid=a48cca56-e6da-484e-a814-9c849652bcb3&skt=2024-08-01T23%3A41%3A18Z&ske=2024-08-02T23%3A41%3A18Z&sks=b&skv=2023-11-03&sig=AcczkNo41h%2Bul%2B4Ud3ztnmq9qPvt2AYdUfBzHHUgAyM%3D
1+
https://oaidalleapiprodscus.blob.core.windows.net/private/org-nYbqgo3O0LNnYYAoKAmApBfx/user-58Je7efi0iy880e2UYCdYpBm/img-FbhNg7YkuHaFXSQuJv6vvc62.png?st=2024-08-02T13%3A27%3A00Z&se=2024-08-02T15%3A27%3A00Z&sp=r&sv=2023-11-03&sr=b&rscd=inline&rsct=image/png&skoid=6aaadede-4fb3-4698-a8f6-684d7786b067&sktid=a48cca56-e6da-484e-a814-9c849652bcb3&skt=2024-08-02T07%3A44%3A05Z&ske=2024-08-03T07%3A44%3A05Z&sks=b&skv=2023-11-03&sig=j8PT8RgqGZ9hqT7/zkt1TtdR%2BW4OOsjiW4sd84k3hv8%3D

speech.mp3

-79.2 KB
Binary file not shown.

0 commit comments

Comments
 (0)