Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add summary to recipe instructions #4410

Conversation

boc-the-git
Copy link
Collaborator

@boc-the-git boc-the-git commented Oct 22, 2024

What type of PR is this?

  • feature

What this PR does / why we need it:

Introduce a "summary" for recipe instructions, which allows you to give an instruction a "name" beyond the generic "Step 1", "Step 2", etc...

You can set the summary blank to clear it and revert to the default.

The summary shows for "completed" or non-completed steps. It operates independently of section titles.

image

image

Which issue(s) this PR fixes:

None that I know of. Commonly requested feature on Discord at least.

Special notes for your reviewer:

I put it at the top of the list as I expect it might become the most commonly used option.

I'm not super wedded to the wording I've used, so if you have suggestions for better wording please let me know.

Testing

Manual through the UI.

@@ -339,7 +374,7 @@ export default defineComponent({
// ===============================================================
// UI State Helpers

function validateTitle(title: string | undefined) {
function hasSectionTitle(title: string | undefined) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has no direct relevance to the PR, but I renamed this function to be more accurate to what it's doing.

@Kuchenpirat
Copy link
Collaborator

I think there is some potential in simplifiying the UI here.
I feel that if a user is already in edit mode they should just be able to update the step name without going through the three dot menu.
An alternative but less straight foreward way would be to add an 🖋️ edit symbol next to the text that opens the edit dialog directly.

@boc-the-git
Copy link
Collaborator Author

I like that idea @Kuchenpirat . Do you have a few lines suggestion of a code change to achieve that?

Comment on lines 148 to 152
<span :class="isEditForm ? 'handle' : ''">
<v-icon v-if="isEditForm" size="26" class="pb-1">{{ $globals.icons.arrowUpDown }}</v-icon>
{{ $t("recipe.step-index", { step: index + 1 }) }}
{{ step.summary ? step.summary : $t("recipe.step-index", { step: index + 1 }) }}
</span>
<template v-if="isEditForm">
Copy link
Collaborator

@Kuchenpirat Kuchenpirat Oct 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should allow the user to directly edit the step summary.
Using placeholder colors the default "Step #" grey communicating that this can be changed which makes the feature more easily discoverable.

Suggested change
<span :class="isEditForm ? 'handle' : ''">
<v-icon v-if="isEditForm" size="26" class="pb-1">{{ $globals.icons.arrowUpDown }}</v-icon>
{{ $t("recipe.step-index", { step: index + 1 }) }}
{{ step.summary ? step.summary : $t("recipe.step-index", { step: index + 1 }) }}
</span>
<template v-if="isEditForm">
<v-text-field
v-if="isEditForm"
v-model="step.summary"
class="headline handle"
hide-details
dense
solo
flat
:placeholder="$t('recipe.step-index', { step: index + 1 })"
>
<template #prepend>
<v-icon size="26">{{ $globals.icons.arrowUpDown }}</v-icon>
</template>
</v-text-field>
<span v-else>
{{ step.summary ? step.summary : $t("recipe.step-index", { step: index + 1 }) }}
</span>

@boc-the-git
Copy link
Collaborator Author

Thanks for the code suggestion @Kuchenpirat, I love it! The UX is a lot better now, and the code is more concise too.
I implemented almost exactly what you suggested, with just some minor formatting changes.

Copy link
Collaborator

@Kuchenpirat Kuchenpirat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to hear, seeing the amount of code the change removed i would say sometimes the easier solution is the better solution 👍

LGTM

@Kuchenpirat Kuchenpirat merged commit 3dd61f7 into mealie-recipes:mealie-next Oct 23, 2024
14 checks passed
@felixschndr
Copy link
Contributor

In German it says Schritt 1: if there is no summary. Can we get that to say Schritt 1 (without the colon)?
image

@boc-the-git
Copy link
Collaborator Author

In German it says Schritt 1: if there is no summary. Can we get that to say Schritt 1 (without the colon)?
image

That will be in the translations from Crowdin - not related to this PR 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants