root = Card([header, kpiRow, openRolesSection, pipelineSection, deptSplitSection, interviewsSection, attritionSection, newRoleAction])
header = CardHeader("Hiring Overview", "Live snapshot of recruitment health")
kpiRow = Card([headcountCard, timeToHireCard], "clear", "row", "l")
headcountCard = Card([headcountLabel, headcountValue], "sunk", "column", "xs", "center")
headcountLabel = TextContent("Current Headcount", "small")
headcountValue = TextContent("247", "large-heavy")
timeToHireCard = Card([ttLabel, ttValue], "sunk", "column", "xs", "center")
ttLabel = TextContent("Avg Time to Hire", "small")
ttValue = TextContent("38 days", "large-heavy")
openRolesSection = Card([openRolesHeader, openRolesTable], "card", "column", "m")
openRolesHeader = Heading("Open Roles", "h3")
openRolesTable = Table([roleCol, deptCol, statusCol, postedCol])
roleCol = Col("Role", ["Senior Frontend Engineer", "Product Designer", "Backend Engineer", "DevOps Engineer", "Sales Development Rep", "Customer Success Manager"])
deptCol = Col("Department", ["Engineering", "Design", "Engineering", "Engineering", "Sales", "Customer Success"])
statusCol = Col("Status", ["Active", "Active", "Approved", "Active", "Active", "Approved"])
postedCol = Col("Days Posted", [12, 8, 3, 15, 22, 5])
pipelineSection = Card([pipelineHeader, pipelineChart], "card", "column", "m")
pipelineHeader = Heading("Candidate Pipeline", "h3")
pipelineChart = HorizontalBarChart(pipelineLabels, [pipelineSeries], "grouped", "Candidates", "Stage")
pipelineLabels = ["Applied", "Screen", "Technical", "Onsite", "Offer", "Hired"]
pipelineSeries = Series("Count", [142, 67, 34, 18, 9, 4])
deptSplitSection = Card([deptHeader, deptChart], "card", "column", "m")
deptHeader = Heading("Headcount by Department", "h3")
deptChart = PieChart(deptLabels, deptValues, "donut")
deptLabels = ["Engineering", "Sales", "Customer Success", "Design", "Product", "Marketing", "Ops", "Finance", "HR"]
deptValues = [89, 42, 31, 18, 14, 12, 11, 8, 22]
interviewsSection = Card([interviewsHeader, interviewsList], "card", "column", "m")
interviewsHeader = Heading("Interviews This Week", "h3")
interviewsList = ListBlock(interviewItems, "number")
interviewItems = [iv1, iv2, iv3, iv4, iv5]
iv1 = ListItem("Senior Frontend — Onsite", "Mon 10:00 AM • Sarah Chen • Engineering", null, "View")
iv2 = ListItem("Product Designer — Technical", "Tue 2:00 PM • Marcus Johnson • Design", null, "View")
iv3 = ListItem("Backend Engineer — Screen", "Wed 11:00 AM • Priya Patel • Engineering", null, "View")
iv4 = ListItem("DevOps — Onsite", "Thu 9:00 AM • James Wilson • Engineering", null, "View")
iv5 = ListItem("Sales Dev Rep — Final", "Fri 3:00 PM • Emily Davis • Sales", null, "View")
attritionSection = Card([attritionHeader, attritionChart], "card", "column", "m")
attritionHeader = Heading("Attrition (Last 6 Months)", "h3")
attritionChart = LineChart(attritionLabels, [attritionSeries], "natural", "Month", "Departures")
attritionLabels = ["Jan", "Feb", "Mar", "Apr", "May", "Jun"]
attritionSeries = Series("Departures", [3, 5, 2, 4, 6, 3])
newRoleAction = Card([newRoleBtn], "clear", "row", "m", "center")
newRoleBtn = DialogBlock("Open New Role", "Create Job Requisition", "Define the role, department, and requirements to start hiring", newRoleForm, "primary")
newRoleForm = Form("new-role", formButtons, [titleField, deptField, typeField, levelField, descField])
titleField = FormControl("Role Title", titleInput, "e.g. Senior Backend Engineer")
titleInput = Input("title", "Enter role title")
deptField = FormControl("Department", deptSelect)
deptSelect = Select("department", deptOptions, "Select department")
deptOptions = [optEng, optSales, optCS, optDesign, optProduct, optMarketing, optOps, optFinance, optHR]
optEng = SelectItem("engineering", "Engineering")
optSales = SelectItem("sales", "Sales")
optCS = SelectItem("customer-success", "Customer Success")
optDesign = SelectItem("design", "Design")
optProduct = SelectItem("product", "Product")
optMarketing = SelectItem("marketing", "Marketing")
optOps = SelectItem("operations", "Operations")
optFinance = SelectItem("finance", "Finance")
optHR = SelectItem("hr", "Human Resources")
typeField = FormControl("Employment Type", typeRadio)
typeRadio = RadioGroup("employment_type", [typeFull, typeContract, typePart], "full-time")
typeFull = RadioItem("Full-time", "Permanent full-time position", "full-time")
typeContract = RadioItem("Contract", "Fixed-term contract", "contract")
typePart = RadioItem("Part-time", "Part-time position", "part-time")
levelField = FormControl("Seniority Level", levelSelect)
levelSelect = Select("level", levelOptions, "Select level")
levelOptions = [lvlJunior, lvlMid, lvlSenior, lvlLead, lvlPrincipal]
lvlJunior = SelectItem("junior", "Junior (0-2 years)")
lvlMid = SelectItem("mid", "Mid-level (2-5 years)")
lvlSenior = SelectItem("senior", "Senior (5-8 years)")
lvlLead = SelectItem("lead", "Lead (8+ years)")
lvlPrincipal = SelectItem("principal", "Principal (10+ years)")
descField = FormControl("Description", descArea, "Key responsibilities, requirements, and nice-to-haves")
descArea = TextArea("description", "Describe the role...", 6)
formButtons = Buttons([submitBtn, cancelBtn])
submitBtn = Button("Create Requisition", null, "primary")
cancelBtn = Button("Cancel", null, "tertiary")