from rio import Column, Component, event

from src.ezgg_lan_manager import ConfigurationService
from src.ezgg_lan_manager.components.NewsPost import NewsPost


class PlaceholderPage(Component):
    placeholder_name: str

    @event.on_populate
    async def on_populate(self) -> None:
        await self.session.set_title(f"{self.session[ConfigurationService].get_lan_info().name} - {self.placeholder_name}")

    def build(self) -> Component:
        return Column(
            NewsPost(
                title="Platzhalter",
                text=f"Dies ist die Platzhalterseite für {self.placeholder_name}.",
                date="99.99.9999"
            ),
            align_y=0,
        )
