-
Notifications
You must be signed in to change notification settings - Fork 0
ARC-3815 Timeline component #386
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
Open
bertyhell
wants to merge
10
commits into
release/v6.0.0
Choose a base branch
from
feature/ARC-3815-timeline-block
base: release/v6.0.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
94534b0
feat(ARC-3815): add timeline block
bertyhell 19845e1
feat(ARC-3815): create initial version of timeline block
bertyhell 683fae5
Merge branch 'release/v6.0.0' into feature/ARC-3815-timeline-block
bertyhell a00fdb6
fix(ARC-3815): init date for timeline
bertyhell ab971ba
feat(ARC-3815): remove sorting options, improve styling
bertyhell fcf8ba7
feat(ARC-3815): enhance timeline block styling and player configuration
bertyhell d934f87
feat(ARC-3815): refactor timeline block for batched IE object fetchin…
bertyhell 015bced
feat(ARC-3815): refactor timeline object rendering and styling
bertyhell 51db676
feat(ARC-3815): enhance timeline block responsive layout and object m…
bertyhell 4f21543
Merge branch 'release/v6.0.0' into feature/ARC-3815-timeline-block
bertyhell 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 hidden or 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 hidden or 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 hidden or 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
251 changes: 251 additions & 0 deletions
251
...-admin/modules/content-page/components/blocks/BlockTimeline/BlockTimeline.editorconfig.ts
This file contains hidden or 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,251 @@ | ||
| import type { CheckboxProps, SelectOption } from '@viaa/avo2-components'; | ||
| import { GET_BACKGROUND_COLOR_OPTIONS_ARCHIEF } from '~modules/content-page/const/get-color-options'; | ||
| import type { FileUploadProps } from '~shared/components/FileUpload/FileUpload'; | ||
| import { tText } from '~shared/helpers/translation-functions'; | ||
| import { HET_ARCHIEF } from '~shared/types'; | ||
| import type { | ||
| ContentBlockConfig, | ||
| ContentBlockField, | ||
| TimelineBlockState, | ||
| TimelineNodeBlockComponentState, | ||
| TimelineNodeVisualType, | ||
| } from '../../../types/content-block.types'; | ||
| import { Color, ContentBlockEditor, ContentBlockType } from '../../../types/content-block.types'; | ||
|
|
||
| import { BLOCK_FIELD_DEFAULTS, BLOCK_STATE_DEFAULTS, FILE_FIELD, TEXT_FIELD } from '../defaults'; | ||
|
|
||
| const GET_TIMELINE_NODE_VISUAL_TYPE_OPTIONS = (): SelectOption<TimelineNodeVisualType>[] => [ | ||
| { | ||
| label: tText( | ||
| 'react-admin/modules/content-page/components/blocks/block-timeline/block-timeline___geen', | ||
| {}, | ||
| [HET_ARCHIEF] | ||
| ), | ||
| value: 'NONE', | ||
| }, | ||
| { | ||
| label: tText( | ||
| 'react-admin/modules/content-page/components/blocks/block-timeline/block-timeline___object', | ||
| {}, | ||
| [HET_ARCHIEF] | ||
| ), | ||
| value: 'OBJECT', | ||
| }, | ||
| { | ||
| label: tText( | ||
| 'react-admin/modules/content-page/components/blocks/block-timeline/block-timeline___afbeelding', | ||
| {}, | ||
| [HET_ARCHIEF] | ||
| ), | ||
| value: 'IMAGE', | ||
| }, | ||
| ]; | ||
|
|
||
| const visualTypeIsObject: ContentBlockField['isVisible'] = (_config, formGroupState) => | ||
| (formGroupState as TimelineNodeBlockComponentState).visualType === 'OBJECT'; | ||
|
|
||
| const visualTypeIsImage: ContentBlockField['isVisible'] = (_config, formGroupState) => | ||
| (formGroupState as TimelineNodeBlockComponentState).visualType === 'IMAGE'; | ||
|
|
||
| export const INITIAL_TIMELINE_COMPONENTS_STATE = (): TimelineNodeBlockComponentState[] => [ | ||
| { | ||
| date: '', | ||
| title: '', | ||
| text: '', | ||
| visualType: 'NONE', | ||
| mediaItem: undefined, | ||
| image: undefined, | ||
| imageAlt: '', | ||
| imageCaptionCopyright: '', | ||
| imageCaptionCopyrightIconVisible: true, | ||
| imageCaptionDescription: '', | ||
| backgroundColor: Color.Transparent, | ||
| }, | ||
| ]; | ||
|
|
||
| export const INITIAL_TIMELINE_BLOCK_STATE = (): TimelineBlockState => ({ | ||
| ...BLOCK_STATE_DEFAULTS(), | ||
| }); | ||
|
|
||
| export const TIMELINE_BLOCK_CONFIG = (position = 0): ContentBlockConfig => ({ | ||
| position, | ||
| name: tText( | ||
| 'react-admin/modules/content-page/components/blocks/block-timeline/block-timeline___tijdslijn', | ||
| {}, | ||
| [HET_ARCHIEF] | ||
| ), | ||
| type: ContentBlockType.Timeline, | ||
| components: { | ||
| name: tText( | ||
| 'react-admin/modules/content-page/components/blocks/block-timeline/block-timeline___node', | ||
| {}, | ||
| [HET_ARCHIEF] | ||
| ), | ||
| state: INITIAL_TIMELINE_COMPONENTS_STATE(), | ||
| fields: { | ||
| date: { | ||
| label: tText( | ||
| 'react-admin/modules/content-page/components/blocks/block-timeline/block-timeline___datum', | ||
| {}, | ||
| [HET_ARCHIEF] | ||
| ), | ||
| editorType: ContentBlockEditor.DatePicker, | ||
| validator: (value: string) => | ||
| value | ||
| ? [] | ||
| : [ | ||
| tText( | ||
| 'react-admin/modules/content-page/components/blocks/block-timeline/block-timeline___datum-is-verplicht', | ||
| {}, | ||
| [HET_ARCHIEF] | ||
| ), | ||
| ], | ||
| }, | ||
| title: TEXT_FIELD( | ||
| { | ||
| label: tText( | ||
| 'react-admin/modules/content-page/components/blocks/block-timeline/block-timeline___titel', | ||
| {}, | ||
| [HET_ARCHIEF] | ||
| ), | ||
| }, | ||
| tText( | ||
| 'react-admin/modules/content-page/components/blocks/block-timeline/block-timeline___titel-is-verplicht', | ||
| {}, | ||
| [HET_ARCHIEF] | ||
| ) | ||
| ), | ||
| text: TEXT_FIELD({ | ||
| label: tText( | ||
| 'react-admin/modules/content-page/components/blocks/block-timeline/block-timeline___tekst', | ||
| {}, | ||
| [HET_ARCHIEF] | ||
| ), | ||
| editorType: ContentBlockEditor.RICH_TEXT_EDITOR, | ||
| validator: undefined, | ||
| }), | ||
| visualType: { | ||
| label: tText( | ||
| 'react-admin/modules/content-page/components/blocks/block-timeline/block-timeline___visuele-elementen', | ||
| {}, | ||
| [HET_ARCHIEF] | ||
| ), | ||
| editorType: ContentBlockEditor.Select, | ||
| editorProps: { | ||
| options: GET_TIMELINE_NODE_VISUAL_TYPE_OPTIONS(), | ||
| }, | ||
| validator: (value: string) => | ||
| value | ||
| ? [] | ||
| : [ | ||
| tText( | ||
| 'react-admin/modules/content-page/components/blocks/block-timeline/block-timeline___keuze-van-visuele-elementen-is-verplicht', | ||
| {}, | ||
| [HET_ARCHIEF] | ||
| ), | ||
| ], | ||
| }, | ||
| mediaItem: { | ||
| label: tText( | ||
| 'react-admin/modules/content-page/components/blocks/block-timeline/block-timeline___object-audio-video-of-krant', | ||
| {}, | ||
| [HET_ARCHIEF] | ||
| ), | ||
| editorType: ContentBlockEditor.ContentPicker, | ||
| editorProps: { | ||
| allowedTypes: ['IE_OBJECT'], | ||
| hideTargetSwitch: true, | ||
| // Only one type is allowed, so the type dropdown would only ever have a single option | ||
| hideTypeDropdown: true, | ||
| }, | ||
| isVisible: visualTypeIsObject, | ||
| validator: (value: unknown) => | ||
| value | ||
| ? [] | ||
| : [ | ||
| tText( | ||
| 'react-admin/modules/content-page/components/blocks/block-timeline/block-timeline___selecteren-van-een-object-is-verplicht', | ||
| {}, | ||
| [HET_ARCHIEF] | ||
| ), | ||
| ], | ||
| }, | ||
| image: FILE_FIELD( | ||
| tText( | ||
| 'react-admin/modules/content-page/components/blocks/block-timeline/block-timeline___een-afbeelding-is-verplicht', | ||
| {}, | ||
| [HET_ARCHIEF] | ||
| ), | ||
| { | ||
| label: tText( | ||
| 'react-admin/modules/content-page/components/blocks/block-timeline/block-timeline___afbeelding', | ||
| {}, | ||
| [HET_ARCHIEF] | ||
| ), | ||
| editorProps: { | ||
| assetType: 'CONTENT_BLOCK_IMAGE', | ||
| allowMulti: false, | ||
| showDeleteButton: true, | ||
| } as FileUploadProps, | ||
| isVisible: visualTypeIsImage, | ||
| } | ||
| ), | ||
| imageAlt: TEXT_FIELD({ | ||
| label: tText( | ||
| 'react-admin/modules/content-page/components/blocks/block-timeline/block-timeline___alternatieve-tekst-afbeelding', | ||
| {}, | ||
| [HET_ARCHIEF] | ||
| ), | ||
| validator: undefined, | ||
| isVisible: visualTypeIsImage, | ||
| }), | ||
| imageCaptionCopyright: TEXT_FIELD({ | ||
| label: tText( | ||
| 'react-admin/modules/content-page/components/blocks/block-timeline/block-timeline___bijschrift-copyright', | ||
| {}, | ||
| [HET_ARCHIEF] | ||
| ), | ||
| validator: undefined, | ||
| isVisible: visualTypeIsImage, | ||
| }), | ||
| imageCaptionCopyrightIconVisible: { | ||
| editorType: ContentBlockEditor.Checkbox, | ||
| editorProps: { | ||
| label: tText( | ||
| 'react-admin/modules/content-page/components/blocks/block-timeline/block-timeline___copyright-icoon-toevoegen', | ||
| {}, | ||
| [HET_ARCHIEF] | ||
| ), | ||
| } as CheckboxProps, | ||
| isVisible: visualTypeIsImage, | ||
| }, | ||
| imageCaptionDescription: TEXT_FIELD({ | ||
| label: tText( | ||
| 'react-admin/modules/content-page/components/blocks/block-timeline/block-timeline___bijschrift-beschrijving', | ||
| {}, | ||
| [HET_ARCHIEF] | ||
| ), | ||
| validator: undefined, | ||
| isVisible: visualTypeIsImage, | ||
| }), | ||
|
bertyhell marked this conversation as resolved.
|
||
| backgroundColor: { | ||
| label: tText( | ||
| 'react-admin/modules/content-page/components/blocks/block-timeline/block-timeline___achtergrondkleur-van-de-node', | ||
| {}, | ||
| [HET_ARCHIEF] | ||
| ), | ||
| editorType: ContentBlockEditor.ColorSelect, | ||
| editorProps: { | ||
| options: GET_BACKGROUND_COLOR_OPTIONS_ARCHIEF(), | ||
| defaultValue: GET_BACKGROUND_COLOR_OPTIONS_ARCHIEF()[0], | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| block: { | ||
| state: INITIAL_TIMELINE_BLOCK_STATE(), | ||
| fields: { | ||
| ...BLOCK_FIELD_DEFAULTS(), | ||
| }, | ||
| }, | ||
| }); | ||
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.
Uh oh!
There was an error while loading. Please reload this page.