File tree Expand file tree Collapse file tree 4 files changed +50
-17
lines changed
services/app/apps/codebattle/assets/js/widgets/pages/game Expand file tree Collapse file tree 4 files changed +50
-17
lines changed Original file line number Diff line number Diff line change 1+ import React from 'react' ;
2+
3+ import copy from 'copy-to-clipboard' ;
4+
5+ import i18n from '../../../i18n' ;
6+
7+ const CopyEditorButton = ( { editor } ) => {
8+ const className = 'btn btn-sm btn-secondary cb-btn-secondary cb-rounded mx-1' ;
9+ const text = i18n . t ( 'Copy' ) ;
10+
11+ const handleCopyClick = ( ) => {
12+ copy ( editor . value ) ;
13+ } ;
14+
15+ return (
16+ < button
17+ type = "button"
18+ className = { className }
19+ onClick = { handleCopyClick }
20+ title = { text }
21+ >
22+ { text }
23+ </ button >
24+ ) ;
25+ } ;
26+
27+ export default CopyEditorButton ;
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import GameRoomModes from '../../config/gameModes';
66import Placements from '../../config/placements' ;
77
88// import DarkModeButton from './DarkModeButton';
9+ import CopyEditorButton from './CopyEditorButton' ;
910import EditorResultIcon from './EditorResultIcon' ;
1011import GameActionButtons from './GameActionButtons' ;
1112import GameBanPlayerButton from './GameBanPlayerButton' ;
@@ -66,22 +67,27 @@ const EditorToolbar = ({
6667 { showControlBtns && ! isHistory && editorState !== 'banned' && (
6768 < GameActionButtons { ...actionBtnsProps } />
6869 ) }
69- < div
70- className = "btn-group btn-group-sm py-2 mx-2"
71- role = "group "
72- aria-label = "Report actions "
73- >
74- { ! showControlBtns && (
70+ { ! showControlBtns && (
71+ < div
72+ className = "py-2 "
73+ role = "group "
74+ aria-label = "Report actions"
75+ >
7576 < GameReportButton userId = { player . id } gameId = { gameId } />
76- ) }
77- { isAdmin && ! showControlBtns && (
78- < GameBanPlayerButton
79- userId = { player . id }
80- status = { status }
81- tournamentId = { tournamentId }
82- />
83- ) }
84- </ div >
77+ { isAdmin && (
78+ < >
79+ < GameBanPlayerButton
80+ userId = { player . id }
81+ status = { status }
82+ tournamentId = { tournamentId }
83+ />
84+ < CopyEditorButton
85+ editor = { editor }
86+ />
87+ </ >
88+ ) }
89+ </ div >
90+ ) }
8591 < div
8692 className = { userInfoClassNames }
8793 role = "group"
Original file line number Diff line number Diff line change @@ -188,7 +188,7 @@ function GameActionButtons({
188188
189189 return (
190190 < div
191- className = "d-flex py-2 mr-2 "
191+ className = "d-flex py-2"
192192 role = "group"
193193 aria-label = "Game actions"
194194 >
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ const InfoPanel = ({
2424 return (
2525 < >
2626 < div className = "col-12 col-lg-6 p-1 cb-height-info" >
27- < div className = "d-flex shadow-sm flex-column h-100 cb-bg-panel" >
27+ < div className = "d-flex shadow-sm flex-column h-100 cb-bg-panel cb-rounded " >
2828 < nav >
2929 < div
3030 className = "nav nav-tabs cb-border-color text-uppercase font-weight-bold text-center"
You can’t perform that action at this time.
0 commit comments