@@ -5,16 +5,7 @@ import TableRow from '@material-ui/core/TableRow';
5
5
import Paper from '@material-ui/core/Paper' ;
6
6
import GridContainer from '../../../components/Grid/GridContainer' ;
7
7
import GridItem from '../../../components/Grid/GridItem' ;
8
- import {
9
- CheckIcon ,
10
- ChevronDownIcon ,
11
- CodeIcon ,
12
- CodeReviewIcon ,
13
- CopyIcon ,
14
- LawIcon ,
15
- PeopleIcon ,
16
- TerminalIcon ,
17
- } from '@primer/octicons-react' ;
8
+ import { CodeReviewIcon , LawIcon , PeopleIcon } from '@primer/octicons-react' ;
18
9
19
10
const colors = {
20
11
'1C Enterprise' : '#814CCC' ,
@@ -578,13 +569,9 @@ const colors = {
578
569
579
570
import axios from 'axios' ;
580
571
import moment from 'moment' ;
572
+ import CodeActionButton from '../../../components/CustomButtons/CodeActionButton' ;
581
573
582
574
export default function Repositories ( props ) {
583
- const [ anchorEl , setAnchorEl ] = React . useState ( null ) ;
584
- const [ open , setOpen ] = React . useState ( false ) ;
585
- const [ placement , setPlacement ] = React . useState ( ) ;
586
- const [ cloneURL , setCloneURL ] = React . useState ( null ) ;
587
- const [ isCopied , setIsCopied ] = React . useState ( false ) ;
588
575
const [ github , setGitHub ] = React . useState ( { } ) ;
589
576
590
577
useEffect ( ( ) => {
@@ -599,13 +586,8 @@ export default function Repositories(props) {
599
586
} ) ;
600
587
} ;
601
588
602
- const handleClick = ( newPlacement , org , name ) => ( event ) => {
603
- setIsCopied ( false ) ;
604
- setAnchorEl ( event . currentTarget ) ;
605
- setOpen ( ( prev ) => placement !== newPlacement || ! prev ) ;
606
- setPlacement ( newPlacement ) ;
607
- setCloneURL ( `${ import . meta. env . VITE_SERVER_URI } /${ org } /${ name } .git` ) ;
608
- } ;
589
+ const { project : org , name } = props ?. data || { } ;
590
+ const cloneURL = `${ import . meta. env . VITE_SERVER_URI } /${ org } /${ name } .git` ;
609
591
610
592
return (
611
593
< TableRow >
@@ -686,95 +668,7 @@ export default function Repositories(props) {
686
668
</ TableCell >
687
669
< TableCell align = 'right' >
688
670
< div style = { { padding : '15px' } } >
689
- { ' ' }
690
- < span
691
- style = { {
692
- background : '#2da44e' ,
693
- borderRadius : '5px' ,
694
- color : 'white' ,
695
- padding : '8px 10px 8px 10px' ,
696
- fontWeight : 'bold' ,
697
- cursor : 'pointer' ,
698
- border : '1px solid rgba(240,246,252,0.1)' ,
699
- whiteSpace : 'nowrap' ,
700
- } }
701
- onClick = { handleClick ( 'bottom-end' , props . data . project , props . data . name ) }
702
- >
703
- < CodeIcon size = 'small' verticalAlign = 'middle' /> { ' ' }
704
- < span style = { { paddingLeft : '6px' , paddingRight : '10px' } } > Code</ span >
705
- < ChevronDownIcon size = 'small' verticalAlign = 'text-top' />
706
- </ span >
707
- < Popper
708
- open = { open }
709
- anchorEl = { anchorEl }
710
- placement = { placement }
711
- style = { {
712
- border : '1px solid rgba(211, 211, 211, 0.3)' ,
713
- borderRadius : '5px' ,
714
- minWidth : '300px' ,
715
- maxWidth : '450px' ,
716
- zIndex : 99 ,
717
- } }
718
- >
719
- < Paper >
720
- < div style = { { padding : '15px' , gap : '5px' } } >
721
- < TerminalIcon size = 'small' verticalAlign = 'middle' /> { ' ' }
722
- < span style = { { paddingLeft : '5px' , fontSize : '14px' , fontWeight : 'bold' } } >
723
- Clone
724
- </ span >
725
- < div style = { { marginTop : '5px' , maxWidth : '299px' } } >
726
- < div
727
- style = { {
728
- padding : '3px 8px 3px 8px' ,
729
- border : '1px solid gray' ,
730
- borderRadius : '5px' ,
731
- fontSize : '12px' ,
732
- minHeight : '22px' ,
733
- } }
734
- >
735
- < span
736
- style = { {
737
- float : 'left' ,
738
- overflow : 'hidden' ,
739
- textOverflow : 'ellipsis' ,
740
- whiteSpace : 'nowrap' ,
741
- width : '90%' ,
742
- } }
743
- >
744
- { cloneURL }
745
- </ span >
746
- < span
747
- style = { {
748
- float : 'right' ,
749
- } }
750
- >
751
- { ! isCopied && (
752
- < span
753
- style = { { cursor : 'pointer' } }
754
- onClick = { ( ) => {
755
- navigator . clipboard . writeText ( `git clone ${ cloneURL } ` ) ;
756
- setIsCopied ( true ) ;
757
- } }
758
- >
759
- < CopyIcon />
760
- </ span >
761
- ) }
762
- { isCopied && (
763
- < span style = { { color : 'green' } } >
764
- < CheckIcon />
765
- </ span >
766
- ) }
767
- </ span >
768
- </ div >
769
- </ div >
770
- < div style = { { marginTop : '5px' } } >
771
- < span style = { { fontWeight : 'lighter' , fontSize : '12px' , opacity : 0.9 } } >
772
- Use Git and run this command in your IDE or Terminal 👍
773
- </ span >
774
- </ div >
775
- </ div >
776
- </ Paper >
777
- </ Popper >
671
+ < CodeActionButton cloneURL = { cloneURL } />
778
672
</ div >
779
673
</ TableCell >
780
674
</ TableRow >
0 commit comments