Skip to content

Commit 5c3a10c

Browse files
committed
(feat:JS): create createImage
1 parent 8213a32 commit 5c3a10c

3 files changed

Lines changed: 19 additions & 8 deletions

File tree

public/index.js

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -195,17 +195,20 @@ recipeButtons.forEach((button) => {
195195
console.log("data.image", eventData.image);
196196

197197
if (data.audio && data.image) {
198-
removeElements([loadingContainer]);
199-
const imageUrl = data.image.data[0].url;
200-
// await cacheData(imageUrl, CACHE_NAME_URL, "image");
201-
backgroundImg.src = imageUrl;
198+
199+
createImage(data)
200+
201+
202+
202203

203204

204205
///
205-
206+
207+
// await cacheData(imageUrl, CACHE_NAME_URL, "image");
208+
206209
// const audio_data = createAudio(data.audio);
207210
// await cacheData(audio_data, CACHE_NAME_AUDIO, "audio");
208-
const { speedBtn, speechBtns } = createTextToSpeech(data);
211+
const {speedBtn, speechBtns } = createTextToSpeech(data);
209212

210213
userWantAnotherRecipe.addEventListener("click", () => {
211214
displayElements([headline, allergies, ...recipeButtons, mainElement]);
@@ -238,6 +241,14 @@ recipeButtons.forEach((button) => {
238241
});
239242
});
240243

244+
245+
function createImage(param) {
246+
removeElements([loadingContainer]);
247+
const imageUrl = param.image.data[0].url;
248+
backgroundImg.src = imageUrl;
249+
return backgroundImg;
250+
}
251+
241252
function createTextToSpeech(param) {
242253
displayElementsFlex([recording]);
243254
displayElements([sendRecipeToUserInboxBtn, userWantAnotherRecipe]);
@@ -248,7 +259,7 @@ function createTextToSpeech(param) {
248259
this.pause();
249260
this.currentTime = 0;
250261
};
251-
return { speedBtn, speechBtns };
262+
return {speedBtn, speechBtns };
252263
}
253264

254265
// Picture section

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-v4eTdg1soovxNTLukfLAet4U.png?st=2024-08-03T12%3A48%3A57Z&se=2024-08-03T14%3A48%3A57Z&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-03T09%3A29%3A53Z&ske=2024-08-04T09%3A29%3A53Z&sks=b&skv=2023-11-03&sig=NOzBmZWL4td4uKehhQo3lpiX8ageP%2BgXh3pp%2BNpLiAg%3D
1+
https://oaidalleapiprodscus.blob.core.windows.net/private/org-nYbqgo3O0LNnYYAoKAmApBfx/user-58Je7efi0iy880e2UYCdYpBm/img-fbR4IrnpCaFXDhT8PUcmxpzx.png?st=2024-08-03T13%3A15%3A50Z&se=2024-08-03T15%3A15%3A50Z&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-03T02%3A55%3A58Z&ske=2024-08-04T02%3A55%3A58Z&sks=b&skv=2023-11-03&sig=sG/XDU1mSuiPQI07H8PG/7h3tfkc0OOEVLwAOds4aIg%3D

speech.mp3

316 KB
Binary file not shown.

0 commit comments

Comments
 (0)