Skip to content

Commit

Permalink
Fix profile inputs disabled for teacher
Browse files Browse the repository at this point in the history
  • Loading branch information
akmatoff committed May 24, 2024
1 parent 21d1a1d commit ed8577c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/components/shared/CustomInput/CustomInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ interface Props extends InputHTMLAttributes<HTMLInputElement> {
label?: string;
errorMessage?: string;
isViewOnly?: boolean;
ignoreRole?: boolean;
onChangeCallback?: (value: string) => void;
}

Expand All @@ -28,6 +29,7 @@ const CustomInput: FC<Props> = forwardRef<HTMLInputElement, Props>(
errorMessage,
onChange,
isViewOnly = false,
ignoreRole = false,
},
ref?
) {
Expand All @@ -44,7 +46,7 @@ const CustomInput: FC<Props> = forwardRef<HTMLInputElement, Props>(
type={type}
isInvalid={!!errorMessage}
errorMessage={errorMessage}
isDisabled={isViewOnly || isTeacher}
isDisabled={isViewOnly || (!ignoreRole && isTeacher)}
/>
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/my-groups/StudentProgressModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export default function StudentProgressModal({
</div>
</ModalBody>
<ModalFooter>
<Button onPress={onClose} color="secondary">
<Button onPress={onClose} color="secondary" size="sm">
Закрыть
</Button>
</ModalFooter>
Expand Down
2 changes: 2 additions & 0 deletions src/pages/profile/Profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export default function ProfilePage() {
currentPassword: e.target.value,
})
}
ignoreRole
/>

<CustomInput
Expand All @@ -80,6 +81,7 @@ export default function ProfilePage() {
newPassword: e.target.value,
})
}
ignoreRole
/>

<div>
Expand Down

0 comments on commit ed8577c

Please sign in to comment.