fix: feature gating for blog breaking other builds

This commit is contained in:
Erica Marigold 2025-08-11 19:01:08 +01:00
parent 27eaf50448
commit 4d6d8974e4
Signed by: DevComp
SSH key fingerprint: SHA256:jD3oMT4WL3WHPJQbrjC3l5feNCnkv7ndW8nYaHX5wFw

View file

@ -9,7 +9,7 @@ use ratatui::{prelude::*, widgets::*};
use tokio::sync::mpsc::UnboundedSender; use tokio::sync::mpsc::UnboundedSender;
use super::Component; use super::Component;
use crate::{action::Action, atproto, config::Config}; use crate::{action::Action, config::Config};
#[derive(Default)] #[derive(Default)]
pub struct Content { pub struct Content {
@ -178,7 +178,7 @@ impl Content {
/// Generate the content for the "Blog" tab /// Generate the content for the "Blog" tab
#[cfg(feature = "blog")] #[cfg(feature = "blog")]
async fn blog_content(&self) -> Result<Vec<Line<'static>>> { async fn blog_content(&self) -> Result<Vec<Line<'static>>> {
Ok(atproto::blog::get_all_posts() Ok(crate::atproto::blog::get_all_posts()
.await? .await?
.iter() .iter()
.map(|post| Line::from(post.title.clone().unwrap_or("<unknown>".to_string()))) .map(|post| Line::from(post.title.clone().unwrap_or("<unknown>".to_string())))
@ -211,15 +211,17 @@ impl Component for Content {
0 => self.about_content(area)?, 0 => self.about_content(area)?,
1 => self.projects_content(), 1 => self.projects_content(),
2 => { 2 => {
if cfg!(feature = "blog") { #[cfg(feature = "blog")]
{
let rt = tokio::runtime::Handle::current(); let rt = tokio::runtime::Handle::current();
rt.block_on(self.blog_content())? rt.block_on(self.blog_content())?
} else { }
#[cfg(not(feature = "blog"))]
vec![Line::from( vec![Line::from(
"Blog feature is disabled. Enable the `blog` feature to view this tab.", "Blog feature is disabled. Enable the `blog` feature to view this tab.",
)] )]
} }
}
_ => unreachable!(), _ => unreachable!(),
}; };