Skip to content

Conversation

@Raju-kadel-27
Copy link
Contributor

PR for issue #139

@github-actions
Copy link

github-actions bot commented Feb 24, 2024

Thank you for following the naming conventions for pull request titles! 🙏

@Raju-kadel-27 Raju-kadel-27 changed the title feat:update-profile-procedure feat: update profile procedure Feb 24, 2024
@Raju-kadel-27 Raju-kadel-27 changed the title feat: update profile procedure feat: update profile Feb 24, 2024
@Raju-kadel-27 Raju-kadel-27 marked this pull request as ready for review February 28, 2024 14:11
@Raju-kadel-27
Copy link
Contributor Author

@dahal @chetannn I think it's ready for review.

where: {
status: "ACTIVE",
id: user.memberId,
companyId: user.companyId,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

filtering by companyId is not necessary here.

FormLabel,
FormMessage,
} from "@/components/ui/form";
const profileSettingsSchema = z.object({
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this schema to a dedicated file so that it can be used on the backend as well.

const [file, setFile] = useState<File | null>(null);
const fileInputRef = useRef<HTMLInputElement>(null);

// @ts-expect-error: xxxx
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this comment

resolver: zodResolver(profileSettingsSchema),
});

// @ts-expect-error: xxxx
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

},
});

useEffect(() => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to fetch data initially from the server component and pass the profile as prop. useEffect is redundant here.

}
}, [memberProfile?.data, form]);

const handleImageUpload = async (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this unused function.

const handleFileChange = (event: React.ChangeEvent<HTMLInputElement>) => {
const files = event.target.files;

if (files?.[0]) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extract the file validation logic to a utils.

const handleRemoveAvatar = () => {
setFile(null);
};
async function onSubmit(values: z.infer<typeof profileSettingsSchema>) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing a profile picture and saving profile information are two different actions like I said the day before. Clicking on save button should only save the profile information.

Copy link
Collaborator

@chetannn chetannn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have requested for some changes. Awesome work BTW

@Raju-kadel-27
Copy link
Contributor Author

@chetannn I think I fixed the requested changes ??

@dahal dahal merged commit 879ea5d into captableinc:main Mar 1, 2024
@Raju-kadel-27 Raju-kadel-27 deleted the feat/complete-profile-setup branch March 1, 2024 06:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants