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

List hide empty #673

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

List hide empty #673

wants to merge 3 commits into from

Conversation

mfulz
Copy link

@mfulz mfulz commented Nov 20, 2024

Added a setting to list which can hide the "No items" on an empty list

@mfulz mfulz requested a review from meowgorithm as a code owner November 20, 2024 15:06
@FFCoder
Copy link

FFCoder commented Nov 20, 2024

I wonder if it would be better to just be called "HideEmptyStatus" rather than "SetHideEmpty"?

@mfulz
Copy link
Author

mfulz commented Nov 20, 2024

I wonder if it would be better to just be called "HideEmptyStatus" rather than "SetHideEmpty"?

For me personally it doesn't matter, but I was following the other methods like: SetShowHelp, SetShowTitle, etc. which was the most obvious match to me. Especially if thinking of dynamic switching that one on and off, where HideEmptyStatus(false) would seem a bit weird to me :)

@meowgorithm
Copy link
Member

meowgorithm commented Nov 21, 2024

So part of me wonders if the API should be something like the following to provide more flexibility around how that empty items message is rendered.

type Model structure {
    EmptyItemsNote func(string) string
}

And by default it would be something like:

m.EmptyItemsNote = func(itemsPlural string) string {
    return fmt.Sprintf("(no %s)", itemsPlural)
}

And to hide it you'd:

m.EmptyItemsNote = nil
m.RemoveEmptyItemsNote() // Maybe also a helper?

@mfulz
Copy link
Author

mfulz commented Nov 21, 2024

So part of me wonders if the API should be something like the following to provide more flexibility around how that empty items message is rendered.

type Model structure {
    EmptyItemsNote func(string) string
}

And by default it would be something like:

m.EmptyItemsNote = func(itemsPlural string) string {
    return fmt.Sprintf("(no %s)", itemsPlural)
}

And to hide it you'd:

m.EmptyItemsNote = nil
m.RemoveEmptyItemsNote() // Maybe also a helper?

That's a way better idea :)

@meowgorithm
Copy link
Member

Okay cool! Do you mind updating accordingly?

@mfulz
Copy link
Author

mfulz commented Nov 22, 2024

Okay cool! Do you mind updating accordingly?

Done :)

@meowgorithm
Copy link
Member

Thank you! This looks good on first glance: we'll give it a proper review shortly.

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

Successfully merging this pull request may close these issues.

4 participants