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

Filter story river: filtering the Story River by the search input field #8675

Closed
wants to merge 11 commits into from

Conversation

BurningTreeC
Copy link
Contributor

@BurningTreeC BurningTreeC commented Oct 10, 2024

This PR is just for discussion and demonstration purposes.
It filters the Story River by a configurable search:*:words filter.
Is such a feature ok for the core?

This works by entering something in the search input field and either clicking the placeholder github button or hitting alt-F

I think the filter should be modified so that draft tiddlers never get filtered out but I don't know yet - anyway, that'd be doable

Here's a Tiddlyhost link: https://filter-story-river.tiddlyhost.com/

Copy link

Confirmed: BurningTreeC has already signed the Contributor License Agreement (see contributing.md)

core/ui/PageTemplate/story.tid Outdated Show resolved Hide resolved
title: $:/core/wiki/functions/search
tags: $:/tags/Global

\function tf.story-river.filter() [[list]addsuffix[<tv-story-list>]addsuffix[$(searchSuffix)$]substitute[]addsuffix[ ]addsuffix[:filter]addsuffix[$(searchPrefix)$]substitute[]addsuffix[{$:/state/story-river/filter}match]addsuffix[$(searchPrefix)$]substitute[]addsuffix[yes]addsuffix[$(searchSuffix)$]substitute[]addsuffix[then<currentTiddler>]addsuffix[search:]addsuffix{$:/config/StoryFilter/fields}addsuffix[:]addsuffix{$:/config/StoryFilter/flags}addsuffix[{$:/temp/search/input}]addsuffix[else{$:/state/story-river/filter}!match]addsuffix[$(searchPrefix)$]substitute[]addsuffix[yes]addsuffix[$(searchSuffix)$]substitute[]addsuffix[then<currentTiddler>]] +[addprefix[$(searchPrefix)$]substitute[]addsuffix[$(searchSuffix)$]substitute[]]
Copy link
Member

@pmario pmario Oct 11, 2024

Choose a reason for hiding this comment

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

Filters can also have several lines. In between filter runs you can add new-lines, which would probably make that filter a bit more readable.

I think it also uses some variables, that are defined somewhere else. IMO every "helper" definitions the filter needs should be defined with that filter.

I also think it needs to be written in a way that actually is understandable. As it is at the moment it is a complete mess.

May be new-lines will help already. With some brief testing I did not really figure out, how that filter works.

@pmario
Copy link
Member

pmario commented Oct 11, 2024

I did test it and did hit ALT-F several times, without having a search term or any tiddlers in the story river. -- Nothing happened.

While analysing 3rd party code I do copy paste system tiddler titles into the search field. -- hit enter -- to open those tiddlers.

The problem now was, that there is no visual indicator, that the "story filter" is active. So opening the system-tiddler with the title in the search field, did close all open tiddlers, except the system tiddler. -- But I needed them.

So I thought the "zoomin" story-view is active. -- But it wasn't. ....

What I want to say is. There needs to be a clear visual indicator, that the story-filter is active. It is extremely frustrating if you are unable to open any new tiddlers once a search term is active.

From my point of view, this type of functionality is plugin territory.

@BurningTreeC
Copy link
Contributor Author

Now there's a clear visual indicator that the story view is filtered @pmario
Also, draft tiddlers don't get filtered out anymore as it's very confusing when one clicks New Tiddler and there is no New Tiddler

Copy link
Member

@pmario pmario left a comment

Choose a reason for hiding this comment

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

I do like the new visuals -- I think outline: 2px should be enough

themes/tiddlywiki/vanilla/filter.tid Show resolved Hide resolved
core/wiki/functions/search.tid Show resolved Hide resolved
themes/tiddlywiki/vanilla/filter.tid Show resolved Hide resolved
@BurningTreeC
Copy link
Contributor Author

@pmario - do we have a filter icon?

@pmario
Copy link
Member

pmario commented Oct 11, 2024

...do we have a filter icon?

Not yet.

@linonetwo
Copy link
Contributor

linonetwo commented Oct 12, 2024

I think this should be an alternative layout plugin. I'm creating one https://github.com/tiddly-gittly/combine-rhythms (not finished yet so not opensourced) that uses https://tw-cpl.netlify.app/#Plugin_202303134647766 to filter a story river that only contains title, and a vscode style single tiddler editor on the side.

@BurningTreeC
Copy link
Contributor Author

What do you all think about this? Should we make something out of it that's core-compatible or a core plugin or should I close the PR?

@Jermolene
Copy link
Member

Thank you @BurningTreeC it has been useful to try out this PR. It's an interesting idea but I think the implementation ends up being overly complex and is rather inscrutable in use. The way that the search box is overloaded to both filter and search at the same time is a case in point.

So I think the best way to take this forward is as a plugin. I wonder whether things might be simpler if the text box for filtering was entirely separate, but I do see that this kind of overloading can be useful for power users.

@linonetwo
Copy link
Contributor

search box is overloaded to both filter and search

This is totally possible, I've refactor this from command palette plugin to be auto-complete-box plugin, it switch to filter mod when first char is [.

And code in this PR might be a much smaller wikitext version of it, based on what you said.

@BurningTreeC
Copy link
Contributor Author

Ok, this PR was a nice experiment

@Jermolene
Copy link
Member

Hi @BurningTreeC in the absence of Vercel previews, it would be great if you could upload a build to Tiddlyhost and link to it from the description of this PR

@pmario
Copy link
Member

pmario commented Oct 16, 2024

I thin a plugin would be a good idea. -- At first it seemed a bit strange, but with the clear visual indication now, I think it is very usable.

@BurningTreeC
Copy link
Contributor Author

I've added a Tiddlyhost link to the description

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