from textual.widgets import Static, Label from textual.containers import Container from typing import List, Optional class PullRequestCard(Container): def __init__( self, title: str, author: str, number: int, draft: bool = False, labels: List[str] = None, **kwargs ): super().__init__(**kwargs) self.title = title self.author = author self.number = number self.draft = draft self.labels = labels or [] def compose(self) -> ComposeResult: yield Label(f"PR #{self.number}: {self.title}", classes="pr-title") yield Static(f"by {self.author}", classes="pr-author") if self.labels: yield Static(f"Labels: {', '.join(self.labels)}", classes="pr-labels") if self.draft: yield Static("[DRAFT]", classes="draft-badge")