Merge pull request #15498 from overleaf/rd-input-fields

Onboarding Data Collection (step3)

GitOrigin-RevId: 0e78de5ccb7b7660ab04c904bc2fec4436b36621
This commit is contained in:
Rebeka Dekany 2023-11-08 11:07:42 +01:00 committed by Copybot
parent 774dfcb2e6
commit 19e6559e2a
7 changed files with 86 additions and 28 deletions

View file

@ -450,6 +450,7 @@
"go_page": "", "go_page": "",
"go_prev_page": "", "go_prev_page": "",
"go_to_code_location_in_pdf": "", "go_to_code_location_in_pdf": "",
"go_to_overleaf": "",
"go_to_pdf_location_in_code": "", "go_to_pdf_location_in_code": "",
"go_to_settings": "", "go_to_settings": "",
"group_admin": "", "group_admin": "",
@ -516,6 +517,7 @@
"how_it_works": "", "how_it_works": "",
"i_want_to_stay": "", "i_want_to_stay": "",
"if_you_need_to_customize_your_table_further_you_can": "", "if_you_need_to_customize_your_table_further_you_can": "",
"if_your_occupation_not_listed_type_full_name": "",
"ignore_validation_errors": "", "ignore_validation_errors": "",
"ill_take_it": "", "ill_take_it": "",
"image_file": "", "image_file": "",
@ -789,6 +791,7 @@
"open_target": "", "open_target": "",
"optional": "", "optional": "",
"or": "", "or": "",
"organization_name": "",
"organize_projects": "", "organize_projects": "",
"other_logs_and_files": "", "other_logs_and_files": "",
"other_output_files": "", "other_output_files": "",
@ -856,10 +859,10 @@
"premium_plan_label": "", "premium_plan_label": "",
"price": "", "price": "",
"primarily_work_study_question": "", "primarily_work_study_question": "",
"primarily_work_study_question_company": "",
"primarily_work_study_question_government": "", "primarily_work_study_question_government": "",
"primarily_work_study_question_nonprofit_ngo": "", "primarily_work_study_question_nonprofit_ngo": "",
"primarily_work_study_question_other": "", "primarily_work_study_question_other": "",
"primarily_work_study_question_private_company": "",
"primarily_work_study_question_university_school": "", "primarily_work_study_question_university_school": "",
"priority_support": "", "priority_support": "",
"private": "", "private": "",
@ -1093,6 +1096,7 @@
"showing_x_results_of_total": "", "showing_x_results_of_total": "",
"signature_algorithm": "", "signature_algorithm": "",
"single_sign_on_sso": "", "single_sign_on_sso": "",
"skip": "",
"something_not_right": "", "something_not_right": "",
"something_went_wrong_loading_pdf_viewer": "", "something_went_wrong_loading_pdf_viewer": "",
"something_went_wrong_processing_the_request": "", "something_went_wrong_processing_the_request": "",
@ -1134,6 +1138,9 @@
"start_by_adding_your_email": "", "start_by_adding_your_email": "",
"start_free_trial": "", "start_free_trial": "",
"start_free_trial_without_exclamation": "", "start_free_trial_without_exclamation": "",
"start_typing_find_your_company": "",
"start_typing_find_your_organization": "",
"start_typing_find_your_university": "",
"stop_compile": "", "stop_compile": "",
"stop_on_first_error": "", "stop_on_first_error": "",
"stop_on_first_error_enabled_description": "", "stop_on_first_error_enabled_description": "",
@ -1142,6 +1149,7 @@
"store_your_work": "", "store_your_work": "",
"student_disclaimer": "", "student_disclaimer": "",
"subject": "", "subject": "",
"subject_area": "",
"subject_to_additional_vat": "", "subject_to_additional_vat": "",
"submit_title": "", "submit_title": "",
"subscribe": "", "subscribe": "",
@ -1150,6 +1158,7 @@
"subscription_canceled_and_terminate_on_x": "", "subscription_canceled_and_terminate_on_x": "",
"subscription_will_remain_active_until_end_of_billing_period_x": "", "subscription_will_remain_active_until_end_of_billing_period_x": "",
"subscription_will_remain_active_until_end_of_trial_period_x": "", "subscription_will_remain_active_until_end_of_trial_period_x": "",
"suggested": "",
"sure_you_want_to_cancel_plan_change": "", "sure_you_want_to_cancel_plan_change": "",
"sure_you_want_to_change_plan": "", "sure_you_want_to_change_plan": "",
"sure_you_want_to_delete": "", "sure_you_want_to_delete": "",
@ -1300,6 +1309,7 @@
"understanding_labels": "", "understanding_labels": "",
"unfold_line": "", "unfold_line": "",
"university": "", "university": "",
"university_school": "",
"unknown": "", "unknown": "",
"unlimited_collabs": "", "unlimited_collabs": "",
"unlimited_projects": "", "unlimited_projects": "",
@ -1441,6 +1451,7 @@
"your_project_exceeded_compile_timeout_limit_on_free_plan": "", "your_project_exceeded_compile_timeout_limit_on_free_plan": "",
"your_project_near_compile_timeout_limit": "", "your_project_near_compile_timeout_limit": "",
"your_projects": "", "your_projects": "",
"your_role": "",
"your_subscription": "", "your_subscription": "",
"your_subscription_has_expired": "", "your_subscription_has_expired": "",
"youre_about_to_disable_single_sign_on": "", "youre_about_to_disable_single_sign_on": "",

