Add similar app recommendations from shared categories
This commit is contained in:
@@ -868,6 +868,38 @@ fn build_overview_tab(record: &AppImageRecord, db: &Rc<Database>) -> gtk::Box {
|
||||
}
|
||||
inner.append(&info_group);
|
||||
|
||||
// "You might also like" - similar apps from the user's library
|
||||
if let Some(ref cats) = record.categories {
|
||||
if let Ok(similar) = db.find_similar_apps(cats, record.id, 4) {
|
||||
if !similar.is_empty() {
|
||||
let similar_group = adw::PreferencesGroup::builder()
|
||||
.title("You might also like")
|
||||
.build();
|
||||
|
||||
for (id, name, icon_path) in &similar {
|
||||
let row = adw::ActionRow::builder()
|
||||
.title(name.as_str())
|
||||
.activatable(true)
|
||||
.build();
|
||||
|
||||
let icon = widgets::app_icon(
|
||||
icon_path.as_deref(),
|
||||
name,
|
||||
32,
|
||||
);
|
||||
row.add_prefix(&icon);
|
||||
|
||||
// Store the record ID in the widget name for navigation
|
||||
row.set_widget_name(&format!("similar-{}", id));
|
||||
|
||||
similar_group.add(&row);
|
||||
}
|
||||
|
||||
inner.append(&similar_group);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
clamp.set_child(Some(&inner));
|
||||
tab.append(&clamp);
|
||||
tab
|
||||
|
||||
Reference in New Issue
Block a user