-
Notifications
You must be signed in to change notification settings - Fork 1
Listing With Date #177
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
Merged
Merged
Listing With Date #177
Changes from 16 commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
2c108bc
feature: listing-with-date
Tishasoumya-02 f54b052
Merge branch 'main' into event-listing-variation
Tishasoumya-02 cff71d0
fix
Tishasoumya-02 8d66f5f
Merge branch 'event-listing-variation' of github.com:kitconcept/kitco…
Tishasoumya-02 e3da1b4
add cypress test
Tishasoumya-02 5e86460
Update +listingWithDate.feature
Tishasoumya-02 cfc3da4
fix: remove duplicate confid, design
Tishasoumya-02 cbfe3c7
Merge branch 'event-listing-variation' of github.com:kitconcept/kitco…
Tishasoumya-02 b512d54
Merge branch 'main' into event-listing-variation
Tishasoumya-02 723829e
Merge branch 'main' into event-listing-variation
Tishasoumya-02 b31798e
fix: bring back the css
Tishasoumya-02 907d466
Merge branch 'event-listing-variation' of github.com:kitconcept/kitco…
Tishasoumya-02 7589856
update example content
Tishasoumya-02 9e20aad
example content for list with date variation
Tishasoumya-02 fd70d27
fix
Tishasoumya-02 af6a225
fix lint
Tishasoumya-02 b0a6ab7
fix
Tishasoumya-02 2edf2bc
fix the eslint error
iFlameing 2df466b
fix: move common functions outside the component
Tishasoumya-02 0c148db
merge
Tishasoumya-02 851ff3c
merge
Tishasoumya-02 d827bc6
fix
Tishasoumya-02 5922067
Merge branch 'main' into event-listing-variation
Tishasoumya-02 f66d6d5
Merge branch 'main' into event-listing-variation
Tishasoumya-02 10ad227
Merge branch 'main' into event-listing-variation
danalvrz 8402c1d
fix invalid date issue
iFlameing cc930e3
Merge branch 'main' into event-listing-variation
iFlameing 0246d98
Merge branch 'main' into event-listing-variation
Tishasoumya-02 02d37f9
Merge branch 'main' into event-listing-variation
Tishasoumya-02 3db85f2
Merge remote-tracking branch 'origin' into event-listing-variation
danalvrz a688588
Merge branch 'main' into event-listing-variation
danalvrz 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Add example content for list with date variation for listing block @Tishasoumya-02 |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Add listing template listing with Date and cypress test for the same @Tishasoumya-02 |
124 changes: 124 additions & 0 deletions
124
frontend/packages/volto-intranet/src/components/Blocks/Listing/EventCalendarTemplate.tsx
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,124 @@ | ||
| import { useSelector } from 'react-redux'; | ||
| import Card from '@kitconcept/volto-light-theme/primitives/Card/Card'; | ||
|
Check warning on line 2 in frontend/packages/volto-intranet/src/components/Blocks/Listing/EventCalendarTemplate.tsx
|
||
| import DefaultSummary from '@kitconcept/volto-light-theme/components/Summary/DefaultSummary'; | ||
|
Check warning on line 3 in frontend/packages/volto-intranet/src/components/Blocks/Listing/EventCalendarTemplate.tsx
|
||
| import cx from 'classnames'; | ||
|
|
||
| type IntlType = { | ||
| intl: { | ||
| locale: string; | ||
| }; | ||
| }; | ||
|
|
||
| const EventItem = ({ | ||
| item, | ||
| lang, | ||
| isEditMode, | ||
| }: { | ||
| item: any; | ||
| lang: string; | ||
| isEditMode: boolean; | ||
| }) => { | ||
| const formatter = new Intl.DateTimeFormat(lang, { | ||
| year: 'numeric', | ||
| month: 'short', | ||
| }); | ||
| const headFormatter = new Intl.DateTimeFormat(lang, { | ||
| day: 'numeric', | ||
| year: 'numeric', | ||
| month: 'long', | ||
| }); | ||
|
|
||
| const itemDates = (item: any) => { | ||
|
Tishasoumya-02 marked this conversation as resolved.
Outdated
|
||
| const start = | ||
| item['@type'] === 'Event' | ||
| ? item.start | ||
| ? new Date(item.start) | ||
| : null | ||
| : item.Effective | ||
| ? new Date(item.Effective) | ||
| : new Date(item.CreationDate); | ||
|
|
||
| const end = | ||
| item['@type'] === 'Event' && (item.end ? new Date(item.end) : null); | ||
|
|
||
| const notSameDay = end && start?.getDate() !== end?.getDate(); | ||
| const formattedStartDate = start ? formatter.format(start) : ''; | ||
| const formattedEndDate = end ? formatter.format(end) : ''; | ||
| const formattedHeaderDate = !end | ||
| ? start | ||
| ? headFormatter.format(start) | ||
| : '' | ||
| : start && end | ||
| ? headFormatter.formatRange(start, end) | ||
| : ''; | ||
|
|
||
| return { | ||
| start, | ||
| end, | ||
| formattedStartDate, | ||
| formattedEndDate, | ||
| formattedHeaderDate, | ||
| notSameDay, | ||
| }; | ||
| }; | ||
|
|
||
| const { | ||
| start, | ||
| end, | ||
| formattedHeaderDate, | ||
| notSameDay, | ||
| formattedStartDate, | ||
| formattedEndDate, | ||
| } = itemDates(item); | ||
|
|
||
| return ( | ||
| <div className="card-listing"> | ||
| <Card href={isEditMode ? '' : item['@id']} className="event-card"> | ||
| <Card.Image> | ||
| <div className={cx('date-inset', { 'has-end-date': notSameDay })}> | ||
| <div className="day"> | ||
| {start && String(start?.getDate()).padStart(2, '0')} | ||
| </div> | ||
| <div className="month">{formattedStartDate}</div> | ||
| {notSameDay && ( | ||
| <> | ||
| <div className="separator"></div> | ||
| <div className="day"> | ||
| {end && String(end?.getDate()).padStart(2, '0')} | ||
| </div> | ||
| <div className="month">{formattedEndDate}</div> | ||
| </> | ||
| )} | ||
| </div> | ||
| </Card.Image> | ||
| <Card.Summary> | ||
| <div className="headline calendar"> | ||
| <span className="day">{formattedHeaderDate}</span> | ||
| {item.head_title && ( | ||
| <span className="event-title">{item.head_title}</span> | ||
| )} | ||
| </div> | ||
| <DefaultSummary item={item} HeadingTag="h2" /> | ||
| </Card.Summary> | ||
| </Card> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| const EventCalendarTemplate = (props: any) => { | ||
| const lang = useSelector((state: IntlType) => state.intl.locale); | ||
| return ( | ||
| <div className="event-calendar items"> | ||
| {props.items.map((item: any, index: number) => ( | ||
| <EventItem | ||
| key={index} | ||
| item={item} | ||
| lang={lang} | ||
| isEditMode={props.isEditMode} | ||
| /> | ||
| ))} | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export default EventCalendarTemplate; | ||
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,20 @@ | ||
| import { ConfigType } from '@plone/registry'; | ||
| import EventCalendarTemplate from '../components/Blocks/Listing/EventCalendarTemplate'; | ||
|
|
||
| export default function install(config: ConfigType) { | ||
| const listingBlockVariations = [ | ||
| ...(config.blocks.blocksConfig.listing.variations || []), | ||
| { | ||
| id: 'listDate', | ||
| title: 'List with date', | ||
| template: EventCalendarTemplate, | ||
| }, | ||
| ].filter((variation) => !!variation); | ||
|
|
||
| config.blocks.blocksConfig.listing = { | ||
| ...config.blocks.blocksConfig.listing, | ||
|
Tishasoumya-02 marked this conversation as resolved.
|
||
| variations: listingBlockVariations, | ||
|
Tishasoumya-02 marked this conversation as resolved.
|
||
| }; | ||
|
|
||
| return config; | ||
| } | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,3 @@ | ||
| @import 'slots'; | ||
| @import 'components/search'; | ||
| @import 'components/eventsList.scss'; |
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.
remove this http://nohost/Plone
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.
How this got added here , not sure but removed it
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.
It's possible it is a bug in plone.exportimport. We should check to see if it happens again with remoteUrl
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.
yes, it is a bug in plone.exportimport.