Hide redundant member details on sign up, remove padding

This commit is contained in:
Tanner Collin 2023-07-11 17:42:50 +00:00
parent 7023e7f6fd
commit 8ca2dc420a
3 changed files with 15 additions and 15 deletions

View File

@ -169,7 +169,7 @@ export function ImageCrop(props) {
} }
export function AccountForm(props) { export function AccountForm(props) {
const { token, user, refreshUser } = props; const { token, user, refreshUser, isSignup } = props;
const member = user.member; const member = user.member;
const [input, setInput] = useState({ ...member, set_details: true }); const [input, setInput] = useState({ ...member, set_details: true });
const [error, setError] = useState({}); const [error, setError] = useState({});
@ -216,19 +216,19 @@ export function AccountForm(props) {
<p>{user.username}</p> <p>{user.username}</p>
</div> </div>
<Form.Input {!isSignup && <Form.Input
label='Preferred First Name' label='Preferred First Name'
autoComplete='off' autoComplete='off'
required required
{...makeProps('preferred_name')} {...makeProps('preferred_name')}
/> />}
<Form.Input {!isSignup && <Form.Input
label='Email Address' label='Email Address'
autoComplete='off' autoComplete='off'
required required
{...makeProps('email')} {...makeProps('email')}
/> />}
<Form.Input <Form.Input
label='Phone Number (999) 555-1234' label='Phone Number (999) 555-1234'
@ -266,7 +266,7 @@ export function AccountForm(props) {
</Message> </Message>
} }
<Form.Field> {!isSignup && <Form.Field>
<label>Participate in "Last Scanned" member list?</label> <label>Participate in "Last Scanned" member list?</label>
<Form.Checkbox <Form.Checkbox
label='Yes, show me' label='Yes, show me'
@ -279,15 +279,15 @@ export function AccountForm(props) {
false false
} }
/> />
</Form.Field> </Form.Field>}
<Form.Input {!isSignup && <Form.Input
label='Member Photo' label='Member Photo'
name='photo' name='photo'
type='file' type='file'
accept='image/*' accept='image/*'
onChange={handleUpload} onChange={handleUpload}
/> />}
{input.photo && {input.photo &&
<> <>

View File

@ -234,11 +234,11 @@ function App() {
</Container> </Container>
</Menu> </Menu>
<Route exact path='/'>
<Home token={token} setTokenCache={setTokenCache} user={user} refreshUser={refreshUser} />
</Route>
<div className='topPadding'> <div className='topPadding'>
<Route exact path='/'>
<Home token={token} setTokenCache={setTokenCache} user={user} refreshUser={refreshUser} />
</Route>
<Switch> <Switch>
<Route path='/storage/:id'> <Route path='/storage/:id'>
<StorageDetail token={token} user={user} /> <StorageDetail token={token} user={user} />

View File

@ -264,13 +264,13 @@ export function Home(props) {
return ( return (
<Container> <Container>
<Grid stackable padded columns={2}> <Grid stackable columns={2}>
<Grid.Column> <Grid.Column>
{user ? {user ?
user.member.set_details ? user.member.set_details ?
<MemberInfo user={user} /> <MemberInfo user={user} />
: :
<AccountForm {...props} /> <AccountForm {...props} isSignup={true} />
: :
<div> <div>
<LoginForm {...props} /> <LoginForm {...props} />