Updated the profile page a bit to accommodate recent changes

This commit is contained in:
Tiago Ribeiro
2024-01-16 23:11:16 +00:00
parent a18ee93909
commit 5540e4a3e6

View File

@@ -82,7 +82,7 @@ function UserProfile({user, mutateUser}: Props) {
const [commercialRegistration, setCommercialRegistration] = useState<string | undefined>( const [commercialRegistration, setCommercialRegistration] = useState<string | undefined>(
user.type === "agent" ? user.agentInformation?.commercialRegistration : undefined, user.type === "agent" ? user.agentInformation?.commercialRegistration : undefined,
); );
const [timezone, setTimezone] = useState<string>(user.demographicInformation?.timezone || 'UTC'); const [timezone, setTimezone] = useState<string>(user.demographicInformation?.timezone || "UTC");
const {groups} = useGroups(); const {groups} = useGroups();
const {users} = useUsers(); const {users} = useUsers();
@@ -248,7 +248,7 @@ function UserProfile({user, mutateUser}: Props) {
); );
const TimezoneInput = () => ( const TimezoneInput = () => (
<div className="flex flex-col gap-3 w-1/2"> <div className="flex flex-col gap-3 w-full">
<label className="font-normal text-base text-mti-gray-dim">Timezone</label> <label className="font-normal text-base text-mti-gray-dim">Timezone</label>
<TimezoneSelect value={timezone} onChange={setTimezone} /> <TimezoneSelect value={timezone} onChange={setTimezone} />
</div> </div>
@@ -293,27 +293,29 @@ function UserProfile({user, mutateUser}: Props) {
/> />
</DoubleColumnRow> </DoubleColumnRow>
<PasswordInput /> <PasswordInput />
{user.type === "student" && (
<Input
type="text"
name="passport_id"
label="Passport/National ID"
onChange={(e) => setPassportID(e)}
placeholder="Enter National ID or Passport number"
value={passport_id}
required
/>
)}
{user.type === "agent" && <AgentInformationInput />} {user.type === "agent" && <AgentInformationInput />}
<DoubleColumnRow> <DoubleColumnRow>
<CountryInput /> <CountryInput />
<PhoneInput /> <PhoneInput />
</DoubleColumnRow> </DoubleColumnRow>
<DoubleColumnRow>
{user.type === "student" ? (
<DoubleColumnRow>
<Input
type="text"
name="passport_id"
label="Passport/National ID"
onChange={(e) => setPassportID(e)}
placeholder="Enter National ID or Passport number"
value={passport_id}
required
/>
<TimezoneInput />
</DoubleColumnRow>
) : (
<TimezoneInput /> <TimezoneInput />
</DoubleColumnRow> )}
<Divider /> <Divider />