[t-011] Create ComposeBar footer model + chat page builder #11

Open
opened 2026-07-05 08:31:00 +00:00 by david · 0 comments
Owner

Goal

Define the ComposeBar component type and create the chat page builder.

References

Reference

  • DESIGN.md §4 GraphQL Schema (Footer, ComposeBar types)
  • DOMAIN.md §2.8 Compose Bar

Implementation Steps

Implementation Steps

Append to existing components.py:

# src/models/components.py (append these)
@strawberry.type
class ComposeBar:
    id: str = "compose"
    placeholder: str
    actions: dict  # send, attach, voice keryx:// URLs
    disabled: bool = False

ComposeBarLoader = strawberry.union(
    "ComposeBarLoader",
    [ComposeBar],
)

@strawberry.type
class Page:
    id: str
    header: Optional[Header] = None
    empty_state: Optional[EmptyState] = None
    items: list[FeedComponent]
    footer: Optional[ComposeBarLoader] = None

2. Update src/services/page_builder.py — add build_chat_page

Append to existing page_builder.py:

# src/services/page_builder.py (append)
def build_chat_page(session_id: str, messages: list[dict]) -> dict:
    header = Header(
        title="Conversation",
        actions=[LinkAction(type="tap", label="Update name", style="normal", link=f"keryx://rename/{session_id}")],
    )
    items = []  # will be populated from messages in later task
    footer = ComposeBar(
        placeholder="Ask something...",
        actions={
            "send": f"keryx://chat/{session_id}/send",
            "attach": f"keryx://chat/{session_id}/attach",
            "voice": f"keryx://chat/{session_id}/voice",
        },
        disabled=False,
    )
    return {
        "page": {"id": "chat", "header": header, "items": items, "footer": footer},
    }

Verification Gate

Verification Gate

Run:

cd /home/david/Projects/keryx-bff && uv run python -c "
from src.services.page_builder import build_chat_page
page = build_chat_page('s1', [])
assert page['page']['footer'].placeholder == 'Ask something...'
assert page['page']['footer'].actions['send'] == 'keryx://chat/s1/send'
print('OK')"
# Expected output: OK

STOP Conditions

STOP Conditions

  • If the ComposeBar footer is missing or has wrong placeholder text, stop and fix.

Depends on: t-010

## Goal Define the ComposeBar component type and create the chat page builder. ## References ## Reference - DESIGN.md §4 GraphQL Schema (Footer, ComposeBar types) - DOMAIN.md §2.8 Compose Bar ## Implementation Steps ## Implementation Steps ### 1. Update `src/models/components.py` — add ComposeBar + Footer union Append to existing components.py: ```python # src/models/components.py (append these) @strawberry.type class ComposeBar: id: str = "compose" placeholder: str actions: dict # send, attach, voice keryx:// URLs disabled: bool = False ComposeBarLoader = strawberry.union( "ComposeBarLoader", [ComposeBar], ) @strawberry.type class Page: id: str header: Optional[Header] = None empty_state: Optional[EmptyState] = None items: list[FeedComponent] footer: Optional[ComposeBarLoader] = None ``` ### 2. Update `src/services/page_builder.py` — add build_chat_page Append to existing page_builder.py: ```python # src/services/page_builder.py (append) def build_chat_page(session_id: str, messages: list[dict]) -> dict: header = Header( title="Conversation", actions=[LinkAction(type="tap", label="Update name", style="normal", link=f"keryx://rename/{session_id}")], ) items = [] # will be populated from messages in later task footer = ComposeBar( placeholder="Ask something...", actions={ "send": f"keryx://chat/{session_id}/send", "attach": f"keryx://chat/{session_id}/attach", "voice": f"keryx://chat/{session_id}/voice", }, disabled=False, ) return { "page": {"id": "chat", "header": header, "items": items, "footer": footer}, } ``` ## Verification Gate ## Verification Gate Run: ```bash cd /home/david/Projects/keryx-bff && uv run python -c " from src.services.page_builder import build_chat_page page = build_chat_page('s1', []) assert page['page']['footer'].placeholder == 'Ask something...' assert page['page']['footer'].actions['send'] == 'keryx://chat/s1/send' print('OK')" # Expected output: OK ``` ## STOP Conditions ## STOP Conditions - If the ComposeBar footer is missing or has wrong placeholder text, stop and fix. Depends on: t-010
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: david/keryx-bff#11
No description provided.