A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.
fix: ask question page use switch component replace checkbox component
shuai2a7d3a07e419
diff --git a/ui/src/pages/Questions/Ask/index.tsx b/ui/src/pages/Questions/Ask/index.tsxindex 40ff73e2..2b370de0 100644--- a/ui/src/pages/Questions/Ask/index.tsx+++ b/ui/src/pages/Questions/Ask/index.tsx@@ -487,52 +487,17 @@ const Ask = () => {/></Form.Group>- {isEdit && (- <Form.Group controlId="edit_summary" className="my-3">- <Form.Label>{t('form.fields.edit_summary.label')}</Form.Label>- <Form.Control- type="text"- defaultValue={formData.edit_summary.value}- isInvalid={formData.edit_summary.isInvalid}- placeholder={t('form.fields.edit_summary.placeholder')}- onChange={handleSummaryChange}- contentEditable- />- <Form.Control.Feedback type="invalid">- {formData.edit_summary.errorMsg}- </Form.Control.Feedback>- </Form.Group>- )}- {!checked && (- <div className="mt-3">- <Button type="submit" className="me-2">- {isEdit ? t('btn_save_edits') : t('btn_post_question')}- </Button>- {isEdit && (- <Button variant="link" onClick={backPage}>- {t('cancel', { keyPrefix: 'btns' })}- </Button>- )}-- {hasDraft && (- <Button variant="link" onClick={deleteDraft}>- {t('discard_draft', { keyPrefix: 'btns' })}- </Button>- )}- </div>- )}{!isEdit && (<>- <Form.Check- className="mt-5"+ <Form.Switchchecked={checked}- type="checkbox"+ type="switch"label={t('answer_question')}onChange={(e) => setCheckState(e.target.checked)}id="radio-answer"/>{checked && (- <Form.Group controlId="answer" className="mt-4">+ <Form.Group controlId="answer" className="mt-3"><Form.Label>{t('form.fields.answer.label')}</Form.Label><Editorvalue={formData.answer_content.value}@@ -562,6 +527,41 @@ const Ask = () => {)}</>)}++ {isEdit && (+ <Form.Group controlId="edit_summary" className="my-3">+ <Form.Label>{t('form.fields.edit_summary.label')}</Form.Label>+ <Form.Control+ type="text"+ defaultValue={formData.edit_summary.value}+ isInvalid={formData.edit_summary.isInvalid}+ placeholder={t('form.fields.edit_summary.placeholder')}+ onChange={handleSummaryChange}+ contentEditable+ />+ <Form.Control.Feedback type="invalid">+ {formData.edit_summary.errorMsg}+ </Form.Control.Feedback>+ </Form.Group>+ )}+ {!checked && (+ <div className="mt-3">+ <Button type="submit" className="me-2">+ {isEdit ? t('btn_save_edits') : t('btn_post_question')}+ </Button>+ {isEdit && (+ <Button variant="link" onClick={backPage}>+ {t('cancel', { keyPrefix: 'btns' })}+ </Button>+ )}++ {hasDraft && (+ <Button variant="link" onClick={deleteDraft}>+ {t('discard_draft', { keyPrefix: 'btns' })}+ </Button>+ )}+ </div>+ )}{checked && (<div className="mt-3"><Button type="submit">{t('post_question&answer')}</Button>diff --git a/ui/src/pages/Search/components/Tips/index.tsx b/ui/src/pages/Search/components/Tips/index.tsxindex 2fd151f8..fe6a63d9 100644--- a/ui/src/pages/Search/components/Tips/index.tsx+++ b/ui/src/pages/Search/components/Tips/index.tsx@@ -26,7 +26,7 @@ const Index: FC = () => {return (<Card><Card.Header>{t('search.tips.title')}</Card.Header>- <Card.Body className="small ext-secondary">+ <Card.Body><div className="mb-1"><Trans i18nKey="search.tips.tag" components={{ 1: <code /> }} /></div>