{"version":3,"file":"school_selector-DY7O_kjR.js","sources":["../../../client/app/bundles/Teacher/components/shared/demoAccountBanner.tsx","../../../client/app/bundles/Teacher/components/shared/school_option.tsx","../../../client/app/bundles/Teacher/components/shared/school_not_listed_modal.tsx","../../../client/app/bundles/Teacher/components/shared/school_selector.jsx"],"sourcesContent":["import * as React from 'react'\n\nimport { disclosureIcon, } from '../../../Shared/index'\n\ninterface DemoAccountBannerProps {\n signedInOutsideDemo: boolean,\n recommendationsLink: string,\n growthSummaryLink: string,\n defaultIsExpanded?: boolean\n}\n\nconst DemoAccountBanner = ({ signedInOutsideDemo, recommendationsLink, growthSummaryLink, defaultIsExpanded, }: DemoAccountBannerProps) => {\n const [isExpanded, setIsExpanded] = React.useState(defaultIsExpanded || false)\n\n const exitHref = signedInOutsideDemo ? \"/teachers/unset_view_demo\" : \"/session\"\n\n function toggleExpansion() {\n setIsExpanded(!isExpanded)\n }\n\n let expandedContent\n\n if (isExpanded) {\n expandedContent = (\n
\n 1. Diagnostic Recommendations Report: Identify areas of growth for your students and learn how to assign recommended practice activities.\n 2. Activity Summary: See all of the completed activities for your students. Drill down to view what they wrote and the feedback they received.\n 3. Growth Report: Assign a post-test diagnostic to measure their learning gains. See the growth and learning gains for each student.\n
\n )\n }\n\n return (\n
\n
\n {/* eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions */}\n
\n
\n \n You’re in a demo account to explore sample student data. Changes will not be saved.\n
\n Exit demo account\n
\n {expandedContent}\n
\n
\n )\n}\n\nexport default DemoAccountBanner\n","import * as React from 'react';\n\ninterface SchoolOptionProps {\n selectSchool: Function;\n school: any;\n text: string;\n secondaryText: string;\n numberOfTeachersText: string;\n}\n\nexport default class SchoolOption extends React.Component {\n handleSchoolOptionClick = () => {\n const { selectSchool, school, } = this.props\n selectSchool(school.id, school)\n }\n\n render() {\n const { text, secondaryText, numberOfTeachersText, } = this.props\n return (\n
  • \n \n
  • \n )\n }\n}\n","import * as React from 'react'\nimport { Input, } from '../../../Shared/index'\n\nimport useModalAccessiblity from '../../../Shared/hooks/useModalAccessibility'\n\nexport const SchoolNotListedModal = ({\n onChangeUnlistedSchoolName,\n unlistedSchoolName,\n onChangeUnlistedSchoolZipcode,\n unlistedSchoolZipcode,\n submitSchoolNotListedInformation,\n show,\n close,\n}) => {\n const { modalRef, } = useModalAccessiblity(close)\n\n React.useEffect(() => {\n if (show) {\n modalRef.current?.showModal();\n } else {\n modalRef.current?.close();\n }\n }, [show]);\n\n return (\n \n
    \n

    School not listed?

    \n
    \n

    Please share your school name and ZIP code below. Quill will review and update our database.

    \n \n \n
    \n \n
    \n \n );\n};\n\nexport default SchoolNotListedModal;\n","import React from 'react';\n\nimport LoadingIndicator from './loading_indicator.jsx';\nimport SchoolOption from './school_option';\nimport SchoolNotListedModal from './school_not_listed_modal'\n\nimport { requestGet, requestPost, } from '../../../../modules/request';\nimport { Input, NOT_LISTED, NO_SCHOOL_SELECTED, smallWhiteCheckIcon, } from '../../../Shared/index';\nimport useDebounce from '../../hooks/useDebounce';\n\nconst mapSearchSrc = `${window.postbuildEnv.CDN_URL}/images/onboarding/map-search.svg`\n\nconst DEBOUNCE_LENGTH = 500\nconst MINIMUM_SEARCH_LENGTH = 2\nconst WHOLE_SEARCH_IS_NUMBERS_REGEX = /^\\d+$/\n\nconst SchoolSelector = ({ selectSchool, showDismissSchoolSelectionReminderCheckbox, handleDismissSchoolSelectionReminder, disableSkipForNow}) => {\n const [search, setSearch] = React.useState('')\n const [schools, setSchools] = React.useState([])\n const [errors, setErrors] = React.useState({})\n const [loading, setLoading] = React.useState(false)\n const [showNotListedModal, setShowNotListedModal] = React.useState(false)\n const [unlistedSchoolName, setUnlistedSchoolName] = React.useState('')\n const [unlistedSchoolZipcode, setUnlistedSchoolZipcode] = React.useState('')\n const [dismissSchoolSelectionReminder, setDismissSchoolSelectionReminder] = React.useState(false)\n\n const debouncedSearch = useDebounce(search, DEBOUNCE_LENGTH);\n\n React.useEffect(() => {\n if (search.length >= MINIMUM_SEARCH_LENGTH) {\n setLoading(true)\n }\n }, [search])\n\n React.useEffect(() => {\n if (search.length < MINIMUM_SEARCH_LENGTH) { return }\n // if they're typing a zip code, don't search until the full zip code is entered\n if (search.match(WHOLE_SEARCH_IS_NUMBERS_REGEX) && search.length < 5) { return }\n\n searchForSchool()\n }, [debouncedSearch])\n\n function toggleDismissReminderCheckbox() { setDismissSchoolSelectionReminder(!dismissSchoolSelectionReminder) }\n\n function handleSkipClick() {\n if (dismissSchoolSelectionReminder) {\n handleDismissSchoolSelectionReminder()\n }\n selectSchool(NO_SCHOOL_SELECTED)\n }\n\n function handleNotListedClick() {\n setShowNotListedModal(true)\n }\n\n function hideSchoolNotListedModal() { setShowNotListedModal(false) }\n\n function onChangeUnlistedSchoolName(e) { setUnlistedSchoolName(e.target.value) }\n function onChangeUnlistedSchoolZipcode(e) { setUnlistedSchoolZipcode(e.target.value) }\n\n function submitSchoolNotListedInformation() {\n requestPost('/submit_unlisted_school_information', { school_name: unlistedSchoolName, school_zipcode: unlistedSchoolZipcode }, () => {\n selectSchool(NOT_LISTED)\n })\n }\n\n function searchForSchool() {\n requestGet(\n `${window.postbuildEnv.DEFAULT_URL}/schools?search=${search}`,\n (body) => {\n setSchools(body.data)\n setLoading(false)\n }\n )\n }\n\n function updateSearch(e) {\n setSearch(e.target.value)\n }\n\n const renderLoading = () => {\n return (\n
    \n \n
    \n )\n }\n\n const renderDefault = () => {\n return (\n
    \n \"Map\n

    Search for your school above

    \n
    \n )\n }\n\n const renderSchoolNotListedModal = () => {\n return (\n \n )\n }\n\n const noSchoolSelectedSchoolOption = (\n \n )\n\n const renderSchoolsList = (schools) => {\n const schoolItems = schools.map(school => {\n const { city, number_of_teachers, state, street, text, zipcode } = school.attributes\n const numberOfTeachers = number_of_teachers\n let secondaryText = ''\n let numberOfTeachersText = ''\n if (street) {\n secondaryText = `${street}, `\n }\n if (city) {\n secondaryText += `${city}, `\n }\n if (state) {\n secondaryText += `${state} `\n }\n if (zipcode) {\n secondaryText += zipcode\n }\n if (numberOfTeachers) {\n numberOfTeachersText = `${numberOfTeachers} Quill Teacher${numberOfTeachers === 1 ? '' : 's'}`\n }\n return (\n \n )\n })\n return
      {schoolItems}{noSchoolSelectedSchoolOption}
    \n }\n\n const skipForNowCheckbox = () => {\n if (disableSkipForNow) { return }\n\n let checkbox = (\n \n )\n\n if (dismissSchoolSelectionReminder) {\n checkbox = (\n \n {smallWhiteCheckIcon.alt}\n \n )\n }\n\n const checkboxWrapper = showDismissSchoolSelectionReminderCheckbox\n ?
    {checkbox} Don't remind me again to select a school
    \n : \n\n return (\n
    \n \n {checkboxWrapper}\n
    \n )\n }\n\n const renderSchoolsListSection = () => {\n let title\n let schoolsListOrEmptyState\n\n if (loading) {\n schoolsListOrEmptyState = renderLoading()\n } else if (search.length >= MINIMUM_SEARCH_LENGTH) {\n schoolsListOrEmptyState = renderSchoolsList(schools)\n } else {\n schoolsListOrEmptyState = renderDefault()\n }\n\n return (\n
    \n
    Results
    \n {schoolsListOrEmptyState}\n {skipForNowCheckbox()}\n
    \n )\n }\n\n return (\n
    \n {renderSchoolNotListedModal()}\n \n {renderSchoolsListSection()}\n
    \n )\n}\n\nexport default SchoolSelector\n"],"names":["DemoAccountBanner","signedInOutsideDemo","recommendationsLink","growthSummaryLink","defaultIsExpanded","isExpanded","setIsExpanded","React.useState","exitHref","toggleExpansion","expandedContent","React.createElement","disclosureIcon","SchoolOption","React.Component","selectSchool","school","text","secondaryText","numberOfTeachersText","SchoolNotListedModal","onChangeUnlistedSchoolName","unlistedSchoolName","onChangeUnlistedSchoolZipcode","unlistedSchoolZipcode","submitSchoolNotListedInformation","show","close","modalRef","useModalAccessiblity","React.useEffect","_a","_b","Input","mapSearchSrc","DEBOUNCE_LENGTH","MINIMUM_SEARCH_LENGTH","WHOLE_SEARCH_IS_NUMBERS_REGEX","SchoolSelector","showDismissSchoolSelectionReminderCheckbox","handleDismissSchoolSelectionReminder","disableSkipForNow","search","setSearch","React","schools","setSchools","errors","setErrors","loading","setLoading","showNotListedModal","setShowNotListedModal","setUnlistedSchoolName","setUnlistedSchoolZipcode","dismissSchoolSelectionReminder","setDismissSchoolSelectionReminder","debouncedSearch","useDebounce","searchForSchool","toggleDismissReminderCheckbox","handleSkipClick","NO_SCHOOL_SELECTED","handleNotListedClick","hideSchoolNotListedModal","e","requestPost","NOT_LISTED","requestGet","body","updateSearch","renderLoading","LoadingIndicator","renderDefault","renderSchoolNotListedModal","noSchoolSelectedSchoolOption","renderSchoolsList","schoolItems","city","number_of_teachers","state","street","zipcode","numberOfTeachers","skipForNowCheckbox","checkbox","smallWhiteCheckIcon","checkboxWrapper","renderSchoolsListSection","schoolsListOrEmptyState"],"mappings":"0QAWA,MAAMA,GAAoB,CAAC,CAAE,oBAAAC,EAAqB,oBAAAC,EAAqB,kBAAAC,EAAmB,kBAAAC,KAAiD,CACzI,KAAM,CAACC,EAAYC,CAAa,EAAIC,EAAAA,SAAeH,GAAqB,EAAK,EAEvEI,EAAWP,EAAsB,4BAA8B,WAErE,SAASQ,GAAkB,CACzBH,EAAc,CAACD,CAAU,CAC3B,CAEI,IAAAK,EAEJ,OAAIL,IAEAK,EAAAC,EAAAA,cAAC,OAAI,UAAU,kBAAA,kBACZ,OAAK,KAAAA,EAAA,cAAC,IAAE,KAAA,KAAG,EAAIA,EAAAA,cAAC,KAAE,UAAU,iBAAiB,KAAMT,CAAA,EAAqB,mCAAiC,EAAI,uGAAqG,EACnNS,EAAAA,cAAC,OAAK,KAAAA,EAAAA,cAAC,IAAE,KAAA,KAAG,EAAKA,EAAAA,cAAA,IAAA,CAAE,UAAU,iBAAiB,KAAK,gCAAA,EAAiC,kBAAgB,EAAI,6HAA2H,EACnOA,EAAA,cAAC,OAAK,KAAAA,gBAAC,SAAE,KAAG,EAAKA,EAAA,cAAA,IAAA,CAAE,UAAU,iBAAiB,KAAMR,CAAmB,EAAA,eAAa,EAAI,sHAAoH,CAC9M,GAKFQ,EAAA,cAAC,MAAI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