diff --git a/client/src/__generated__/graphql.ts b/client/src/__generated__/graphql.ts index 0d248505..093dced7 100644 --- a/client/src/__generated__/graphql.ts +++ b/client/src/__generated__/graphql.ts @@ -811,7 +811,7 @@ export type InstrumentNode = Node & { __typename?: 'InstrumentNode'; bookmarks?: Maybe>>; contents?: Maybe; - highlights?: Maybe>>; + highlights: Array; /** The ID of the object */ id: Scalars['ID']['output']; intro: Scalars['String']['output']; @@ -2773,7 +2773,7 @@ export type AddContentHighlightMutation = { __typename?: 'Mutation', addContentH & { ' $fragmentRefs'?: { 'HighlightPartsFragment': HighlightPartsFragment } } ) | null } | null }; -export type InstrumentHighlightsWithIdOnlyFragmentFragment = { __typename?: 'InstrumentNode', highlights?: Array<{ __typename?: 'HighlightNode', id: string } | null> | null } & { ' $fragmentName'?: 'InstrumentHighlightsWithIdOnlyFragmentFragment' }; +export type InstrumentHighlightsWithIdOnlyFragmentFragment = { __typename?: 'InstrumentNode', highlights: Array<{ __typename?: 'HighlightNode', id: string }> } & { ' $fragmentName'?: 'InstrumentHighlightsWithIdOnlyFragmentFragment' }; export type ContentBlockHighlightsWithIdOnlyFragmentFragment = { __typename?: 'ContentBlockNode', highlights?: Array<{ __typename?: 'HighlightNode', id: string } | null> | null } & { ' $fragmentName'?: 'ContentBlockHighlightsWithIdOnlyFragmentFragment' }; @@ -2794,10 +2794,10 @@ export type UpdateContentBookmarkMutation = { __typename?: 'Mutation', updateCon export type MyActivitiesQueryQueryVariables = Exact<{ [key: string]: never; }>; -export type MyActivitiesQueryQuery = { __typename?: 'Query', myActivities?: { __typename?: 'ActivityNode', instruments: Array<{ __typename?: 'InstrumentNode', id: string, slug: string, title: string, path: string, highlights?: Array<( +export type MyActivitiesQueryQuery = { __typename?: 'Query', myActivities?: { __typename?: 'ActivityNode', instruments: Array<{ __typename?: 'InstrumentNode', id: string, slug: string, title: string, path: string, highlights: Array<( { __typename?: 'HighlightNode' } & { ' $fragmentRefs'?: { 'HighlightPartsFragment': HighlightPartsFragment } } - ) | null> | null, bookmarks?: Array<{ __typename?: 'InstrumentBookmarkNode', path: string } | null> | null }>, topics: Array<{ __typename?: 'TopicNode', id: string, title: string, modules?: Array<{ __typename?: 'ModuleNode', id: string, slug: string, title: string, metaTitle: string, myHighlights: Array<( + )>, bookmarks?: Array<{ __typename?: 'InstrumentBookmarkNode', path: string } | null> | null }>, topics: Array<{ __typename?: 'TopicNode', id: string, title: string, modules?: Array<{ __typename?: 'ModuleNode', id: string, slug: string, title: string, metaTitle: string, myHighlights: Array<( { __typename?: 'HighlightNode' } & { ' $fragmentRefs'?: { 'HighlightPartsFragment': HighlightPartsFragment } } )>, myBookmarks?: Array<{ __typename?: 'ChapterBookmarkNode', path?: string | null, chapter: { __typename?: 'ChapterNode', path?: string | null }, note?: { __typename?: 'NoteNode', id: string, text: string } | null } | { __typename?: 'ContentBlockBookmarkNode', id: string, uuid?: any | null, path?: string | null, contentBlock: { __typename?: 'ContentBlockNode', id: string, path?: string | null }, note?: { __typename?: 'NoteNode', id: string, text: string } | null } | { __typename?: 'InstrumentBookmarkNode' } | { __typename?: 'ModuleBookmarkNode', path?: string | null, note?: { __typename?: 'NoteNode', id: string, text: string } | null } | null> | null, mySubmissions?: Array<{ __typename?: 'StudentSubmissionNode', id: string, text: string, assignment: { __typename?: 'AssignmentNode', id: string, title: string, path: string, module: { __typename?: 'ModuleNode', slug: string } } } | null> | null, myAnswers?: Array<{ __typename?: 'AnswerNode', id: string, survey: { __typename?: 'SurveyNode', path: string, id: string, title: string } } | null> | null }> | null }> } | null }; @@ -2816,10 +2816,10 @@ export type ContentBlockQueryQueryVariables = Exact<{ export type ContentBlockQueryQuery = { __typename?: 'Query', contentBlock?: { __typename?: 'ContentBlockNode', path?: string | null } | null }; -export type InstrumentPartsFragment = { __typename?: 'InstrumentNode', id: string, title: string, intro: string, slug: string, language?: string | null, contents?: any | null, bookmarks?: Array<{ __typename?: 'InstrumentBookmarkNode', uuid?: any | null, note?: { __typename?: 'NoteNode', id: string, text: string } | null } | null> | null, type?: { __typename?: 'InstrumentTypeNode', id: string, name: string, type: string, category?: { __typename?: 'InstrumentCategoryNode', id: string, name: string, foreground: string, background: string } | null } | null, highlights?: Array<( +export type InstrumentPartsFragment = { __typename?: 'InstrumentNode', id: string, title: string, intro: string, slug: string, language?: string | null, contents?: any | null, bookmarks?: Array<{ __typename?: 'InstrumentBookmarkNode', uuid?: any | null, note?: { __typename?: 'NoteNode', id: string, text: string } | null } | null> | null, type?: { __typename?: 'InstrumentTypeNode', id: string, name: string, type: string, category?: { __typename?: 'InstrumentCategoryNode', id: string, name: string, foreground: string, background: string } | null } | null, highlights: Array<( { __typename?: 'HighlightNode' } & { ' $fragmentRefs'?: { 'HighlightPartsFragment': HighlightPartsFragment } } - ) | null> | null } & { ' $fragmentName'?: 'InstrumentPartsFragment' }; + )> } & { ' $fragmentName'?: 'InstrumentPartsFragment' }; export type InstrumentQueryQueryVariables = Exact<{ slug: Scalars['String']['input']; @@ -2831,10 +2831,10 @@ export type InstrumentQueryQuery = { __typename?: 'Query', instrument?: ( & { ' $fragmentRefs'?: { 'InstrumentPartsFragment': InstrumentPartsFragment } } ) | null }; -export type InstrumentHighlightsFragmentFragment = { __typename: 'InstrumentNode', id: string, slug: string, highlights?: Array<( +export type InstrumentHighlightsFragmentFragment = { __typename: 'InstrumentNode', id: string, slug: string, highlights: Array<( { __typename?: 'HighlightNode' } & { ' $fragmentRefs'?: { 'HighlightPartsFragment': HighlightPartsFragment } } - ) | null> | null } & { ' $fragmentName'?: 'InstrumentHighlightsFragmentFragment' }; + )> } & { ' $fragmentName'?: 'InstrumentHighlightsFragmentFragment' }; export type MeLanguageQueryVariables = Exact<{ [key: string]: never; }>; diff --git a/client/src/helpers/highlight.ts b/client/src/helpers/highlight.ts index cfc6bf71..de6aefdf 100644 --- a/client/src/helpers/highlight.ts +++ b/client/src/helpers/highlight.ts @@ -384,7 +384,6 @@ export const deleteHighlightCurry = (highlight: HighlightNode) => () => { if (success) { const page = highlight.page; let fragment: DocumentNode, id; - console.log(page?.__typename); if (page?.__typename === 'InstrumentNode') { fragment = graphql(` fragment InstrumentHighlightsWithIdOnlyFragment on InstrumentNode { diff --git a/client/src/pages/instrument.vue b/client/src/pages/instrument.vue index 977a5b2b..e49b2f73 100644 --- a/client/src/pages/instrument.vue +++ b/client/src/pages/instrument.vue @@ -14,6 +14,7 @@
@@ -32,17 +33,24 @@ @@ -164,6 +213,10 @@ onUnmounted(() => { .instrument { padding-top: 2 * $large-spacing; + &__intro { + position: relative; + } + &__title { font-size: toRem(35px); margin-bottom: $large-spacing; diff --git a/server/basicknowledge/queries.py b/server/basicknowledge/queries.py index 3cef4a98..56287e71 100644 --- a/server/basicknowledge/queries.py +++ b/server/basicknowledge/queries.py @@ -44,7 +44,9 @@ class InstrumentNode(DjangoObjectType): type = graphene.Field(InstrumentTypeNode) contents = GenericStreamFieldType() language = graphene.String() - highlights = graphene.List("notes.schema.HighlightNode") + highlights = graphene.List( + graphene.NonNull("notes.schema.HighlightNode"), required=True + ) path = graphene.String(required=True) class Meta: diff --git a/server/schema.graphql b/server/schema.graphql index 6e3ec22e..8d0af943 100644 --- a/server/schema.graphql +++ b/server/schema.graphql @@ -450,7 +450,7 @@ type InstrumentNode implements Node { bookmarks: [InstrumentBookmarkNode] type: InstrumentTypeNode language: String - highlights: [HighlightNode] + highlights: [HighlightNode!]! path: String! }