View file

@ -4,10 +4,13 @@ import classnames from 'classnames'
type DownshiftInputProps = { type DownshiftInputProps = {
items: string[] items: string[]
itemsTitle?: string
inputValue: string inputValue: string
label: string label: string
setValue: React.Dispatch<React.SetStateAction<string>> setValue: React.Dispatch<React.SetStateAction<string>>
inputRef?: React.ForwardedRef<HTMLInputElement> inputRef?: React.ForwardedRef<HTMLInputElement>
showLabel?: boolean
showSuggestedText?: boolean
} & React.InputHTMLAttributes<HTMLInputElement> } & React.InputHTMLAttributes<HTMLInputElement>
const filterItemsByInputValue = ( const filterItemsByInputValue = (
@ -17,12 +20,15 @@ const filterItemsByInputValue = (
function Downshift({ function Downshift({
items, items,
itemsTitle,
inputValue, inputValue,
placeholder, placeholder,
label, label,
setValue, setValue,
disabled, disabled,
inputRef, inputRef,
showLabel = false,
showSuggestedText = false,
}: DownshiftInputProps) { }: DownshiftInputProps) {
const [inputItems, setInputItems] = useState(items) const [inputItems, setInputItems] = useState(items)
@ -68,7 +74,7 @@ function Downshift({
> >
<div {...getComboboxProps()}> <div {...getComboboxProps()}>
{/* eslint-disable-next-line jsx-a11y/label-has-for */} {/* eslint-disable-next-line jsx-a11y/label-has-for */}
<label {...getLabelProps()} className="sr-only"> <label {...getLabelProps()} className={showLabel ? '' : 'sr-only'}>
{label} {label}
</label> </label>
<input <input
@ -93,6 +99,9 @@ function Downshift({
{...getMenuProps()} {...getMenuProps()}
className="ui-select-choices ui-select-choices-content ui-select-dropdown dropdown-menu" className="ui-select-choices ui-select-choices-content ui-select-dropdown dropdown-menu"
> >
{showSuggestedText && inputItems.length && (
<li className="ui-select-title">{itemsTitle}</li>
)}
{inputItems.map((item, index) => ( {inputItems.map((item, index) => (
<li <li
className="ui-select-choices-group" className="ui-select-choices-group"

View file

@ -3,6 +3,7 @@
border: 1px solid @neutral-60; border: 1px solid @neutral-60;
border-radius: 999px; border-radius: 999px;
color: @neutral-90; color: @neutral-90;
cursor: pointer;
display: inline-flex; display: inline-flex;
font-weight: 400; font-weight: 400;
gap: 4px; gap: 4px;
@ -24,6 +25,7 @@
input[type='radio'] { input[type='radio'] {
accent-color: @green-50; accent-color: @green-50;
cursor: pointer;
height: 16px; height: 16px;
margin: 4px; margin: 4px;
width: 15px; width: 15px;
@ -39,19 +41,15 @@
} }
} }
.radio-group-col-1 { .radio-group {
align-items: flex-start;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 16px; flex-wrap: wrap;
}
.radio-group-col-2 {
display: grid;
grid-gap: 16px; grid-gap: 16px;
grid-template-columns: 1fr 1fr; height: 180px;
width: 100%;
@media (max-width: @screen-sm-min) { @media (max-width: @screen-sm-min) {
grid-template-columns: 1fr; flex-wrap: nowrap;
height: 100%;
} }
} }

View file

@ -40,6 +40,17 @@
flex-direction: column; flex-direction: column;
gap: 24px; gap: 24px;
.ui-select-container,
.select-wrapper {
label {
font-size: 14px; // override DownshiftInput and Select component label size
}
.select-trigger {
border: 1px solid @neutral-60;
color: @neutral-60;
}
}
.onboarding-question-title { .onboarding-question-title {
font-size: 20px; font-size: 20px;
} }
@ -84,7 +95,7 @@
gap: 8px; gap: 8px;
button.btn-info-ghost { button.btn-info-ghost {
color: @gray-dark; color: @neutral-90;
} }
} }
} }

View file

@ -277,6 +277,11 @@ body > .ui-select-bootstrap.open {
white-space: nowrap; white-space: nowrap;
} }
.ui-select-title {
padding: 3px 20px;
font-size: 14px ;
}
.ui-select-bootstrap .ui-select-choices-row > span:hover, .ui-select-bootstrap .ui-select-choices-row > span:focus { .ui-select-bootstrap .ui-select-choices-row > span:hover, .ui-select-bootstrap .ui-select-choices-row > span:focus {
text-decoration: none; text-decoration: none;
color: #262626; color: #262626;

View file

@ -711,6 +711,7 @@
"go_prev_page": "Go to Previous Page", "go_prev_page": "Go to Previous Page",
"go_to_account_settings": "Go to Account Settings", "go_to_account_settings": "Go to Account Settings",
"go_to_code_location_in_pdf": "Go to code location in PDF", "go_to_code_location_in_pdf": "Go to code location in PDF",
"go_to_overleaf": "Go to Overleaf",
"go_to_pdf_location_in_code": "Go to PDF location in code (Tip: double click on the PDF for best results)", "go_to_pdf_location_in_code": "Go to PDF location in code (Tip: double click on the PDF for best results)",
"go_to_settings": "Go to settings", "go_to_settings": "Go to settings",
"group_admin": "Group admin", "group_admin": "Group admin",
@ -797,6 +798,7 @@
"if_have_existing_can_link": "If you have an existing <b>__appName__</b> account on another email, you can link it to your <b>__institutionName__</b> account by clicking <b>__clickText__</b>.", "if_have_existing_can_link": "If you have an existing <b>__appName__</b> account on another email, you can link it to your <b>__institutionName__</b> account by clicking <b>__clickText__</b>.",
"if_owner_can_link": "If you own the <b>__appName__</b> account with <b>__email__</b>, you will be allowed to link it to your <b>__institutionName__</b> institutional account.", "if_owner_can_link": "If you own the <b>__appName__</b> account with <b>__email__</b>, you will be allowed to link it to your <b>__institutionName__</b> institutional account.",
"if_you_need_to_customize_your_table_further_you_can": "If you need to customize your table further, you can. Using LaTeX code, you can change anything from table styles and border styles to colors and column widths. <0>Read our guide</0> to using tables in LaTeX to help you get started.", "if_you_need_to_customize_your_table_further_you_can": "If you need to customize your table further, you can. Using LaTeX code, you can change anything from table styles and border styles to colors and column widths. <0>Read our guide</0> to using tables in LaTeX to help you get started.",
"if_your_occupation_not_listed_type_full_name": "If your __occupation__ isnt listed, you can type the full name.",
"ignore_and_continue_institution_linking": "You can also ignore this and <a href=\"__link__\">continue to __appName__ with your <b>__email__</b> account</a>.", "ignore_and_continue_institution_linking": "You can also ignore this and <a href=\"__link__\">continue to __appName__ with your <b>__email__</b> account</a>.",
"ignore_validation_errors": "Dont check syntax", "ignore_validation_errors": "Dont check syntax",
"ill_take_it": "Ill take it!", "ill_take_it": "Ill take it!",
@ -1222,6 +1224,7 @@
"optional": "Optional", "optional": "Optional",
"or": "or", "or": "or",
"organization": "Organization", "organization": "Organization",
"organization_name": "Organization name",
"organization_type": "Organization Type", "organization_type": "Organization Type",
"organize_projects": "Organize Projects", "organize_projects": "Organize Projects",
"other_actions": "Other Actions", "other_actions": "Other Actions",
@ -1332,11 +1335,11 @@
"press_and_awards": "Press &amp; awards", "press_and_awards": "Press &amp; awards",
"price": "Price", "price": "Price",
"primarily_work_study_question": "Where do you primarily work or study?", "primarily_work_study_question": "Where do you primarily work or study?",
"primarily_work_study_question_government": "In the government", "primarily_work_study_question_company": "Company",
"primarily_work_study_question_nonprofit_ngo": "In a nonprofit/NGO", "primarily_work_study_question_government": "Government",
"primarily_work_study_question_nonprofit_ngo": "Nonprofit or NGO",
"primarily_work_study_question_other": "Other", "primarily_work_study_question_other": "Other",
"primarily_work_study_question_private_company": "In a private company", "primarily_work_study_question_university_school": "University or school",
"primarily_work_study_question_university_school": "In a university or school",
"primary_email_check_question": "Is <0>__email__</0> still your email address?", "primary_email_check_question": "Is <0>__email__</0> still your email address?",
"priority_support": "Priority support", "priority_support": "Priority support",
"priority_support_info": "Our helpful Support team will prioritise and escalate your support requests where necessary.", "priority_support_info": "Our helpful Support team will prioritise and escalate your support requests where necessary.",
@ -1705,6 +1708,9 @@
"start_by_adding_your_email": "Start by adding your email address.", "start_by_adding_your_email": "Start by adding your email address.",
"start_free_trial": "Start Free Trial!", "start_free_trial": "Start Free Trial!",
"start_free_trial_without_exclamation": "Start Free Trial", "start_free_trial_without_exclamation": "Start Free Trial",
"start_typing_find_your_company": " Start typing to find your company",
"start_typing_find_your_organization": "Start typing to find your organization",
"start_typing_find_your_university": "Start typing to find your university",
"start_using_latex_now": "start using LaTeX right now", "start_using_latex_now": "start using LaTeX right now",
"start_using_sl_now": "Start using __appName__ now", "start_using_sl_now": "Start using __appName__ now",
"state": "State", "state": "State",
@ -1721,6 +1727,7 @@
"student_disclaimer": "The educational discount applies to all students at secondary and postsecondary institutions (schools and universities). We may contact you to confirm that youre eligible for the discount.", "student_disclaimer": "The educational discount applies to all students at secondary and postsecondary institutions (schools and universities). We may contact you to confirm that youre eligible for the discount.",
"student_plans": "Student Plans", "student_plans": "Student Plans",
"subject": "Subject", "subject": "Subject",
"subject_area": "Subject area",
"subject_to_additional_vat": "Prices may be subject to additional VAT, depending on your country.", "subject_to_additional_vat": "Prices may be subject to additional VAT, depending on your country.",
"submit": "submit", "submit": "submit",
"submit_title": "Submit", "submit_title": "Submit",
@ -1732,6 +1739,7 @@
"subscription_canceled_and_terminate_on_x": " Your subscription has been canceled and will terminate on <0>__terminateDate__</0>. No further payments will be taken.", "subscription_canceled_and_terminate_on_x": " Your subscription has been canceled and will terminate on <0>__terminateDate__</0>. No further payments will be taken.",
"subscription_will_remain_active_until_end_of_billing_period_x": "Your subscription will remain active until the end of your billing period, <0>__terminationDate__</0>.", "subscription_will_remain_active_until_end_of_billing_period_x": "Your subscription will remain active until the end of your billing period, <0>__terminationDate__</0>.",
"subscription_will_remain_active_until_end_of_trial_period_x": "Your subscription will remain active until the end of your trial period, <0>__terminationDate__</0>.", "subscription_will_remain_active_until_end_of_trial_period_x": "Your subscription will remain active until the end of your trial period, <0>__terminationDate__</0>.",
"suggested": "Suggested",
"suggestion": "Suggestion", "suggestion": "Suggestion",
"support_lots_of_features": "We support almost all LaTeX features, including inserting images, bibliographies, equations, and much more! Read about all the exciting things you can do with __appName__ in our <0>__help_guides_link__</0>", "support_lots_of_features": "We support almost all LaTeX features, including inserting images, bibliographies, equations, and much more! Read about all the exciting things you can do with __appName__ in our <0>__help_guides_link__</0>",
"sure_you_want_to_cancel_plan_change": "Are you sure you want to revert your scheduled plan change? You will remain subscribed to the <0>__planName__</0> plan.", "sure_you_want_to_cancel_plan_change": "Are you sure you want to revert your scheduled plan change? You will remain subscribed to the <0>__planName__</0> plan.",
@ -1929,6 +1937,7 @@
"understanding_labels": "Understanding labels", "understanding_labels": "Understanding labels",
"unfold_line": "Unfold line", "unfold_line": "Unfold line",
"university": "University", "university": "University",
"university_school": "University or school name",
"unknown": "Unknown", "unknown": "Unknown",
"unlimited": "Unlimited", "unlimited": "Unlimited",
"unlimited_bold": "<0>Unlimited</0>", "unlimited_bold": "<0>Unlimited</0>",
@ -2126,6 +2135,7 @@
"your_project_exceeded_compile_timeout_limit_on_free_plan": "Your project exceeded the compile timeout limit on our free plan.", "your_project_exceeded_compile_timeout_limit_on_free_plan": "Your project exceeded the compile timeout limit on our free plan.",
"your_project_near_compile_timeout_limit": "Your project is near the compile timeout limit for our free plan.", "your_project_near_compile_timeout_limit": "Your project is near the compile timeout limit for our free plan.",
"your_projects": "Your Projects", "your_projects": "Your Projects",
"your_role": "Your role",
"your_sessions": "Your Sessions", "your_sessions": "Your Sessions",
"your_subscription": "Your Subscription", "your_subscription": "Your Subscription",
"your_subscription_has_expired": "Your subscription has expired.", "your_subscription_has_expired": "Your subscription has expired.",

View file

@ -313,18 +313,32 @@ class MockV1Api extends AbstractMockApi {
}) })
this.app.get('/universities/list', (req, res) => { this.app.get('/universities/list', (req, res) => {
if (req.query.country_code === 'en') { const response = []
res.json([
{ const university1 = {
id: 1337, id: 1337,
name: 'Institution 1337', name: 'Institution 1337',
country_code: 'en', country_code: 'en',
departments: [], departments: [],
},
])
} else {
res.json([])
} }
const university2 = {
id: 243,
name: 'Institution 243',
country_code: 'en',
departments: [],
}
if (req.query.country_code === 'en') {
response.push(university1)
}
if (req.query.search === 'Institution') {
response.push(university1)
if (req.query.max_results !== '1') {
response.push(university2)
}
}
res.json(response)
}) })
this.app.get('/universities/list/:id', (req, res) => this.app.get('/universities/list/:id', (req, res) =>