-
Notifications
You must be signed in to change notification settings - Fork 0
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
Date converter form #395
Merged
Merged
Date converter form #395
Changes from 83 commits
Commits
Show all changes
87 commits
Select commit
Hold shift + click to select a range
956b29e
Implement Mesopotamian date, editing component & date converter (WiP)
khoidt 4b3111e
Improve
khoidt c150438
Merge remote-tracking branch 'origin/master' into add-date-to-fragment
khoidt bec1458
Extend (WiP)
khoidt 84c3d60
Fix and update tests
khoidt d5d212a
Fix tsc
khoidt 36b15ad
Improve & update tests
khoidt 357fdda
Fix tsc
khoidt 0492249
Refactor
khoidt 92dd7c9
Adjust and unify
khoidt 5c1f265
Update & fix
khoidt 1b9279f
Implement date display in fragmentarium search
khoidt 8546d86
Date paleography
khoidt 81e1ccb
Fix tests
khoidt 5b42cba
Make `date` optional in `CroppedAnnotation`
khoidt 3123ba0
Update style
khoidt e505fd6
Refactor & update
khoidt e41636e
Add tests & update
khoidt c3d21d5
Merge remote-tracking branch 'origin/master' into add-date-to-fragment
khoidt bb435be
Implement date delete & fix display issue
khoidt fc1a5d7
Merge remote-tracking branch 'origin/master' into add-date-to-fragment
khoidt 525ed06
Implement dates in text
khoidt ad96479
Add tests
khoidt b0bfd7c
Add more tests
khoidt 22166ea
Merge remote-tracking branch 'origin/master' into add-date-to-fragment
khoidt fbfedb7
Adjust date display
khoidt bf526e1
Merge remote-tracking branch 'origin/master' into add-date-to-fragment
khoidt 41a0257
Implement eponyms (WiP)
khoidt 5b6675c
Merge remote-tracking branch 'origin/master' into add-date-to-fragment
khoidt 4df82dc
Add phases and improve selection
khoidt 7460ee8
Extend eponym
khoidt 088c5d3
Improve & add tests
khoidt 111df01
Add & update tests
khoidt 03fc524
Add test for date with eponym string
khoidt ba52efd
Merge remote-tracking branch 'origin/master' into add-date-to-fragment
khoidt ae397c3
Implement date converter
khoidt b325ede
Merge remote-tracking branch 'origin/master' into add-date-to-fragment
khoidt 4768f48
Refactor
khoidt c3fa9fb
Refactor more
khoidt 2f4d3e9
Refactor more
khoidt 1a875b6
Add tests
khoidt bb5cdcf
Merge remote-tracking branch 'origin/master' into add-date-to-fragment
khoidt da5a92a
Patch approximate dates conversion
khoidt 5ae999f
Merge remote-tracking branch 'origin/master' into add-date-to-fragment
khoidt 725fee6
Restructure
khoidt 14ecf92
Add basic form
khoidt 06860d4
Reorder about tabs
khoidt d6e6818
Add routes & breadcrumbs to About section
khoidt 3be1327
Add routes to About
khoidt 4d5ced6
Implement form functionality, design & refactor
khoidt cac6554
Add copy json button & refactor style
khoidt 596a84a
Implement broken date display
khoidt 1c28754
Add options & text display for modern date fields
khoidt 6bec43b
Update description
khoidt 674f3be
Fix cjdn calculator
khoidt 20f9ce2
Julian and Gregorian dates correction (WiP)
khoidt 6bf7be2
Merge remote-tracking branch 'origin/master' into add-date-to-fragment
khoidt 306a4d3
Implement Gregorian dates
khoidt 9c95b43
Merge remote-tracking branch 'origin/master' into add-date-to-fragment
khoidt 866c826
Implement Gregorian string output, correct, update & refactor
khoidt 29d7879
Uddate converter & tests (WiP)
khoidt 2560722
Update Gregrian date converter & restrict day fields
khoidt e509ac7
Merge remote-tracking branch 'origin/master' into add-date-to-fragment
khoidt 6cd9dbd
Update snap
khoidt d04d68b
Refactor & improve style
khoidt 7b983b8
Improve & refactor
khoidt 06d046f
Merge remote-tracking branch 'origin/master' into add-date-to-fragment
khoidt 3dec050
Improve & refactor
khoidt 45c41ea
Improve & refactor
khoidt 1f4bf60
Improve & refactor
khoidt 4fe8bae
Refactor
khoidt 5efd8cb
Improve & refactor
khoidt f1b442d
Improve & refactor
khoidt ff9da56
Improve & add tests
khoidt f6de167
Merge remote-tracking branch 'origin/master' into add-date-to-fragment
khoidt 43d7c1e
Update snapshots
khoidt 4bc979d
Add tests, refactor & extend options fields (WiP)
khoidt d7274c6
Implement advanced field options & limits (WiP)
khoidt e6b5089
Refactor
khoidt 9c2ad93
Work on options and restrictions (WiP)
khoidt 86fb42f
Fix regnal years calculation & tests
khoidt 79b1bbc
Implement ruler selection and Brinkman names
khoidt bac49d4
Implement tools page & Mes. date guards, improve
khoidt 863c0cb
Merge remote-tracking branch 'origin/master' into add-date-to-fragment
khoidt 01df76d
Add tests
khoidt 139dcb9
Update tests
khoidt 32e3d43
Clean up
khoidt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,96 +1,85 @@ | ||
[id^="about-tabpane-"].tab-pane | ||
[id^="about-tabpane-"], [id^="tools-tabpane-"] | ||
&.tab-pane | ||
padding-top: 30px | ||
|
||
.tab-content:has([id^="about-tabpane-"]) | ||
.tab-content:has(&) | ||
text-align: justify | ||
padding: 0em 4em | ||
|
||
[id^="about-tabpane-"] .type-abbreviation | ||
display: none | ||
|
||
[id^="about-tabpane-"] h3 | ||
padding-top: 10px | ||
|
||
[id^="about-tabpane-"] h4 | ||
padding-top: 10px | ||
|
||
[id^="about-tabpane-"] blockquote | ||
padding-left: 40% | ||
|
||
[id^="about-tabpane-"] .Introduction | ||
|
||
&__200px | ||
width: 200px | ||
height: auto | ||
|
||
&__250px | ||
width: 250px | ||
height: auto | ||
|
||
&__300px | ||
width: 300px | ||
height: auto | ||
|
||
&__350px | ||
width: 350px | ||
height: auto | ||
|
||
&__400px | ||
width: 400px | ||
height: auto | ||
|
||
&__450px | ||
width: 450px | ||
height: auto | ||
|
||
&__caption | ||
font-size: 80% | ||
padding-top: 0.5em | ||
text-align: center | ||
|
||
&__cite | ||
border: 1px solid black | ||
display: block | ||
margin: 10px auto | ||
width: 70% | ||
padding: 10px | ||
text-align: center | ||
|
||
&__creativecommons | ||
border-width: 0 | ||
margin: auto | ||
display: block | ||
padding: 10px | ||
|
||
&__creativeCommonsLicense | ||
text-align: center | ||
|
||
&__fossey | ||
float: right | ||
width: 300px | ||
height: auto | ||
padding: 1em 0em 1em 1em | ||
|
||
&__meszlColoredChanges | ||
color: #00610F | ||
|
||
&__photoCentered | ||
text-align: center | ||
|
||
&__photoLeft | ||
text-align: center | ||
float: left | ||
margin: 0em 0.5em 0em 0em | ||
|
||
&__photoRight | ||
text-align: center | ||
float: right | ||
margin: 0em 0em 0.5em 0.5em | ||
|
||
&__quotation | ||
display: block | ||
padding: 0 0 1em 1em | ||
|
||
&__secondLineOfParallelism | ||
padding-left: 1em | ||
.type-abbreviation | ||
display: none | ||
|
||
h3, h4 | ||
padding-top: 10px | ||
|
||
blockquote | ||
padding-left: 40% | ||
|
||
.Introduction | ||
&__200px, &__250px, &__300px, &__350px, &__400px, &__450px | ||
height: auto | ||
|
||
&__200px | ||
width: 200px | ||
|
||
&__250px | ||
width: 250px | ||
|
||
&__300px | ||
width: 300px | ||
|
||
&__350px | ||
width: 350px | ||
|
||
&__400px | ||
width: 400px | ||
|
||
&__450px | ||
width: 450px | ||
|
||
&__caption | ||
font-size: 80% | ||
padding-top: 0.5em | ||
text-align: center | ||
|
||
&__cite | ||
border: 1px solid black | ||
display: block | ||
margin: 10px auto | ||
width: 70% | ||
padding: 10px | ||
text-align: center | ||
|
||
&__creativecommons, &__creativeCommonsLicense | ||
border-width: 0 | ||
margin: auto | ||
display: block | ||
padding: 10px | ||
text-align: center | ||
|
||
&__fossey | ||
float: right | ||
width: 300px | ||
height: auto | ||
padding: 1em 0em 1em 1em | ||
|
||
&__meszlColoredChanges | ||
color: #00610F | ||
|
||
&__photoCentered, &__photoLeft, &__photoRight | ||
text-align: center | ||
|
||
&__photoLeft, &__photoRight | ||
float: left | ||
margin: 0em 0.5em 0em 0em | ||
|
||
&__photoRight | ||
float: right | ||
margin: 0em 0em 0.5em 0.5em | ||
|
||
&__quotation | ||
display: block | ||
padding: 0 0 1em 1em | ||
|
||
&__secondLineOfParallelism | ||
padding-left: 1em |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
import DateConverter from 'chronology/domain/DateConverter' | ||
import { CalendarProps } from 'chronology/domain/DateConverterBase' | ||
import { FormChangeProps } from 'chronology/ui/DateConverterForm' | ||
|
||
export function handleDateConverterFormChange({ | ||
event, | ||
scenario, | ||
formData, | ||
dateConverter, | ||
setFormData, | ||
}: FormChangeProps): void { | ||
const { name, value } = event.target | ||
const data = { | ||
...formData, | ||
[name]: name === 'ruler' ? value : parseInt(value), | ||
} as CalendarProps | ||
if (scenario === 'setToGregorianDate') { | ||
setFormToGregorianDate(data, dateConverter) | ||
} else if (scenario === 'setToJulianDate') { | ||
setFormToJulianDate(data, dateConverter) | ||
} else if (isSetSeBabylonianDate(scenario, data)) { | ||
setFormToSeBabylonianDate(data, dateConverter) | ||
} else if (isSetMesopotamianDate(scenario, data)) { | ||
setFormToMesopotamianDate(data, dateConverter) | ||
} | ||
setFormData({ ...dateConverter.calendar }) | ||
} | ||
|
||
function isSetSeBabylonianDate(scenario: string, data: CalendarProps): boolean { | ||
const setToSeBabylonianDateArgs = [ | ||
data.seBabylonianYear, | ||
data.mesopotamianMonth, | ||
data.mesopotamianDay, | ||
] | ||
return !!( | ||
scenario === 'setToSeBabylonianDate' && | ||
!setToSeBabylonianDateArgs.includes(undefined) | ||
) | ||
} | ||
|
||
function isSetMesopotamianDate(scenario: string, data: CalendarProps): boolean { | ||
const setToMesopotamianDateArgs = [ | ||
data.ruler, | ||
data.regnalYear, | ||
data.mesopotamianMonth, | ||
data.mesopotamianDay, | ||
] | ||
return !!( | ||
scenario === 'setToMesopotamianDate' && | ||
!setToMesopotamianDateArgs.includes(undefined) | ||
) | ||
} | ||
|
||
function setFormToGregorianDate( | ||
data: CalendarProps, | ||
dateConverter: DateConverter | ||
): void { | ||
dateConverter.setToGregorianDate( | ||
data.gregorianYear as number, | ||
data.gregorianMonth as number, | ||
data.gregorianDay as number | ||
) | ||
} | ||
|
||
function setFormToSeBabylonianDate( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar blocks of code found in 3 locations. Consider refactoring. |
||
data: CalendarProps, | ||
dateConverter: DateConverter | ||
): void { | ||
dateConverter.setToSeBabylonianDate( | ||
data.seBabylonianYear as number, | ||
data.mesopotamianMonth as number, | ||
data.mesopotamianDay as number | ||
) | ||
} | ||
|
||
function setFormToMesopotamianDate( | ||
data: CalendarProps, | ||
dateConverter: DateConverter | ||
): void { | ||
dateConverter.setToMesopotamianDate( | ||
data.ruler as string, | ||
data.regnalYear as number, | ||
data.mesopotamianMonth as number, | ||
data.mesopotamianDay as number | ||
) | ||
} | ||
|
||
function setFormToJulianDate( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar blocks of code found in 3 locations. Consider refactoring. |
||
data: CalendarProps, | ||
dateConverter: DateConverter | ||
): void { | ||
dateConverter.setToJulianDate( | ||
data.julianYear as number, | ||
data.julianMonth as number, | ||
data.julianDay as number | ||
) | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar blocks of code found in 3 locations. Consider refactoring.