-
Notifications
You must be signed in to change notification settings - Fork 211
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(feat) O3-3014: Add expand appointments calendar view (#1123)
* feat: add expand appointments calendar view * fix: fix with service area row * chore: add translation
- Loading branch information
1 parent
b06a2a8
commit 110aa7b
Showing
4 changed files
with
149 additions
and
40 deletions.
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
42 changes: 42 additions & 0 deletions
42
...es/esm-appointments-app/src/calendar/monthly/monthly-workload-view-expanded.component.tsx
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,42 @@ | ||
import React, { useEffect, useRef } from 'react'; | ||
import { Popover, PopoverContent } from '@carbon/react'; | ||
import styles from './monthly-view-workload.scss'; | ||
import MonthlyWorkloadView, { type MonthlyWorkloadViewProps } from './monthly-workload-view.component'; | ||
import { useTranslation } from 'react-i18next'; | ||
|
||
interface MonthlyWorkloadViewExpandedProps extends MonthlyWorkloadViewProps { | ||
count: number; | ||
} | ||
|
||
const MonthlyWorkloadViewExpanded: React.FC<MonthlyWorkloadViewExpandedProps> = ({ count, events, dateTime }) => { | ||
const { t } = useTranslation(); | ||
const [isOpen, setIsOpen] = React.useState(false); | ||
const popoverRef = useRef(null); | ||
|
||
const handleClickOutside = (event) => { | ||
if (popoverRef.current && !popoverRef.current.contains(event.target)) { | ||
setIsOpen(false); | ||
} | ||
}; | ||
|
||
useEffect(() => { | ||
document.addEventListener('click', handleClickOutside); | ||
|
||
return () => { | ||
document.removeEventListener('click', handleClickOutside); | ||
}; | ||
}, []); | ||
|
||
return ( | ||
<Popover open={isOpen} align="top" ref={popoverRef}> | ||
<button className={styles.showMoreItems} onClick={() => setIsOpen((prev) => !prev)}> | ||
{t('countMore', '{{count}} more', { count })} | ||
</button> | ||
<PopoverContent> | ||
<MonthlyWorkloadView events={events} dateTime={dateTime} showAllServices={true} /> | ||
</PopoverContent> | ||
</Popover> | ||
); | ||
}; | ||
|
||
export default MonthlyWorkloadViewExpanded; |
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