diff --git a/frontend/src/components/profiles/action-buttons/CreateProfileDialog.tsx b/frontend/src/components/profiles/action-buttons/CreateProfileDialog.tsx index 56db5fa..173531d 100644 --- a/frontend/src/components/profiles/action-buttons/CreateProfileDialog.tsx +++ b/frontend/src/components/profiles/action-buttons/CreateProfileDialog.tsx @@ -26,11 +26,20 @@ import { useForm } from "react-hook-form"; import { z } from "zod"; import { zodResolver } from "@hookform/resolvers/zod"; +const linkedinUrlRegex = /^(?:https?:\/\/(?:www\.)?linkedin\.com\/in\/)?[a-zA-Z0-9-]{3,100}\/?$/; + const formSchema = z.object({ name: z.string().min(2, { message: "Name must be at least 2 characters." }), description: z.string().optional(), githubLogin: z.string().optional(), twitterHandle: z.string().optional(), + linkedinAccount: z + .string() + .optional() + .refine( + (value) => !value || linkedinUrlRegex.test(value), + "LinkedIn URL must be in format: https://www.linkedin.com/in/your-handle or just the handle (3-100 characters)" + ), }); type FormValues = z.infer; @@ -52,6 +61,7 @@ export function CreateProfileButton() { description: values.description || "", github_login: values.githubLogin || "", twitter_handle: values.twitterHandle || "", + linkedin_account: values.linkedinAccount || "", }, }); await queryClient.invalidateQueries({ queryKey: ["profiles"] }); @@ -138,6 +148,25 @@ export function CreateProfileButton() { )} /> + ( + + LinkedIn Profile URL + + + +

+ Paste your full LinkedIn URL or just the handle +

+ +
+ )} + />
diff --git a/frontend/src/components/profiles/profile-page/ProfileMain.tsx b/frontend/src/components/profiles/profile-page/ProfileMain.tsx index e926d68..c9edcba 100644 --- a/frontend/src/components/profiles/profile-page/ProfileMain.tsx +++ b/frontend/src/components/profiles/profile-page/ProfileMain.tsx @@ -25,6 +25,7 @@ export function ProfileMain({ address }: { address: string }) { description={profile?.description} githubLogin={profile?.github_login} twitterHandle={profile?.twitter_handle} + linkedinAccount={profile?.linkedin_account} />
diff --git a/frontend/src/lib/constants/profileConstants.ts b/frontend/src/lib/constants/profileConstants.ts index 5c3b73b..e53cfb1 100644 --- a/frontend/src/lib/constants/profileConstants.ts +++ b/frontend/src/lib/constants/profileConstants.ts @@ -7,6 +7,7 @@ export const PROFILES: Profile[] = [ description: "Full-stack developer passionate about Web3 and Rust", githubLogin: "alice-dev", twitterHandle: "alice_dev", + linkedinAccount: "alice-developer", attestationCount: 5, attestations: [ { @@ -35,6 +36,7 @@ export const PROFILES: Profile[] = [ description: "Smart contract developer and DeFi enthusiast", githubLogin: "bob-builder", twitterHandle: "bob_builder", + linkedinAccount: "bob-builder", attestationCount: 3, attestations: [ { @@ -53,10 +55,11 @@ export const PROFILES: Profile[] = [ }, { address: "0x5555...7777", - name: "", - description: "", + name: "", + description: "", githubLogin: undefined, - twitterHandle: undefined, + twitterHandle: undefined, + linkedinAccount: undefined, attestationCount: 2, attestations: [ { diff --git a/frontend/src/lib/types/api.d.ts b/frontend/src/lib/types/api.d.ts index 9a211fa..1eda18c 100644 --- a/frontend/src/lib/types/api.d.ts +++ b/frontend/src/lib/types/api.d.ts @@ -4,6 +4,7 @@ export type CreateProfileInput = { avatar_url?: string; github_login?: string; twitter_handle?: string; + linkedin_account?: string; }; export type UpdateProfileInput = { @@ -12,6 +13,7 @@ export type UpdateProfileInput = { avatar_url?: string; github_login?: string; twitter_handle?: string; + linkedin_account?: string; }; export type UpdateProfileResponse = unknown; diff --git a/frontend/src/lib/types/profiles.d.ts b/frontend/src/lib/types/profiles.d.ts index e6e1439..56926cc 100644 --- a/frontend/src/lib/types/profiles.d.ts +++ b/frontend/src/lib/types/profiles.d.ts @@ -11,6 +11,7 @@ export type Profile = { description: string; githubLogin?: string; twitterHandle?: string; + linkedinAccount?: string; attestationCount: number; attestations: ProfileAttestation[]; }; @@ -22,6 +23,7 @@ export type ProfileFromAPI = { avatar_url?: string; github_login?: string; twitter_handle?: string; + linkedin_account?: string; created_at?: string; updated_at?: string; }; \ No newline at end of file