Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Colophons #462

Merged
merged 20 commits into from
May 12, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 75 additions & 0 deletions src/colophons/domain/Colophons.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import { Provenance } from 'corpus/domain/provenance'

enum ColophonStatus {
Yes = 'Yes',
No = 'No',
Broken = 'Broken',
OnlyColophon = 'Only Colophon',
}

enum ColophonType {
khoidt marked this conversation as resolved.
Show resolved Hide resolved
AsbA = 'Asb a',
AsbB = 'Asb b',
AsbC = 'Asb c',
AsbD = 'Asb d',
AsbE = 'Asb e',
AsbF = 'Asb f',
AsbG = 'Asb g', // BAK 321
AsbH = 'Asb h',
AsbI = 'Asb i',
AsbK = 'Asb k',
AsbL = 'Asb l',
AsbM = 'Asb m',
AsbN = 'Asb n',
AsbO = 'Asb o',
AsbP = 'Asb p',
AsbQ = 'Asb q',
AsbRS = 'Asb r/s',
AsbT = 'Asb t',
AsbU = 'Asb u',
AsbV = 'Asb v',
AsbW = 'Asb w',
AsbUnclear = 'Asb Unclear',
NzkBAK293 = 'Nzk BAK 293',
NzkBAK294 = 'Nzk BAK 294',
NzkBAK295 = 'Nzk BAK 295',
NzkBAK296 = 'Nzk BAK 296',
NzkBAK297 = 'Nzk BAK 297',
}

enum ColophonOwnership {
Library = 'Library',
Private = 'Private',
Individual = 'Individual',
}

enum IndividualType {
Owner = 'Owner',
Scribe = 'Scribe',
Other = 'Other',
}

interface Name {
value: string
isBroken: boolean
isUncertain: boolean
}

interface Individual {
khoidt marked this conversation as resolved.
Show resolved Hide resolved
khoidt marked this conversation as resolved.
Show resolved Hide resolved
name: Name
sonOf: Name
grandsonOf: Name
family: Name
nativeOf: Provenance
type: IndividualType
}

export interface Colophon {
colophonStatus: ColophonStatus
colophonOwnership: ColophonOwnership
colophonType: ColophonType[]
originalFrom: Provenance
writtenIn: Provenance
notesToScribalProcess: string
individuals: Individual[]
}
5 changes: 5 additions & 0 deletions src/colophons/ui/ColophonEditor.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import React from 'react'

export default function Editor(): JSX.Element {
return <></>
}
164 changes: 3 additions & 161 deletions src/fragmentarium/ui/fragment/CuneiformFragment.tsx
Original file line number Diff line number Diff line change
@@ -1,179 +1,21 @@
import React, { useState, FunctionComponent, PropsWithChildren } from 'react'
import { Container, Row, Col, Tabs, Tab } from 'react-bootstrap'
import _ from 'lodash'

import References from 'fragmentarium/ui/fragment/References'
import React, { useState, FunctionComponent } from 'react'
import { Container, Row, Col } from 'react-bootstrap'
import FragmentInCorpus from 'fragmentarium/ui/fragment/FragmentInCorpus'
import Edition from 'fragmentarium/ui/edition/Edition'
import Lemmatizer from 'fragmentarium/ui/lemmatization/Lemmatizer'
import Display from 'fragmentarium/ui/display/Display'
import Images from 'fragmentarium/ui/images/Images'
import Info from 'fragmentarium/ui/info/Info'
import SessionContext from 'auth/SessionContext'
import ErrorAlert from 'common/ErrorAlert'
import Spinner from 'common/Spinner'
import serializeReference from 'bibliography/application/serializeReference'
import usePromiseEffect from 'common/usePromiseEffect'

