render follow pack by index from virtual list

Signed-off-by: kernelkind <kernelkind@gmail.com>
This commit is contained in:
kernelkind
2025-08-25 21:16:05 -04:00
parent c06d18f76b
commit 8b5464641d
2 changed files with 91 additions and 43 deletions

View File

@@ -5,7 +5,7 @@ use nostrdb::Ndb;
use notedeck::{Images, JobPool, JobsCache, Localization};
use notedeck_ui::{
colors,
nip51_set::{Nip51SetUiCache, Nip51SetWidget, Nip51SetWidgetFlags, Nip51SetWidgetResponse},
nip51_set::{Nip51SetUiCache, Nip51SetWidget, Nip51SetWidgetAction, Nip51SetWidgetFlags},
};
use crate::{onboarding::Onboarding, ui::widgets::styled_button};
@@ -71,24 +71,37 @@ impl<'a> FollowPackOnboardingView<'a> {
.max_height(max_height)
.show(ui, |ui| {
egui::Frame::new().inner_margin(8.0).show(ui, |ui| {
if let Some(resp) = Nip51SetWidget::new(
follow_pack_state,
self.ui_state,
self.ndb,
self.loc,
self.images,
self.job_pool,
self.jobs,
)
.with_flags(Nip51SetWidgetFlags::TRUST_IMAGES)
.ui(ui)
{
match resp {
Nip51SetWidgetResponse::ViewProfile(pubkey) => {
action = Some(OnboardingResponse::ViewProfile(pubkey));
self.onboarding.list.borrow_mut().ui_custom_layout(
ui,
follow_pack_state.len(),
|ui, index| {
let resp = Nip51SetWidget::new(
follow_pack_state,
self.ui_state,
self.ndb,
self.loc,
self.images,
self.job_pool,
self.jobs,
)
.with_flags(Nip51SetWidgetFlags::TRUST_IMAGES)
.render_at_index(ui, index);
if let Some(cur_action) = resp.action {
match cur_action {
Nip51SetWidgetAction::ViewProfile(pubkey) => {
action = Some(OnboardingResponse::ViewProfile(pubkey));
}
}
}
}
}
if resp.rendered {
1
} else {
0
}
},
);
})
});