Skip to content

Commit

Permalink
Merge pull request #439 from NEU-DSG/fix-paragraph-panel-unauthed
Browse files Browse the repository at this point in the history
fix paragraph panel unauthed
  • Loading branch information
GracefulLemming authored Dec 6, 2024
2 parents df1f47a + b85c1a9 commit a91c1df
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
6 changes: 4 additions & 2 deletions website/src/graphql/dailp/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1343,7 +1343,7 @@ export type DocFormFieldsFragment = {
}

export type ParagraphFormFieldsFragment = {
readonly __typename?: "DocumentParagraph"
readonly __typename: "DocumentParagraph"
} & Pick<DocumentParagraph, "id" | "index" | "translation"> & {
readonly source: ReadonlyArray<
| ({ readonly __typename: "AnnotatedForm" } & Pick<
Expand Down Expand Up @@ -1416,7 +1416,7 @@ export type ParagraphFormFieldsFragment = {
{ readonly __typename?: "Comment" } & Pick<Comment, "id">
>
})
| { readonly __typename?: "LineBreak" }
| { readonly __typename: "LineBreak" }
>
readonly comments: ReadonlyArray<
{ readonly __typename?: "Comment" } & Pick<Comment, "id">
Expand Down Expand Up @@ -2533,10 +2533,12 @@ export const FormFieldsFragmentDoc = gql`
`
export const ParagraphFormFieldsFragmentDoc = gql`
fragment ParagraphFormFields on DocumentParagraph {
__typename
id
index
translation
source {
__typename
...FormFields
}
comments {
Expand Down
2 changes: 2 additions & 0 deletions website/src/graphql/dailp/queries.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,12 @@ fragment DocFormFields on AnnotatedDoc {
}

fragment ParagraphFormFields on DocumentParagraph {
__typename
id
index
translation
source {
__typename
...FormFields
}
comments {
Expand Down
9 changes: 4 additions & 5 deletions website/src/panel-layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,6 @@ export const PanelLayout = (p: {
}
}, [p.segment, prevSegment, setIsEditing, setIsEditingParagraph])

if (!p.segment) {
return null
}

const token = useCredentials()
const userGroups = useCognitoUserGroups()

Expand Down Expand Up @@ -106,6 +102,10 @@ export const PanelLayout = (p: {
}
)

if (!p.segment) {
return null
}

let panel = null

// Display the paragraph panel if the segment type is a word (AnnotatedForm).
Expand Down Expand Up @@ -210,7 +210,6 @@ export const PanelLayout = (p: {
<h1
className={css.noSpaceBelow}
>{`Paragraph ${p.segment.index}`}</h1>
<h2 className={css.cherHeader}>{p.segment.source}</h2>
</header>
</>
)}
Expand Down
4 changes: 1 addition & 3 deletions website/src/paragraph-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,7 @@ const ParagraphPanel = (p: {
/>
</Form>
)
const discussionContent = (
<CommentSection parent={p.paragraph as TranslatedParagraph} />
)
const discussionContent = <CommentSection parent={p.paragraph} />

return (
<>
Expand Down

0 comments on commit a91c1df

Please sign in to comment.