Use mod name from Nexus if necessary
Non-bundled mods come without `dtmt.cfg` and therefore no way to provide a user friendly name. Similar to the other fields, use the one from Nexus in that case.
This commit is contained in:
parent
6c94723995
commit
a228ea4652
2 changed files with 9 additions and 2 deletions
|
@ -73,6 +73,7 @@ impl From<dtmt_shared::ModDependency> for ModDependency {
|
|||
#[derive(Clone, Data, Debug, Lens, serde::Serialize, serde::Deserialize)]
|
||||
pub(crate) struct NexusInfo {
|
||||
pub id: u64,
|
||||
pub name: String,
|
||||
pub version: String,
|
||||
pub author: String,
|
||||
pub summary: Arc<String>,
|
||||
|
@ -83,6 +84,7 @@ impl From<NexusMod> for NexusInfo {
|
|||
fn from(value: NexusMod) -> Self {
|
||||
Self {
|
||||
id: value.mod_id,
|
||||
name: value.name,
|
||||
version: value.version,
|
||||
author: value.author,
|
||||
summary: Arc::new(value.summary),
|
||||
|
|
|
@ -135,8 +135,13 @@ fn build_mod_list() -> impl Widget<State> {
|
|||
})
|
||||
.lens(lens!((usize, Arc<ModInfo>, bool), 1).then(ModInfo::enabled.in_arc()));
|
||||
|
||||
let name =
|
||||
Label::raw().lens(lens!((usize, Arc<ModInfo>, bool), 1).then(ModInfo::name.in_arc()));
|
||||
let name = Label::dynamic(|info: &Arc<ModInfo>, _| {
|
||||
info.nexus
|
||||
.as_ref()
|
||||
.map(|n| n.name.clone())
|
||||
.unwrap_or_else(|| info.name.clone())
|
||||
})
|
||||
.lens(lens!((usize, Arc<ModInfo>, bool), 1));
|
||||
|
||||
let version = {
|
||||
let icon = {
|
||||
|
|
Loading…
Add table
Reference in a new issue