From 7db85cc91be56b7b71ee7110a43dfc8a862e54c3 Mon Sep 17 00:00:00 2001 From: Arik Chakma Date: Wed, 3 Apr 2024 23:42:58 +0600 Subject: [PATCH] feat: add email icon --- src/api/user.ts | 7 ++----- .../UpdateProfile/UpdatePublicProfileForm.tsx | 16 ++++++++++++++++ .../UserPublicProfileHeader.tsx | 8 +++++--- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/src/api/user.ts b/src/api/user.ts index 3fc3f7198..e82f13b75 100644 --- a/src/api/user.ts +++ b/src/api/user.ts @@ -47,6 +47,7 @@ export interface UserDocument { profileVisibility: AllowedProfileVisibility; publicConfig?: { isAvailableForHire: boolean; + isEmailVisible: boolean; headline: string; roadmaps: string[]; customRoadmaps: string[]; @@ -78,11 +79,7 @@ type ProgressResponse = { export type GetPublicProfileResponse = Omit< UserDocument, - | 'password' - | 'verificationCode' - | 'resetPasswordCode' - | 'resetPasswordCodeAt' - | 'email' + 'password' | 'verificationCode' | 'resetPasswordCode' | 'resetPasswordCodeAt' > & { activity: UserActivityCount; roadmaps: ProgressResponse[]; diff --git a/src/components/UpdateProfile/UpdatePublicProfileForm.tsx b/src/components/UpdateProfile/UpdatePublicProfileForm.tsx index acd0e366a..af585091d 100644 --- a/src/components/UpdateProfile/UpdatePublicProfileForm.tsx +++ b/src/components/UpdateProfile/UpdatePublicProfileForm.tsx @@ -30,6 +30,7 @@ export function UpdatePublicProfileForm() { const [publicProfileUrl, setPublicProfileUrl] = useState(''); const [isAvailableForHire, setIsAvailableForHire] = useState(false); + const [isEmailVisible, setIsEmailVisible] = useState(true); const [headline, setHeadline] = useState(''); const [username, setUsername] = useState(''); const [roadmapVisibility, setRoadmapVisibility] = @@ -56,6 +57,7 @@ export function UpdatePublicProfileForm() { `${import.meta.env.PUBLIC_API_URL}/v1-update-public-profile-config`, { isAvailableForHire, + isEmailVisible, profileVisibility, headline, username, @@ -116,6 +118,7 @@ export function UpdatePublicProfileForm() { setRoadmaps(publicConfig?.roadmaps || []); setCustomRoadmapVisibility(publicConfig?.customRoadmapVisibility || 'none'); setIsAvailableForHire(publicConfig?.isAvailableForHire || false); + setIsEmailVisible(publicConfig?.isEmailVisible ?? true); setIsLoading(false); }; @@ -450,6 +453,19 @@ export function UpdatePublicProfileForm() {
+
+ setIsEmailVisible(e.target.checked)} + /> + +
+
@@ -37,6 +38,7 @@ export function UserPublicProfileHeader(props: UserPublicProfileHeaderProps) { )} {links?.twitter && } {links?.website && } + {isEmailVisible && }