feat: add email icon

pull/5494/head
Arik Chakma 8 months ago
parent 4300d08f70
commit 7db85cc91b
  1. 7
      src/api/user.ts
  2. 16
      src/components/UpdateProfile/UpdatePublicProfileForm.tsx
  3. 8
      src/components/UserPublicProfile/UserPublicProfileHeader.tsx

@ -47,6 +47,7 @@ export interface UserDocument {
profileVisibility: AllowedProfileVisibility; profileVisibility: AllowedProfileVisibility;
publicConfig?: { publicConfig?: {
isAvailableForHire: boolean; isAvailableForHire: boolean;
isEmailVisible: boolean;
headline: string; headline: string;
roadmaps: string[]; roadmaps: string[];
customRoadmaps: string[]; customRoadmaps: string[];
@ -78,11 +79,7 @@ type ProgressResponse = {
export type GetPublicProfileResponse = Omit< export type GetPublicProfileResponse = Omit<
UserDocument, UserDocument,
| 'password' 'password' | 'verificationCode' | 'resetPasswordCode' | 'resetPasswordCodeAt'
| 'verificationCode'
| 'resetPasswordCode'
| 'resetPasswordCodeAt'
| 'email'
> & { > & {
activity: UserActivityCount; activity: UserActivityCount;
roadmaps: ProgressResponse[]; roadmaps: ProgressResponse[];

@ -30,6 +30,7 @@ export function UpdatePublicProfileForm() {
const [publicProfileUrl, setPublicProfileUrl] = useState(''); const [publicProfileUrl, setPublicProfileUrl] = useState('');
const [isAvailableForHire, setIsAvailableForHire] = useState(false); const [isAvailableForHire, setIsAvailableForHire] = useState(false);
const [isEmailVisible, setIsEmailVisible] = useState(true);
const [headline, setHeadline] = useState(''); const [headline, setHeadline] = useState('');
const [username, setUsername] = useState(''); const [username, setUsername] = useState('');
const [roadmapVisibility, setRoadmapVisibility] = const [roadmapVisibility, setRoadmapVisibility] =
@ -56,6 +57,7 @@ export function UpdatePublicProfileForm() {
`${import.meta.env.PUBLIC_API_URL}/v1-update-public-profile-config`, `${import.meta.env.PUBLIC_API_URL}/v1-update-public-profile-config`,
{ {
isAvailableForHire, isAvailableForHire,
isEmailVisible,
profileVisibility, profileVisibility,
headline, headline,
username, username,
@ -116,6 +118,7 @@ export function UpdatePublicProfileForm() {
setRoadmaps(publicConfig?.roadmaps || []); setRoadmaps(publicConfig?.roadmaps || []);
setCustomRoadmapVisibility(publicConfig?.customRoadmapVisibility || 'none'); setCustomRoadmapVisibility(publicConfig?.customRoadmapVisibility || 'none');
setIsAvailableForHire(publicConfig?.isAvailableForHire || false); setIsAvailableForHire(publicConfig?.isAvailableForHire || false);
setIsEmailVisible(publicConfig?.isEmailVisible ?? true);
setIsLoading(false); setIsLoading(false);
}; };
@ -450,6 +453,19 @@ export function UpdatePublicProfileForm() {
</div> </div>
<div> <div>
<div className="flex items-center gap-2">
<input
type="checkbox"
name="isEmailVisible"
id="isEmailVisible"
checked={isEmailVisible}
onChange={(e) => setIsEmailVisible(e.target.checked)}
/>
<label htmlFor="isEmailVisible" className="">
Show my Email
</label>
</div>
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">
<input <input
type="checkbox" type="checkbox"

@ -1,4 +1,4 @@
import { Github, Globe, LinkedinIcon, Twitter } from 'lucide-react'; import { Github, Globe, LinkedinIcon, Mail, Twitter } from 'lucide-react';
import type { GetPublicProfileResponse } from '../../api/user'; import type { GetPublicProfileResponse } from '../../api/user';
type UserPublicProfileHeaderProps = { type UserPublicProfileHeaderProps = {
@ -7,8 +7,9 @@ type UserPublicProfileHeaderProps = {
export function UserPublicProfileHeader(props: UserPublicProfileHeaderProps) { export function UserPublicProfileHeader(props: UserPublicProfileHeaderProps) {
const { userDetails } = props; const { userDetails } = props;
const { name, links, publicConfig, avatar } = userDetails;
const { headline, isAvailableForHire } = publicConfig!; const { name, links, publicConfig, avatar, email } = userDetails;
const { headline, isAvailableForHire, isEmailVisible } = publicConfig!;
return ( return (
<div className="flex items-center gap-8"> <div className="flex items-center gap-8">
@ -37,6 +38,7 @@ export function UserPublicProfileHeader(props: UserPublicProfileHeaderProps) {
)} )}
{links?.twitter && <UserLink href={links?.twitter} icon={Twitter} />} {links?.twitter && <UserLink href={links?.twitter} icon={Twitter} />}
{links?.website && <UserLink href={links?.website} icon={Globe} />} {links?.website && <UserLink href={links?.website} icon={Globe} />}
{isEmailVisible && <UserLink href={`mailto:${email}`} icon={Mail} />}
</div> </div>
</div> </div>
</div> </div>

Loading…
Cancel
Save