@@ -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
6055let currentCameraIndex = 0 ;
@@ -143,7 +138,6 @@ sendToUserInbox.addEventListener("click", () => {
143138} ) ;
144139
145140sendToUserInboxBtn . 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-
281250async 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
329298initializeCamera ( ) ;
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
341301function capturePhoto ( ) {
342302 context . drawImage ( video , 0 , 0 , 400 , 100 ) ;
@@ -375,8 +335,8 @@ takePicture.addEventListener("click", () => {
375335
376336// Menu icon toggle
377337const menuIcon = document . querySelector ( ".menu-icon" ) ;
378- const container = document . querySelector ( ".container" ) ;
338+
379339
380340menuIcon . addEventListener ( "click" , ( ) => {
381- container . classList . toggle ( "change" ) ;
341+ wrapper . classList . toggle ( "change" ) ;
382342} ) ;
0 commit comments