root = Card([header, kpiSection, openRolesSection, chartsSection, interviewsSection, attritionSection, followUp])
header = CardHeader("Hiring Overview", "Live snapshot for the current quarter")
kpiSection = Card([headcountKpi, openRolesKpi, timeToHireKpi, interviewsKpi], "sunk", "row", "m")
headcountKpi = Card([headcountLabel, headcountValue], "clear", "column", "xs")
headcountLabel = TextContent("Current headcount", "small-heavy")
headcountValue = TextContent("248", "large-heavy")
openRolesKpi = Card([openRolesLabel, openRolesValue], "clear", "column", "xs")
openRolesLabel = TextContent("Open roles", "small-heavy")
openRolesValue = TextContent("12", "large-heavy")
timeToHireKpi = Card([timeToHireLabel, timeToHireValue, timeToHireDetail], "clear", "column", "xs")
timeToHireLabel = TextContent("Avg. time to hire", "small-heavy")
timeToHireValue = TextContent("32 days", "large-heavy")
timeToHireDetail = TextContent("Down from 38 days last quarter", "small")
interviewsKpi = Card([interviewsLabel, interviewsValue], "clear", "column", "xs")
interviewsLabel = TextContent("Interviews this week", "small-heavy")
interviewsValue = TextContent("14", "large-heavy")
openRolesSection = Card([openRolesHeading, rolesTable, newRoleDialog], "clear", "column", "m")
openRolesHeading = Heading("Open roles", "h2")
rolesTable = Table([roleCol, deptCol, managerCol])
roleCol = Col("Role", ["Senior Frontend Engineer", "Backend Engineer", "Product Designer", "Data Analyst", "Technical Recruiter", "Account Executive", "Content Marketing Manager", "Engineering Manager", "Product Manager", "Customer Success Lead", "Security Engineer", "People Operations Partner"])
deptCol = Col("Department", ["Engineering", "Engineering", "Design", "Data", "People", "Sales", "Marketing", "Engineering", "Product", "Customer", "Engineering", "People"])
managerCol = Col("Hiring manager", ["Maya Chen", "Maya Chen", "Leo Park", "Priya Shah", "Tom Alvarez", "Dana Ruiz", "Sara Kim", "Maya Chen", "Jordan Lee", "Dana Ruiz", "Tom Alvarez", "Tom Alvarez"])
newRoleDialog = DialogBlock("Open new role", "Create a new role", "Post a new opening so recruiters can start sourcing candidates.", [newRoleForm])
newRoleForm = Form("new-role", roleFormButtons, [roleTitleField, roleDeptField, roleLevelField, roleCountField])
roleTitleField = FormControl("Role title", roleTitleInput)
roleTitleInput = Input("role_title", "e.g. Senior Frontend Engineer")
roleDeptField = FormControl("Department", roleDeptSelect)
roleDeptSelect = Select("role_department", [deptEng, deptDes, deptProd, deptData, deptMkt, deptSales, deptPeople], "Select a department")
deptEng = SelectItem("engineering", "Engineering")
deptDes = SelectItem("design", "Design")
deptProd = SelectItem("product", "Product")
deptData = SelectItem("data", "Data")
deptMkt = SelectItem("marketing", "Marketing")
deptSales = SelectItem("sales", "Sales")
deptPeople = SelectItem("people", "People")
roleLevelField = FormControl("Level", roleLevelSelect)
roleLevelSelect = Select("role_level", [levelIc, levelMgr, levelDir], "Select a level")
levelIc = SelectItem("ic", "Individual contributor")
levelMgr = SelectItem("manager", "Manager")
levelDir = SelectItem("director", "Director")
roleCountField = FormControl("Number of openings", roleCountInput)
roleCountInput = Input("openings", "1", "number")
roleFormButtons = Buttons([postRoleBtn, cancelRoleBtn])
postRoleBtn = Button("Post role", null, "primary")
cancelRoleBtn = Button("Cancel", null, "tertiary")
chartsSection = Card([pipelineCard, deptCard], "card", "row", "m")
pipelineCard = Card([pipelineHeading, pipelineChart], "sunk", "column", "m")
pipelineHeading = Heading("Candidates by pipeline stage", "h3")
pipelineChart = HorizontalBarChart(["Applied", "Screening", "Interview", "Offer", "Hired"], [pipelineSeries], "grouped", "Pipeline stage", "Candidates")
pipelineSeries = Series("Candidates", [312, 84, 47, 12, 9])
deptCard = Card([deptHeading, deptChart], "sunk", "column", "m")
deptHeading = Heading("Headcount by department", "h3")
deptChart = PieChart(["Engineering", "Product", "Design", "Data", "Marketing", "Sales", "Customer", "People & Finance"], [96, 24, 18, 14, 22, 28, 20, 26], "donut")
interviewsSection = Card([interviewsHeading, interviewsTable], "clear", "column", "m")
interviewsHeading = Heading("Interviews scheduled this week", "h2")
interviewsTable = Table([intCandCol, intRoleCol, intWhenCol])
intCandCol = Col("Candidate", ["Amelia Ross", "David Okafor", "Nina Patel", "Marcus Webb", "Sofia Marin", "Ethan Cole", "Grace Liu", "Liam Carter", "Priya Nair", "Omar Haddad", "Julia Santos", "Ben Whitfield", "Hannah Vogel", "Ravi Menon"])
intRoleCol = Col("Role", ["Senior Frontend Engineer", "Backend Engineer", "Product Designer", "Data Analyst", "Account Executive", "Engineering Manager", "Content Marketing Manager", "Technical Recruiter", "Security Engineer", "Product Manager", "Customer Success Lead", "Backend Engineer", "Product Designer", "Account Executive"])
intWhenCol = Col("Time", ["Mon 09:00", "Mon 10:30", "Mon 14:00", "Mon 15:30", "Tue 09:30", "Tue 11:00", "Tue 13:30", "Tue 16:00", "Wed 09:00", "Wed 10:30", "Wed 14:00", "Thu 09:30", "Thu 11:00", "Thu 15:00"])
attritionSection = Card([attritionHeading, attritionChart], "clear", "column", "m")
attritionHeading = Heading("Attrition — last six months", "h2")
attritionChart = LineChart(["Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], [attritionSeries], "natural", "Month", "Attrition rate (%)")
attritionSeries = Series("Attrition rate", [3.1, 2.6, 2.9, 2.4, 3.0, 2.2])
followUp = FollowUpBlock([fu1, fu2, fu3])
fu1 = FollowUpItem("Show candidate pipeline details")
fu2 = FollowUpItem("Compare attrition by department")
fu3 = FollowUpItem("Schedule a hiring sync with recruiters")