Initial upload: DevDash CLI with TUI dashboard
Some checks failed
CI / test (push) Has been cancelled
Some checks failed
CI / test (push) Has been cancelled
This commit is contained in:
29
src/ui/components/cards.py
Normal file
29
src/ui/components/cards.py
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
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")
|
||||||
Reference in New Issue
Block a user