Add h1 for discussion topic form

closes VICE-4049
flag=discussion_create

Test Plan
1. Open a new discussion topic
2. Verify there is a h1 at the top
3. Verify that it matches legacy create form h1

ui/features/discussion_topic_edit/jst/EditView.handlebars

Change-Id: Ia9ac2f10e1519f2aedc2cb2c721d3f0fa12f0622
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/339883
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Samuel Lee <samuel.lee@instructure.com>
QA-Review: Omar Soto-Fortuño <omar.soto@instructure.com>
Product-Review: Jason Gillett <jason.gillett@instructure.com>
This commit is contained in:
Jason Gillett 2024-02-06 15:30:51 -07:00
parent e192dec92c
commit a420e3f526
1 changed files with 10 additions and 2 deletions

View File

@ -48,6 +48,7 @@ import {AttachmentDisplay} from '@canvas/discussions/react/components/Attachment
import {responsiveQuerySizes} from '@canvas/discussions/react/utils'
import {UsageRightsContainer} from '../../containers/usageRights/UsageRightsContainer'
import {AlertManagerContext} from '@canvas/alerts/react/AlertManager'
import {ScreenReaderContent} from '@instructure/ui-a11y-content'
import {
addNewGroupCategoryToCache,
@ -72,10 +73,10 @@ export default function DiscussionTopicForm({
const rceRef = useRef()
const {setOnFailure} = useContext(AlertManagerContext)
const isAnnouncement = ENV.DISCUSSION_TOPIC?.ATTRIBUTES?.is_announcement ?? false
const isAnnouncement = ENV?.DISCUSSION_TOPIC?.ATTRIBUTES?.is_announcement ?? false
const isUnpublishedAnnouncement =
isAnnouncement && !ENV.DISCUSSION_TOPIC?.ATTRIBUTES.course_published
const isEditingAnnouncement = isAnnouncement && ENV.DISCUSSION_TOPIC?.ATTRIBUTES.id
const isEditingAnnouncement = isAnnouncement && ENV?.DISCUSSION_TOPIC?.ATTRIBUTES.id
const published = currentDiscussionTopic?.published ?? false
const announcementAlertProps = () => {
@ -703,6 +704,13 @@ export default function DiscussionTopicForm({
return (
<>
<ScreenReaderContent>
{title ? (
<h1>{title}</h1>
) : (
<h1>{isAnnouncement ? I18n.t('New Announcement') : I18n.t('New Discussion')}</h1>
)}
</ScreenReaderContent>
<FormFieldGroup description="" rowSpacing="small">
{(isUnpublishedAnnouncement || isEditingAnnouncement) && (
<Alert variant={announcementAlertProps().variant}>{announcementAlertProps().text}</Alert>