@@ -35,6 +35,7 @@ import { extend } from 'dayjs';
35
35
import { isUSCitizen } from './helpers/isuscitizen.utils' ;
36
36
import removeMd from 'remove-markdown' ;
37
37
import { useInterval } from '@mantine/hooks' ;
38
+ import { StatisticsModal } from '@gitroom/frontend/components/launches/statistics' ;
38
39
extend ( isSameOrAfter ) ;
39
40
extend ( isSameOrBefore ) ;
40
41
@@ -508,6 +509,23 @@ export const CalendarColumn: FC<{
508
509
} ) ;
509
510
} , [ integrations , getDate ] ) ;
510
511
512
+ const openStatistics = useCallback (
513
+ ( id : string ) => ( ) => {
514
+ modal . openModal ( {
515
+ closeOnClickOutside : true ,
516
+ closeOnEscape : true ,
517
+ withCloseButton : false ,
518
+ classNames : {
519
+ modal : 'w-[100%] max-w-[1400px] bg-transparent text-textColor' ,
520
+ } ,
521
+ children : < StatisticsModal postId = { id } /> ,
522
+ size : '80%' ,
523
+ // title: `Adding posts for ${getDate.format('DD/MM/YYYY HH:mm')}`,
524
+ } ) ;
525
+ } ,
526
+ [ ]
527
+ ) ;
528
+
511
529
const addProvider = useAddProvider ( ) ;
512
530
513
531
return (
@@ -551,6 +569,7 @@ export const CalendarColumn: FC<{
551
569
isBeforeNow = { isBeforeNow }
552
570
date = { getDate }
553
571
state = { post . state }
572
+ statistics = { openStatistics ( post . id ) }
554
573
editPost = { editPost ( post , false ) }
555
574
duplicatePost = { editPost ( post , true ) }
556
575
post = { post }
@@ -654,13 +673,22 @@ const CalendarItem: FC<{
654
673
isBeforeNow : boolean ;
655
674
editPost : ( ) => void ;
656
675
duplicatePost : ( ) => void ;
676
+ statistics : ( ) => void ;
657
677
integrations : Integrations [ ] ;
658
678
state : State ;
659
679
display : 'day' | 'week' | 'month' ;
660
680
post : Post & { integration : Integration } ;
661
681
} > = memo ( ( props ) => {
662
- const { editPost, duplicatePost, post, date, isBeforeNow, state, display } =
663
- props ;
682
+ const {
683
+ editPost,
684
+ statistics,
685
+ duplicatePost,
686
+ post,
687
+ date,
688
+ isBeforeNow,
689
+ state,
690
+ display,
691
+ } = props ;
664
692
665
693
const preview = useCallback ( ( ) => {
666
694
window . open ( `/p/` + post . id + '?share=true' , '_blank' ) ;
@@ -683,18 +711,24 @@ const CalendarItem: FC<{
683
711
className = { clsx ( 'w-full flex h-full flex-1 flex-col group' , 'relative' ) }
684
712
style = { { opacity } }
685
713
>
686
- < div className = "text-primary bg-forth text-[11px] h-[15px] w-full rounded-tr-[10px] rounded-tl-[10px] flex justify-center gap-[10px] px-[5px]" >
714
+ < div className = "text-white bg-forth text-[11px] h-[15px] w-full rounded-tr-[10px] rounded-tl-[10px] flex justify-center gap-[10px] px-[5px]" >
687
715
< div
688
716
className = "hidden group-hover:block hover:underline cursor-pointer"
689
717
onClick = { duplicatePost }
690
718
>
691
- Duplicate
719
+ < Duplicate />
692
720
</ div >
693
721
< div
694
722
className = "hidden group-hover:block hover:underline cursor-pointer"
695
723
onClick = { preview }
696
724
>
697
- Preview
725
+ < Preview />
726
+ </ div > { ' ' }
727
+ < div
728
+ className = "hidden group-hover:block hover:underline cursor-pointer"
729
+ onClick = { statistics }
730
+ >
731
+ < Statistics />
698
732
</ div >
699
733
</ div >
700
734
< div
@@ -730,3 +764,60 @@ const CalendarItem: FC<{
730
764
</ div >
731
765
) ;
732
766
} ) ;
767
+
768
+ const Duplicate = ( ) => {
769
+ return (
770
+ < svg
771
+ xmlns = "http://www.w3.org/2000/svg"
772
+ width = "15"
773
+ height = "15"
774
+ viewBox = "0 0 32 32"
775
+ fill = "none"
776
+ data-tooltip-id = "tooltip"
777
+ data-tooltip-content = "Duplicate Post"
778
+ >
779
+ < path
780
+ d = "M27 5H9C8.46957 5 7.96086 5.21071 7.58579 5.58579C7.21071 5.96086 7 6.46957 7 7V9H5C4.46957 9 3.96086 9.21071 3.58579 9.58579C3.21071 9.96086 3 10.4696 3 11V25C3 25.5304 3.21071 26.0391 3.58579 26.4142C3.96086 26.7893 4.46957 27 5 27H23C23.5304 27 24.0391 26.7893 24.4142 26.4142C24.7893 26.0391 25 25.5304 25 25V23H27C27.5304 23 28.0391 22.7893 28.4142 22.4142C28.7893 22.0391 29 21.5304 29 21V7C29 6.46957 28.7893 5.96086 28.4142 5.58579C28.0391 5.21071 27.5304 5 27 5ZM23 11V13H5V11H23ZM23 25H5V15H23V25ZM27 21H25V11C25 10.4696 24.7893 9.96086 24.4142 9.58579C24.0391 9.21071 23.5304 9 23 9H9V7H27V21Z"
781
+ fill = "white"
782
+ />
783
+ </ svg >
784
+ ) ;
785
+ } ;
786
+
787
+ const Preview = ( ) => {
788
+ return (
789
+ < svg
790
+ xmlns = "http://www.w3.org/2000/svg"
791
+ width = "15"
792
+ height = "15"
793
+ viewBox = "0 0 32 32"
794
+ fill = "none"
795
+ data-tooltip-id = "tooltip"
796
+ data-tooltip-content = "Preview Post"
797
+ >
798
+ < path
799
+ d = "M30.9137 15.595C30.87 15.4963 29.8112 13.1475 27.4575 10.7937C24.3212 7.6575 20.36 6 16 6C11.64 6 7.67874 7.6575 4.54249 10.7937C2.18874 13.1475 1.12499 15.5 1.08624 15.595C1.02938 15.7229 1 15.8613 1 16.0012C1 16.1412 1.02938 16.2796 1.08624 16.4075C1.12999 16.5062 2.18874 18.8538 4.54249 21.2075C7.67874 24.3425 11.64 26 16 26C20.36 26 24.3212 24.3425 27.4575 21.2075C29.8112 18.8538 30.87 16.5062 30.9137 16.4075C30.9706 16.2796 31 16.1412 31 16.0012C31 15.8613 30.9706 15.7229 30.9137 15.595ZM16 24C12.1525 24 8.79124 22.6012 6.00874 19.8438C4.86704 18.7084 3.89572 17.4137 3.12499 16C3.89551 14.5862 4.86686 13.2915 6.00874 12.1562C8.79124 9.39875 12.1525 8 16 8C19.8475 8 23.2087 9.39875 25.9912 12.1562C27.1352 13.2912 28.1086 14.5859 28.8812 16C27.98 17.6825 24.0537 24 16 24ZM16 10C14.8133 10 13.6533 10.3519 12.6666 11.0112C11.6799 11.6705 10.9108 12.6075 10.4567 13.7039C10.0026 14.8003 9.88377 16.0067 10.1153 17.1705C10.3468 18.3344 10.9182 19.4035 11.7573 20.2426C12.5965 21.0818 13.6656 21.6532 14.8294 21.8847C15.9933 22.1162 17.1997 21.9974 18.2961 21.5433C19.3924 21.0892 20.3295 20.3201 20.9888 19.3334C21.6481 18.3467 22 17.1867 22 16C21.9983 14.4092 21.3657 12.884 20.2408 11.7592C19.1159 10.6343 17.5908 10.0017 16 10ZM16 20C15.2089 20 14.4355 19.7654 13.7777 19.3259C13.1199 18.8864 12.6072 18.2616 12.3045 17.5307C12.0017 16.7998 11.9225 15.9956 12.0768 15.2196C12.2312 14.4437 12.6122 13.731 13.1716 13.1716C13.731 12.6122 14.4437 12.2312 15.2196 12.0769C15.9956 11.9225 16.7998 12.0017 17.5307 12.3045C18.2616 12.6072 18.8863 13.1199 19.3259 13.7777C19.7654 14.4355 20 15.2089 20 16C20 17.0609 19.5786 18.0783 18.8284 18.8284C18.0783 19.5786 17.0609 20 16 20Z"
800
+ fill = "white"
801
+ />
802
+ </ svg >
803
+ ) ;
804
+ } ;
805
+
806
+ export const Statistics = ( ) => {
807
+ return (
808
+ < svg
809
+ xmlns = "http://www.w3.org/2000/svg"
810
+ width = "15"
811
+ height = "15"
812
+ viewBox = "0 0 32 32"
813
+ fill = "none"
814
+ data-tooltip-id = "tooltip"
815
+ data-tooltip-content = "Post Statistics"
816
+ >
817
+ < path
818
+ d = "M28 25H27V5C27 4.73478 26.8946 4.48043 26.7071 4.29289C26.5196 4.10536 26.2652 4 26 4H19C18.7348 4 18.4804 4.10536 18.2929 4.29289C18.1054 4.48043 18 4.73478 18 5V10H12C11.7348 10 11.4804 10.1054 11.2929 10.2929C11.1054 10.4804 11 10.7348 11 11V16H6C5.73478 16 5.48043 16.1054 5.29289 16.2929C5.10536 16.4804 5 16.7348 5 17V25H4C3.73478 25 3.48043 25.1054 3.29289 25.2929C3.10536 25.4804 3 25.7348 3 26C3 26.2652 3.10536 26.5196 3.29289 26.7071C3.48043 26.8946 3.73478 27 4 27H28C28.2652 27 28.5196 26.8946 28.7071 26.7071C28.8946 26.5196 29 26.2652 29 26C29 25.7348 28.8946 25.4804 28.7071 25.2929C28.5196 25.1054 28.2652 25 28 25ZM20 6H25V25H20V6ZM13 12H18V25H13V12ZM7 18H11V25H7V18Z"
819
+ fill = "white"
820
+ />
821
+ </ svg >
822
+ ) ;
823
+ } ;
0 commit comments