import './CuneiformFragment.sass'
import { Fragment } from 'fragmentarium/domain/fragment'
import Folio from 'fragmentarium/domain/Folio'
import WordService from 'dictionary/application/WordService'
import FragmentSearchService from 'fragmentarium/application/FragmentSearchService'
import FragmentService from 'fragmentarium/application/FragmentService'
import ErrorBoundary from 'common/ErrorBoundary'
import ArchaeologyEditor from 'fragmentarium/ui/fragment/ArchaeologyEditor'
import { ArchaeologyDto } from 'fragmentarium/domain/archaeologyDtos'
import { FindspotService } from 'fragmentarium/application/FindspotService'
import AfoRegisterService from 'afo-register/application/AfoRegisterService'

const ContentSection: FunctionComponent = ({
children,
}: PropsWithChildren<unknown>) => (
<section className="CuneiformFragment__content">
<ErrorBoundary>{children}</ErrorBoundary>
</section>
)

type TabsProps = {
fragment: Fragment
fragmentService: FragmentService
fragmentSearchService
wordService: WordService
findspotService: FindspotService
onSave
disabled?: boolean
activeLine: string
}
const EditorTabs: FunctionComponent<TabsProps> = ({
fragment,
fragmentService,
fragmentSearchService,
wordService,
findspotService,
onSave,
disabled = false,
activeLine,
}: TabsProps) => {
const tabsId = _.uniqueId('fragment-container-')

const updateEdition = (
transliteration: string,
notes: string,
introduction: string
) =>
onSave(
fragmentService.updateEdition(
fragment.number,
transliteration,
notes,
introduction
)
)
const updateLemmatization = (lemmatization) =>
onSave(
fragmentService.updateLemmatization(
fragment.number,
lemmatization.toDto()
)
)
const updateReferences = (references) =>
onSave(
fragmentService.updateReferences(
fragment.number,
references.map(serializeReference)
)
)
const updateArchaeology = (archaeology: ArchaeologyDto) =>
onSave(fragmentService.updateArchaeology(fragment.number, archaeology))
const searchBibliography = (query) =>
fragmentService.searchBibliography(query)
return (
<SessionContext.Consumer>
{(session) => (
<Tabs
id={tabsId}
defaultActiveKey={
session.isAllowedToTransliterateFragments() ? 'edition' : 'display'
}
mountOnEnter={true}
className={
session.isGuestSession() ? 'CuneiformFragment__tabs-hidden' : ''
}
>
<Tab eventKey="display" title="Display">
<ContentSection>
<Display
fragment={fragment}
wordService={wordService}
activeLine={activeLine}
/>
</ContentSection>
</Tab>
<Tab
eventKey="edition"
title="Edition"
disabled={!session.isAllowedToTransliterateFragments()}
>
<ContentSection>
<Edition
fragment={fragment}
updateEdition={updateEdition}
fragmentSearchService={fragmentSearchService}
disabled={disabled}
/>
</ContentSection>
</Tab>
<Tab
eventKey="lemmatization"
title="Lemmatization"
disabled={
_.isEmpty(fragment.text.lines) ||
!session.isAllowedToLemmatizeFragments()
}
>
<ContentSection>
<Lemmatizer
fragmentService={fragmentService}
updateLemmatization={updateLemmatization}
text={fragment.text}
disabled={disabled}
/>
</ContentSection>
</Tab>
<Tab
eventKey="refrences"
title="References"
disabled={!session.isAllowedToTransliterateFragments()}
>
<ContentSection>
<References
references={fragment.references}
searchBibliography={searchBibliography}
updateReferences={updateReferences}
disabled={disabled}
/>
</ContentSection>
</Tab>
<Tab
eventKey="archaeologicalContext"
title="Archaeology"
disabled={!session.isAllowedToTransliterateFragments()}
>
<ContentSection>
<ArchaeologyEditor
archaeology={fragment.archaeology}
updateArchaeology={updateArchaeology}
disabled={disabled}
findspotService={findspotService}
/>
</ContentSection>
</Tab>
</Tabs>
)}
</SessionContext.Consumer>
)
}
import { EditorTabs } from 'fragmentarium/ui/fragment/CuneiformFragmentEditor'

type CuneiformFragmentProps = {
fragment: Fragment
Expand Down
Loading
Loading