web: refresh tags on thread view in addition to search results.
This commit is contained in:
parent
0ae72b63d0
commit
d5a001bf03
@ -18,4 +18,9 @@ query ShowThreadQuery($threadId: String!) {
|
|||||||
timestamp
|
timestamp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
tags {
|
||||||
|
name
|
||||||
|
bgColor
|
||||||
|
fgColor
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -173,7 +173,13 @@ struct Model {
|
|||||||
context: Context,
|
context: Context,
|
||||||
refreshing_state: RefreshingState,
|
refreshing_state: RefreshingState,
|
||||||
ui_error: UIError,
|
ui_error: UIError,
|
||||||
tags: Option<Vec<crate::graphql::front_page_query::FrontPageQueryTags>>,
|
tags: Option<Vec<Tag>>,
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Tag {
|
||||||
|
name: String,
|
||||||
|
bg_color: String,
|
||||||
|
fg_color: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq)]
|
||||||
@ -381,7 +387,16 @@ fn update(msg: Msg, model: &mut Model, orders: &mut impl Orders<Msg>) {
|
|||||||
Msg::FrontPageResult(Ok(graphql_client::Response {
|
Msg::FrontPageResult(Ok(graphql_client::Response {
|
||||||
data: Some(data), ..
|
data: Some(data), ..
|
||||||
})) => {
|
})) => {
|
||||||
model.tags = Some(data.tags);
|
model.tags = Some(
|
||||||
|
data.tags
|
||||||
|
.into_iter()
|
||||||
|
.map(|t| Tag {
|
||||||
|
name: t.name,
|
||||||
|
bg_color: t.bg_color,
|
||||||
|
fg_color: t.fg_color,
|
||||||
|
})
|
||||||
|
.collect(),
|
||||||
|
);
|
||||||
model.context = Context::SearchResult {
|
model.context = Context::SearchResult {
|
||||||
query: model.query.clone(),
|
query: model.query.clone(),
|
||||||
results: data.search.nodes,
|
results: data.search.nodes,
|
||||||
@ -403,6 +418,16 @@ fn update(msg: Msg, model: &mut Model, orders: &mut impl Orders<Msg>) {
|
|||||||
Msg::ShowThreadResult(Ok(graphql_client::Response {
|
Msg::ShowThreadResult(Ok(graphql_client::Response {
|
||||||
data: Some(data), ..
|
data: Some(data), ..
|
||||||
})) => {
|
})) => {
|
||||||
|
model.tags = Some(
|
||||||
|
data.tags
|
||||||
|
.into_iter()
|
||||||
|
.map(|t| Tag {
|
||||||
|
name: t.name,
|
||||||
|
bg_color: t.bg_color,
|
||||||
|
fg_color: t.fg_color,
|
||||||
|
})
|
||||||
|
.collect(),
|
||||||
|
);
|
||||||
model.context = Context::ThreadResult(data.thread);
|
model.context = Context::ThreadResult(data.thread);
|
||||||
}
|
}
|
||||||
Msg::ShowThreadResult(bad) => {
|
Msg::ShowThreadResult(bad) => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user