Skip to content

Commit 8376aac

Browse files
authored
Merge pull request #56 from microsoft/adesousa_microsoft/styling-updates
text update and fix character limit bug
2 parents 7e51c47 + b272c7f commit 8376aac

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

frontend/src/components/DraftCards/SectionCard.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,11 @@ const SectionCard = ({ sectionIdx }: SectionCardProps) => {
147147
content: responseBody.section_content
148148
}
149149
appStateContext?.dispatch({ type: 'UPDATE_SECTION', payload: { sectionIdx: sectionIdx, section: updatedSection } })
150-
const content = updatedSection.content || ''
150+
let content = updatedSection.content || ''
151151

152152
// limit the character count to 2000
153153
if (content.length > sectionCharacterLimit) {
154-
updatedSection.content = content.slice(0, sectionCharacterLimit)
154+
content = content.slice(0, sectionCharacterLimit)
155155
}
156156

157157
setCharCount(content.length)

frontend/src/pages/chat/Chat.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ const enum contentTemplateSections {
6363
NewLine = '\n\n',
6464
Intro = 'The proposal will include the following sections:',
6565
Closing = 'Does this look good? If so, you can **generate the document** now. You can also ask me to **add an item** or **change the order of the sections**.',
66-
JSONParseError = 'Unable to parse the template response into a valid structure. Please try again.',
66+
JSONParseError = 'Could not create a template, please try again and ask for a document type.',
6767
JSONStructureError = 'Unable to render the sections within the template. Please try again.'
6868
}
6969

frontend/src/pages/draft/Draft.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useState, useContext } from 'react'
22
import styles from './Draft.module.css'
3-
import { useLocation } from 'react-router-dom'
3+
import { useLocation, useNavigate } from 'react-router-dom'
44
import TitleCard from '../../components/DraftCards/TitleCard'
55
import SectionCard from '../../components/DraftCards/SectionCard'
66
import { Document, Packer, Paragraph, TextRun } from 'docx'
@@ -12,12 +12,18 @@ const Draft = (): JSX.Element => {
1212
const appStateContext = useContext(AppStateContext)
1313
const location = useLocation()
1414
const [title, setTitle] = useState('')
15+
const navigate = useNavigate()
1516

1617
// get draftedDocument from context
1718
const draftedDocument = appStateContext?.state.draftedDocument
1819
const sections = draftedDocument?.sections ?? []
1920
const aiWarningLabel = 'AI-generated content may be incorrect'
2021

22+
// redirect to home page if draftedDocument is empty
23+
if (!draftedDocument) {
24+
navigate('/')
25+
}
26+
2127
const exportToWord = () => {
2228
const doc = new Document({
2329
sections: [

0 commit comments

Comments
 (0)