diff.rs icon indicating copy to clipboard operation
diff.rs copied to clipboard

Use callback in the FileTree component to generate links for files.

Open xfbs opened this issue 1 year ago • 0 comments

In the FileTree component, clicking on a file works like clicking on a link.

We want to be able to use this component in multiple places. For that reason, we need to have some way for it to translate a path into a link. Currently, this translation is hard-coded. But ideally, it should accept some kind of a Callback that is a Fn(Utf8PathBuf) -> Route so that we can use it in arbitrary places.

Example use-case of this is to use this component in the view where you can see a diff between a crate and what is in the repository. In that case, the links need to be Route::RepoFile rather than Route::Diff.

xfbs avatar Oct 20 '24 20:10 xfbs