from nicegui import ui

ui.colors(primary="#2563eb")


# ----------------------------------------------------------------------
# Header
# ----------------------------------------------------------------------

with ui.header(elevated=True).classes("items-center justify-between"):
    ui.label("Document Review").classes("text-xl font-bold")

    with ui.row().classes("items-center"):
        ui.button(icon="zoom_out")
        ui.button(icon="zoom_in")
        ui.separator().props("vertical")
        ui.input("Search").props("dense outlined")
        ui.button("Export")


# ----------------------------------------------------------------------
# Main split view
# ----------------------------------------------------------------------

with ui.splitter(value=70).classes("w-full h-[calc(100vh-64px)]") as splitter:
    # ==============================================================
    # Left panel
    # ==============================================================

    with splitter.before, ui.column().classes("w-full h-full items-center bg-slate-100"):
        # This can later become:
        # - interactive_image
        # - OpenSeadragon
        # - Leaflet
        # - custom HTML component

        ui.image("https://picsum.photos/900/1200").classes("max-h-full max-w-full object-contain")

    # ==============================================================
    # Right panel
    # ==============================================================

    with splitter.after, ui.scroll_area().classes("w-full h-full"), ui.column().classes("w-full p-4 gap-3"):
        with ui.expansion("Summary", icon="description", value=True):
            ui.label("Short description of the document.")

        with ui.expansion("OCR Text"):
            ui.textarea().props("readonly").classes("w-full")

        with ui.expansion("Entities", value=True):
            ui.chip("Person")
            ui.chip("Organization")
            ui.chip("Date")

        with ui.expansion("AI Analysis"):
            ui.markdown("""
                    - Confidence: 98%
                    - Language: English
                    - Contains signature
                    """)

        with ui.expansion("Notes"):
            ui.textarea(placeholder="Add notes...").classes("w-full")


ui.run(port=8081)
