Skip to content

Commit 6ad7cb4

Browse files
authored
Remove default username
1 parent 2094a29 commit 6ad7cb4

1 file changed

Lines changed: 76 additions & 76 deletions

File tree

src/renderer/src/components/popUp/index.tsx

Lines changed: 76 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,11 @@ function PopUp(): JSX.Element {
146146
</Box>
147147
</Backdrop>
148148
)
149-
case 'register':
150-
return (
151-
<Backdrop open={true} style={{ zIndex: 1000 }}>
152-
<Box
153-
style={{
149+
case 'register':
150+
return (
151+
<Backdrop open={true} style={{ zIndex: 1000 }}>
152+
<Box
153+
style={{
154154
display: 'flex',
155155
flexDirection: 'column',
156156
alignItems: 'center',
@@ -261,77 +261,77 @@ function PopUp(): JSX.Element {
261261
</Button>
262262
</Stack>
263263
</Box>
264-
</Backdrop>
265-
)
266-
case 'usernamePrompt':
267-
return (
268-
<Backdrop open={true} style={{ zIndex: 1000 }}>
269-
<Box
270-
style={{
271-
display: 'flex',
272-
flexDirection: 'column',
273-
alignItems: 'center',
274-
backgroundColor: '#1a1a1a',
275-
width: '600px',
276-
height: '250px',
277-
borderRadius: '5px',
278-
padding: '10px',
279-
textAlign: 'center'
280-
}}
281-
>
282-
<Typography
283-
variant="h4"
284-
style={{
285-
color: 'white',
286-
textAlign: 'center',
287-
marginTop: '20px',
288-
fontFamily: 'Brda',
289-
fontStyle: 'italic',
290-
letterSpacing: '2px'
291-
}}
292-
>
293-
Username
294-
</Typography>
295-
<p>Entrez s'il vous plaît votre Pseudo de la JVLAN (Pseudo Intranet)</p>
296-
<Input
297-
id="usernamePromptInput"
298-
sx={{ input: { textAlign: 'center' } }}
299-
type="text"
300-
placeholder="Username"
301-
defaultValue={localStorage.getItem('username') || window.getSystemUsername()}
302-
style={{ width: '200px', textAlign: 'center', fontSize: '20px' }}
303-
onChange={(event): void => {
304-
if (event.target.value.length > 16)
305-
event.target.value = event.target.value.slice(0, 16)
306-
}}
307-
/>
308-
<Stack direction="row" spacing={2}>
309-
<Button
310-
variant="contained"
311-
className="hoverButton"
312-
onClick={(): void => {
313-
const value = (
314-
document.getElementById('usernamePromptInput') as HTMLInputElement
315-
).value.trim()
316-
if (value) {
317-
setUsername(value)
318-
localStorage.setItem('username', value)
319-
localStorage.setItem('usernamePrompted', 'true')
320-
const field = document.getElementById('usernameField') as HTMLInputElement
321-
if (field) field.value = value
322-
setPopUpState(false)
323-
}
324-
}}
325-
style={{ marginTop: '10px' }}
326-
>
327-
Save
328-
</Button>
329-
</Stack>
330-
</Box>
331-
</Backdrop>
332-
)
333-
case 'confirmLogout':
334-
return <ConfirmLogout />
264+
</Backdrop>
265+
)
266+
case 'usernamePrompt':
267+
return (
268+
<Backdrop open={true} style={{ zIndex: 1000 }}>
269+
<Box
270+
style={{
271+
display: 'flex',
272+
flexDirection: 'column',
273+
alignItems: 'center',
274+
backgroundColor: '#1a1a1a',
275+
width: '600px',
276+
height: '250px',
277+
borderRadius: '5px',
278+
padding: '10px',
279+
textAlign: 'center'
280+
}}
281+
>
282+
<Typography
283+
variant="h4"
284+
style={{
285+
color: 'white',
286+
textAlign: 'center',
287+
marginTop: '20px',
288+
fontFamily: 'Brda',
289+
fontStyle: 'italic',
290+
letterSpacing: '2px'
291+
}}
292+
>
293+
Username
294+
</Typography>
295+
<p>Entrez s'il vous plaît votre Pseudo de la JVLAN (Pseudo Intranet)</p>
296+
<Input
297+
id="usernamePromptInput"
298+
sx={{ input: { textAlign: 'center' } }}
299+
type="text"
300+
placeholder="Username"
301+
//defaultValue={localStorage.getItem('username') || window.getSystemUsername()}
302+
style={{ width: '200px', textAlign: 'center', fontSize: '20px' }}
303+
onChange={(event): void => {
304+
if (event.target.value.length > 16)
305+
event.target.value = event.target.value.slice(0, 16)
306+
}}
307+
/>
308+
<Stack direction="row" spacing={2}>
309+
<Button
310+
variant="contained"
311+
className="hoverButton"
312+
onClick={(): void => {
313+
const value = (
314+
document.getElementById('usernamePromptInput') as HTMLInputElement
315+
).value.trim()
316+
if (value) {
317+
setUsername(value)
318+
localStorage.setItem('username', value)
319+
localStorage.setItem('usernamePrompted', 'true')
320+
const field = document.getElementById('usernameField') as HTMLInputElement
321+
if (field) field.value = value
322+
setPopUpState(false)
323+
}
324+
}}
325+
style={{ marginTop: '10px' }}
326+
>
327+
Save
328+
</Button>
329+
</Stack>
330+
</Box>
331+
</Backdrop>
332+
)
333+
case 'confirmLogout':
334+
return <ConfirmLogout />
335335
case 'authenticating':
336336
return <Authenticating />
337337
case 'accountSettings':

0 commit comments

Comments
 (0)