Skip to content

Commit

Permalink
hideo-files: Tweaked the breadcrumb.
Browse files Browse the repository at this point in the history
  • Loading branch information
sleepy-monax committed Nov 3, 2024
1 parent ac1cf81 commit 729d459
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
25 changes: 14 additions & 11 deletions src/apps/hideo-files/widgets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <mdi/arrow-left.h>
#include <mdi/arrow-right.h>
#include <mdi/arrow-up.h>
#include <mdi/bookmark.h>
#include <mdi/bookmark-outline.h>
#include <mdi/chevron-right.h>
#include <mdi/content-copy.h>
#include <mdi/content-cut.h>
Expand Down Expand Up @@ -185,6 +185,17 @@ Ui::Child breadcrumbRoot(Mime::Url const &url) {
}

Ui::Child breadcrumb(State const &state) {
Ui::Children items;
items.pushBack(breadcrumbRoot(state.currentUrl()));
state
.currentUrl()
.iter()
.mapi([&](auto const &text, usize i) {
items.pushBack(breadcrumbItem(text, state.currentUrl().len() - i - 1));
return true;
})
.collect();

return Ui::box(
{
.borderRadii = 4,
Expand All @@ -193,18 +204,10 @@ Ui::Child breadcrumb(State const &state) {
},
Ui::hflow(
Ui::empty(12),
breadcrumbRoot(state.currentUrl()),

Ui::hflow(state
.currentUrl()
.iter()
.mapi([&](auto const &text, usize i) {
return breadcrumbItem(text, state.currentUrl().len() - i - 1);
})
.collect<Ui::Children>()) |
Ui::hflow(items) |
Ui::hscroll() |
Ui::grow(),
Ui::button(Model::bind<AddBookmark>(), Ui::ButtonStyle::subtle(), Mdi::BOOKMARK)
Ui::button(Model::bind<AddBookmark>(), Ui::ButtonStyle::subtle(), Mdi::BOOKMARK_OUTLINE)
)
);
}
Expand Down
4 changes: 4 additions & 0 deletions src/libs/karm-base/iter.h
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,10 @@ struct Iter {
return NONE;
}

constexpr auto collect() {
forEach([&](auto const&...) {});
}

template <typename C>
constexpr auto collect(C &c) {
forEach([&](auto v) {
Expand Down

0 comments on commit 729d459

Please sign in to comment.