Skip to content

Commit d200513

Browse files
committed
chore: Public Profile styling & schema changes
1 parent 71d0c20 commit d200513

File tree

5 files changed

+24
-15
lines changed

5 files changed

+24
-15
lines changed

src/components/account/profile/EditPublicProfile.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,12 @@ import { buildPublicProfileSchema } from '@schemas/profile';
55
import InputWithLabel from '@shared/InputWithLabel';
66
import Label from '@shared/Label';
77
import StyledInput from '@shared/StyledInput';
8-
import { PublicProfileInfo } from '@typedefs/general';
8+
import { BRANDING_PLATFORM_NAMES, PublicProfileInfo } from '@typedefs/general';
99
import { useMemo, useState } from 'react';
1010
import { Controller, FormProvider, useForm } from 'react-hook-form';
1111
import toast from 'react-hot-toast';
1212
import z from 'zod';
1313

14-
const PLATFORM_NAMES = {
15-
Linkedin: 'LinkedIn',
16-
};
17-
1814
export default function EditPublicProfile({
1915
profileInfo,
2016
brandingPlatforms,
@@ -99,7 +95,7 @@ export default function EditPublicProfile({
9995
render={({ field, fieldState }) => {
10096
return (
10197
<StyledInput
102-
placeholder={PLATFORM_NAMES[platform] ?? platform}
98+
placeholder={BRANDING_PLATFORM_NAMES[platform] ?? platform}
10399
value={field.value ?? ''}
104100
onChange={(e) => {
105101
const value = e.target.value;

src/components/account/profile/PublicProfile.tsx

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { DetailsCard } from '@shared/cards/DetailsCard';
66
import ProfileRow from '@shared/ProfileRow';
77
import { useQuery } from '@tanstack/react-query';
88
import { EthAddress } from '@typedefs/blockchain';
9-
import { PublicProfileInfo } from '@typedefs/general';
9+
import { BRANDING_PLATFORM_NAMES, PublicProfileInfo } from '@typedefs/general';
1010
import clsx from 'clsx';
1111
import { useEffect, useMemo, useState } from 'react';
1212
import toast from 'react-hot-toast';
@@ -119,20 +119,20 @@ export default function PublicProfile() {
119119
<div className="center-all">
120120
<div className="center-all h-[84px] w-[84px]">
121121
{!address ? (
122-
<Skeleton className="h-full w-full rounded-full" />
122+
<Skeleton className="h-full w-full rounded-[37.5%]" />
123123
) : imageError ? (
124124
// Placeholder user icon when no image exists
125-
<div className="center-all h-full w-full rounded-full bg-slate-200 text-6xl text-white">
125+
<div className="center-all h-full w-full rounded-[37.5%] bg-slate-200 text-6xl text-white">
126126
<HiUser />
127127
</div>
128128
) : (
129-
<div className="center-all relative h-full w-full overflow-hidden rounded-full">
130-
<Skeleton className="absolute h-full w-full rounded-full" />
129+
<div className="center-all relative h-full w-full overflow-hidden rounded-[37.5%]">
130+
<Skeleton className="absolute h-full w-full rounded-[37.5%]" />
131131

132132
<img
133133
src={profileImageUrl}
134134
alt="Profile"
135-
className={clsx('z-10 h-full w-full rounded-full object-cover object-center', {
135+
className={clsx('z-10 h-full w-full rounded-[37.5%] object-cover object-center', {
136136
'opacity-0': isImageLoading,
137137
})}
138138
onLoad={() => setImageLoading(false)}
@@ -233,7 +233,13 @@ export default function PublicProfile() {
233233
<div className="text-slate-500"></div>
234234
);
235235

236-
return <ProfileRow key={platform} label={platform} value={displayValue} />;
236+
return (
237+
<ProfileRow
238+
key={platform}
239+
label={BRANDING_PLATFORM_NAMES[platform] ?? platform}
240+
value={displayValue}
241+
/>
242+
);
237243
})}
238244
</div>
239245
</DetailsCard>

src/schemas/profile.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export const buildPublicProfileSchema = (brandingPlatforms: string[]) => {
1010

1111
return z.object({
1212
name: getStringSchema(3, 32),
13-
description: getOptionalStringWithSpacesSchema(0, 512),
13+
description: getOptionalStringWithSpacesSchema(0, 80),
1414
links: z.object(shape),
1515
});
1616
};

src/shared/ProfileRow.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ export default function ProfileRow({ label, value }: { label: string; value: Rea
22
return (
33
<div className="compact flex flex-col gap-0.5 sm:h-6 sm:flex-row sm:items-center sm:justify-between sm:gap-2">
44
<div className="text-slate-500">{label}</div>
5-
<div>{value}</div>
5+
6+
<div className="max-w-[360px]">
7+
<div className="overflow-hidden text-ellipsis whitespace-nowrap">{value}</div>
8+
</div>
69
</div>
710
);
811
}

src/typedefs/general.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
import { EthAddress } from './blockchain';
22

3+
export const BRANDING_PLATFORM_NAMES = {
4+
Linkedin: 'LinkedIn',
5+
};
6+
37
type BillingInfo = {
48
companyName: string;
59
billingEmail: string;

0 commit comments

Comments
 (0)