6
6
useTemplateSketchClassesQuery ,
7
7
} from "../../generated/graphql" ;
8
8
import TemplateChooser from "./TemplateChooser" ;
9
- import { useCallback , useMemo } from "react" ;
9
+ import { useCallback , useMemo , useState } from "react" ;
10
10
import NavSidebar , { NavSidebarItem } from "../../components/NavSidebar" ;
11
11
import Button from "../../components/Button" ;
12
12
import { useHistory , useRouteMatch , Switch , Route } from "react-router-dom" ;
@@ -49,6 +49,8 @@ export default function SketchClassAdmin() {
49
49
] ;
50
50
} , [ sketchClasses , slug ] ) ;
51
51
52
+ const [ showSuperuserOptions , setShowSuperuserOptions ] = useState ( false ) ;
53
+
52
54
const onCreate = useCallback (
53
55
( sc : SketchingDetailsFragment ) => {
54
56
// eslint-disable-next-line i18next/no-literal-string
@@ -66,12 +68,32 @@ export default function SketchClassAdmin() {
66
68
< h2 className = "text-lg font-semibold mb-2" >
67
69
{ t ( "Create a new Sketch Class" ) }
68
70
</ h2 >
69
- < TemplateChooser onCreate = { onCreate } />
70
- < Button
71
- label = { t ( "Cancel" ) }
72
- className = "mt-4"
73
- href = { `/${ getSlug ( ) } /admin/sketching/` }
71
+ < TemplateChooser
72
+ showSuperuserOptions = { showSuperuserOptions }
73
+ onCreate = { onCreate }
74
74
/>
75
+ < div className = "flex items-center mt-4" >
76
+ < Button
77
+ label = { t ( "Cancel" ) }
78
+ className = ""
79
+ href = { `/${ getSlug ( ) } /admin/sketching/` }
80
+ />
81
+ < div className = "flex-1 text-right absolute right-5 top-2" >
82
+ < div className = "opacity-10 hover:opacity-100" >
83
+ < input
84
+ type = "checkbox"
85
+ className = "ml-4 rounded"
86
+ checked = { showSuperuserOptions }
87
+ onChange = { ( e ) => {
88
+ setShowSuperuserOptions ( e . target . checked ) ;
89
+ } }
90
+ />
91
+ < label className = "ml-2 text-xs" >
92
+ { t ( "Show superuser options" ) }
93
+ </ label >
94
+ </ div >
95
+ </ div >
96
+ </ div >
75
97
</ div >
76
98
</ div >
77
99
</ Route >
0 commit comments