fix reload on submit, button disabled styles, profile name styles in header

This commit is contained in:
Bekbolsun
2024-02-09 19:33:32 +06:00
parent 104404b04c
commit f408fd1b38
5 changed files with 18 additions and 17 deletions

View File

@@ -43,7 +43,7 @@ export const ModalAppDetails = () => {
}) })
// eslint-disable-next-line // eslint-disable-next-line
}, [appNpub]) }, [appNpub, isModalOpened])
useEffect(() => { useEffect(() => {
return () => { return () => {
@@ -164,7 +164,7 @@ export const ModalAppDetails = () => {
value={details.icon} value={details.icon}
/> />
<Button type="submit" fullWidth disabled={!isFormValid || isLoading}> <Button varianttype="secondary" type="submit" fullWidth disabled={!isFormValid || isLoading}>
Save changes {isLoading && <CircularProgress sx={{ marginLeft: '0.5rem' }} size={'1rem'} />} Save changes {isLoading && <CircularProgress sx={{ marginLeft: '0.5rem' }} size={'1rem'} />}
</Button> </Button>
</Stack> </Stack>

View File

@@ -110,9 +110,10 @@ export const ModalImportKeys = () => {
</Typography> </Typography>
</Stack> </Stack>
<Input <Input
label="Username or nip05 or npub" label="Username"
fullWidth fullWidth
placeholder="name or name@domain.com or npub1..." placeholder="Enter a Username"
endAdornment={<Typography color={'#FFFFFFA8'}>@{DOMAIN}</Typography>}
{...register('username')} {...register('username')}
error={!!errors.username} error={!!errors.username}
helperText={inputHelperText} helperText={inputHelperText}

View File

@@ -51,11 +51,11 @@ export const ModalSignUp = () => {
const inputHelperText = getInputHelperText() const inputHelperText = getInputHelperText()
const handleSubmit = async (e: React.FormEvent) => { const handleSubmit = async (e: React.FormEvent) => {
e.preventDefault()
if (isLoading || !isAvailable) return undefined if (isLoading || !isAvailable) return undefined
const name = enteredValue.trim() const name = enteredValue.trim()
if (!name.length) return if (!name.length) return
e.preventDefault()
try { try {
setIsLoading(true) setIsLoading(true)
@@ -89,9 +89,9 @@ export const ModalSignUp = () => {
</Typography> </Typography>
</Stack> </Stack>
<Input <Input
label="Enter a Username" label="Username"
fullWidth fullWidth
placeholder="Username" placeholder="Enter a Username"
helperText={inputHelperText} helperText={inputHelperText}
endAdornment={<Typography color={'#FFFFFFA8'}>@{DOMAIN}</Typography>} endAdornment={<Typography color={'#FFFFFFA8'}>@{DOMAIN}</Typography>}
onChange={handleInputChange} onChange={handleInputChange}

View File

@@ -41,9 +41,6 @@ export const StyledProfileContainer = styled((props: StackProps) => <Stack {...p
}, },
'& .username': { '& .username': {
cursor: 'pointer', cursor: 'pointer',
'&:hover': {
textDecoration: 'underline',
},
}, },
})) }))

View File

@@ -7,7 +7,7 @@ export type AppButtonProps = MuiButtonProps & {
export const Button = forwardRef<HTMLButtonElement, AppButtonProps>(({ children, ...restProps }, ref) => { export const Button = forwardRef<HTMLButtonElement, AppButtonProps>(({ children, ...restProps }, ref) => {
return ( return (
<StyledButton classes={{ root: 'button' }} {...restProps} ref={ref}> <StyledButton classes={{ root: 'button', disabled: 'disabled' }} {...restProps} ref={ref}>
{children} {children}
</StyledButton> </StyledButton>
) )
@@ -27,19 +27,22 @@ const StyledButton = styled(
background: theme.palette.backgroundSecondary.default, background: theme.palette.backgroundSecondary.default,
}, },
color: theme.palette.text.primary, color: theme.palette.text.primary,
'&.disabled': {
opacity: 0.5,
cursor: 'not-allowed',
},
} }
} }
return { return {
...commonStyles, ...commonStyles,
'&.button:is(:hover, :active, &)': { '&.button:is(:hover, :active, &, .disabled)': {
background: theme.palette.primary.main, background: theme.palette.primary.main,
}, },
color: theme.palette.text.secondary, color: theme.palette.text.secondary,
':disabled': { '&.disabled': {
'&.button:is(:hover, :active, &)': { color: theme.palette.text.secondary,
background: theme.palette.backgroundSecondary.default, opacity: 0.5,
}, cursor: 'not-allowed',
color: theme.palette.backgroundSecondary.paper,
}, },
} }
}) })