TIST-17: added single recipe page #15

Merged
steve_dekart merged 2 commits from TIST-17 into develop 2025-06-29 12:25:45 +02:00
No description provided.
greendavid004 added 1 commit 2025-06-28 15:34:25 +02:00
greendavid004 requested review from steve_dekart 2025-06-28 15:34:25 +02:00
steve_dekart reviewed 2025-06-28 18:31:51 +02:00
@ -4,0 +36,4 @@
</div>
<div class="single-recipe-data__item">
<span class="data-name">Time To Make: </span>
<span class="data"><?php echo $context['recipe']->field_estimated_time; ?> minutes</span>
Owner

Can you create a new function in the RecipeModel that returns a string combining the estimated_time field and the word “minutes”? I think it will be used repeatedly in the future.

Can you create a new function in the RecipeModel that returns a string combining the estimated_time field and the word “minutes”? I think it will be used repeatedly in the future.
greendavid004 marked this conversation as resolved
steve_dekart reviewed 2025-06-28 18:44:15 +02:00
@ -4,0 +55,4 @@
<option value="thursday">Thursday</option>
<option value="friday">Friday</option>
<option value="saturday">Saturday</option>
<option value="sunday">Sunday</option>
Owner

Days of the week can be used in different places, so it would be better to save them as a constant variable to make them reusable.

You can create a new constant variable with all day of weeks in the format ['monday' => 'Monday'], and place it in the Const/ directory as a file named recipes.php (create this directory inside /includes/ if it doesn’t exist).

After that, include it using require_once and use a foreach(DAY_OF_WEKS as $key => $label) to generate the select options.

P.s. Only day of weeks. You don't need add to this array remove. It's not day of week. You can leave that option as it is.

Days of the week can be used in different places, so it would be better to save them as a constant variable to make them reusable. You can create a new constant variable with all day of weeks in the format `['monday' => 'Monday']`, and place it in the `Const/` directory as a file named `recipes.php` (create this directory inside `/includes/` if it doesn’t exist). After that, include it using `require_once` and use a `foreach(DAY_OF_WEKS as $key => $label)` to generate the select options. P.s. Only day of weeks. You don't need add to this array `remove`. It's not day of week. You can leave that option as it is.
Owner

Check TIST-27 Pull Request and approve it. After that, then I will merge it with develop, you can make git pull origin develop.

In TIST-27 I have already added this const

Check TIST-27 Pull Request and approve it. After that, then I will merge it with develop, you can make `git pull origin develop`. In TIST-27 I have already added this const
greendavid004 marked this conversation as resolved
steve_dekart reviewed 2025-06-28 18:44:46 +02:00
@ -4,0 +71,4 @@
<div class="dropdown-item hover-anim" data-value="thursday">Thursday</div>
<div class="dropdown-item hover-anim" data-value="friday">Friday</div>
<div class="dropdown-item hover-anim" data-value="saturday">Saturday</div>
<div class="dropdown-item hover-anim" data-value="sunday">Sunday</div>
Owner

Same comment as above

Same comment as above
greendavid004 marked this conversation as resolved
steve_dekart reviewed 2025-06-28 18:50:53 +02:00
@ -4,0 +103,4 @@
<h2 class="title">Instructions</h2>
<?php
$formatted = preg_replace('/(\d+\.\s)/', "\n$1", $context['recipe']->field_instruction);
Owner

You can create a new function like get_html_instruction() in the RecipeModel, which returns the formatted instruction (as string).

And it's really important preg_replace('/(\d+\.\s)/', "\n$1", $context['recipe']->field_instruction)? I think you can use only nl2br(trim($formatted));

You can create a new function like `get_html_instruction()` in the `RecipeModel`, which returns the formatted instruction (as string). And it's really important `preg_replace('/(\d+\.\s)/', "\n$1", $context['recipe']->field_instruction)`? I think you can use only `nl2br(trim($formatted));`
greendavid004 marked this conversation as resolved
steve_dekart reviewed 2025-06-28 18:54:35 +02:00
@ -21,3 +21,3 @@
<script src="<?php echo ASSETS_PATH . '/js/main.js' ?>"></script>
<script src="<?php echo ASSETS_PATH . '/toastify/toastify-js.js' ?>"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/qrcodejs/1.0.0/qrcode.min.js"></script>
Owner

I think you need to save this file in the ASSETS_PATH like toastify.js.

I think you need to save this file in the ASSETS_PATH like `toastify.js`.
greendavid004 marked this conversation as resolved
steve_dekart reviewed 2025-06-28 19:04:05 +02:00
@ -0,0 +37,4 @@
const qrContainer = document.getElementById("qrcode");
const downloadLink = document.getElementById("downloadLink");
const qrBtn = document.getElementById("qr-btn");
const qrPopup = document.querySelector(".qr-popup");
Owner

This is not poppup, this is modal.

Of course, you can leave it, but I think you need to create your own solution for modal. It's small difficulty, but after you can use this modal everywhere.

So, every modal has same codebase:

<div id="overlay" class="hidden"></div>
<div class="qr-popup hidden"> <!-- it's not puppu, it's modal -->
 <!-- Content -->
</div>

So default behavior for every modal you can implement in the main.js. After that, make some events for it. If you need more details, I can explain how to do it

This is not poppup, this is modal. Of course, you can leave it, but I think you need to create your own solution for modal. It's small difficulty, but after you can use this modal everywhere. So, every modal has same codebase: ``` <div id="overlay" class="hidden"></div> <div class="qr-popup hidden"> <!-- it's not puppu, it's modal --> <!-- Content --> </div> ``` So default behavior for every modal you can implement in the `main.js`. After that, make some events for it. If you need more details, I can explain how to do it
Owner

We can talk about it on Discord

We can talk about it on Discord
greendavid004 marked this conversation as resolved
Owner

Delete this file media/chana-masala-recipe_684f4743a2a80.jpg. It's don't need in the media folder.

I know that you used it because we don't have image url early, but not this is file isn't neccesary

Delete this file `media/chana-masala-recipe_684f4743a2a80.jpg`. It's don't need in the media folder. I know that you used it because we don't have image url early, but not this is file isn't neccesary
greendavid004 was assigned by steve_dekart 2025-06-29 00:56:20 +02:00
greendavid004 force-pushed TIST-17 from 947616f0ff to 841865b976 2025-06-29 11:46:18 +02:00 Compare
greendavid004 force-pushed TIST-17 from 841865b976 to 76d4011c41 2025-06-29 12:24:01 +02:00 Compare
steve_dekart merged commit 420d0bfc6c into develop 2025-06-29 12:25:45 +02:00
steve_dekart deleted branch TIST-17 2025-06-29 12:25:45 +02:00
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: web_programming/fridge_bites#15
No description provided.