@@ -145,8 +145,37 @@ export default function CreateTicketModal({ keypress, setKeyPressDown }) {
145145
146146 useEffect ( ( ) => checkPress ( ) , [ keypress ] ) ;
147147
148- const showKeyboardShortcuts =
149- localStorage . getItem ( "hide-keyboard-shortcuts" ) === "true" ;
148+ const [ hideKeyboardShortcuts , setHideKeyboardShortcuts ] = useState ( false ) ;
149+ const [ hideName , setHideName ] = useState ( false ) ;
150+ const [ hideEmail , setHideEmail ] = useState ( false ) ;
151+
152+ useEffect ( ( ) => {
153+ const loadFlags = ( ) => {
154+ const savedFlags = localStorage . getItem ( "featureFlags" ) ;
155+ if ( savedFlags ) {
156+ const flags = JSON . parse ( savedFlags ) ;
157+ const hideShortcuts = flags . find (
158+ ( f : any ) => f . name === "Hide Keyboard Shortcuts"
159+ ) ?. enabled ;
160+
161+ const hideName = flags . find (
162+ ( f : any ) => f . name === "Hide Name in Create"
163+ ) ?. enabled ;
164+
165+ const hideEmail = flags . find (
166+ ( f : any ) => f . name === "Hide Email in Create"
167+ ) ?. enabled ;
168+
169+ setHideKeyboardShortcuts ( hideShortcuts || false ) ;
170+ setHideName ( hideName || false ) ;
171+ setHideEmail ( hideEmail || false ) ;
172+ }
173+ } ;
174+
175+ loadFlags ( ) ;
176+ window . addEventListener ( "storage" , loadFlags ) ;
177+ return ( ) => window . removeEventListener ( "storage" , loadFlags ) ;
178+ } , [ ] ) ;
150179
151180 return (
152181 < >
@@ -162,7 +191,7 @@ export default function CreateTicketModal({ keypress, setKeyPressDown }) {
162191 { state === "expanded" && (
163192 < >
164193 < span className = "whitespace-nowrap" > New Issue</ span >
165- { showKeyboardShortcuts && (
194+ { ! hideKeyboardShortcuts && (
166195 < div className = "flex w-full justify-end float-right" >
167196 < span className = "flex h-6 w-6 shrink-0 items-center bg-transparent border-none justify-center text-md font-medium" >
168197 c
@@ -225,26 +254,30 @@ export default function CreateTicketModal({ keypress, setKeyPressDown }) {
225254 placeholder = "Issue title"
226255 maxLength = { 64 }
227256 onChange = { ( e ) => setTitle ( e . target . value ) }
228- className = "w-full pl-0 pr-0 text-md text-foreground bg-background border-none focus:outline-none focus:shadow-none focus:ring-0 focus:border-none"
257+ className = "w-full pl-0 pr-0 pt-0 text-md text-foreground bg-background border-none focus:outline-none focus:shadow-none focus:ring-0 focus:border-none"
229258 />
230259
231260 < div className = "" >
232- < input
233- type = "text"
234- id = "name"
235- placeholder = { t ( "ticket_name_here" ) }
236- name = "name"
237- onChange = { ( e ) => setName ( e . target . value ) }
238- className = " w-full pl-0 pr-0text-foreground bg-background sm:text-sm border-none focus:outline-none focus:shadow-none focus:ring-0 focus:border-none"
239- />
240-
241- < input
242- type = "text"
243- name = "email"
244- placeholder = { t ( "ticket_email_here" ) }
245- onChange = { ( e ) => setEmail ( e . target . value ) }
246- className = " w-full pl-0 pr-0 text-foreground bg-background sm:text-sm border-none focus:outline-none focus:shadow-none focus:ring-0 focus:border-none"
247- />
261+ { ! hideName && (
262+ < input
263+ type = "text"
264+ id = "name"
265+ placeholder = { t ( "ticket_name_here" ) }
266+ name = "name"
267+ onChange = { ( e ) => setName ( e . target . value ) }
268+ className = " w-full pl-0 pr-0text-foreground bg-background sm:text-sm border-none focus:outline-none focus:shadow-none focus:ring-0 focus:border-none"
269+ />
270+ ) }
271+
272+ { ! hideEmail && (
273+ < input
274+ type = "text"
275+ name = "email"
276+ placeholder = { t ( "ticket_email_here" ) }
277+ onChange = { ( e ) => setEmail ( e . target . value ) }
278+ className = " w-full pl-0 pr-0 text-foreground bg-background sm:text-sm border-none focus:outline-none focus:shadow-none focus:ring-0 focus:border-none"
279+ />
280+ ) }
248281
249282 < Editor setIssue = { setIssue } />
250283
0 commit comments