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