From 5a381a5dc3f780e97281c08b091bbeda6b11c9cb Mon Sep 17 00:00:00 2001 From: MartinBraquet Date: Thu, 31 Jul 2025 15:05:44 +0200 Subject: [PATCH] Fix alignment --- lib/client/profile.tsx | 513 ++++++++++++++++++++--------------------- 1 file changed, 255 insertions(+), 258 deletions(-) diff --git a/lib/client/profile.tsx b/lib/client/profile.tsx index 57337343..bcd66b0b 100644 --- a/lib/client/profile.tsx +++ b/lib/client/profile.tsx @@ -48,270 +48,267 @@ export function getProfile(url, header = null) { return (
{header} - {/* Profile Header with Image */} - < div - className="bg-gradient-to-r h-32 relative"> - { - image ? ( -
-
- {userData.name { - // const target = e.target as HTMLImageElement; - // target.onerror = null; - // target.src = `https://ui-avatars.com/api/?name=${encodeURIComponent(profile.name || 'U')}&background=random`; - // }} - /> -
+
+
+

+ {userData.name} +

+ + < div + className="space-y-6 pt-4 border-t border-gray-200"> + + {userData?.profile?.desiredConnections && ( +
< + h2 className="text-sm font-medium text-gray-500 uppercase tracking-wider"> Desired + Connections + + < ul + className="flex flex-wrap gap-2 mt-1"> + {userData?.profile?.desiredConnections.map((value, idx) => ( +
  • + {value?.connection?.name + } +
  • + )) + } +
    - ) : - ( -
    + ) + } + + { + userData?.profile?.gender && ( +
    +

    Gender

    + < p + className="mt-1 capitalize"> {userData.profile.gender}

    +
    + ) + } + + { + userData?.profile?.birthYear && ( +
    +

    Age

    + < p + className="mt-1 capitalize"> {new Date().getFullYear() - userData.profile.birthYear}

    +
    + ) + } + + { + userData?.profile?.location && ( +
    +

    Location

    + < p + className={pStyle}> {userData.profile.location}

    +
    + ) + } + + { + userData?.profile?.occupation && ( +
    +

    Occupation

    + < p + className={pStyle}> {userData.profile.occupation}

    +
    + ) + } + + { + userData?.profile?.personalityType && ( +
    +

    Personality + Type

    + < p + className={pStyle}> {userData.profile.personalityType}

    +
    + ) + } + + { + userData?.profile?.conflictStyle && ( +
    +

    Conflict + Style

    + < p + className={pStyle}> {userData.profile.conflictStyle}

    +
    + ) + } + + { + userData?.profile?.intellectualInterests && ( +
    < + h2 className="text-sm font-medium text-gray-500 uppercase tracking-wider"> Interests + + < ul + className="flex flex-wrap gap-2 mt-1"> + { + userData.profile.intellectualInterests.map((value, idx) => ( +
  • + {value?.interest?.name + } +
  • + )) + } + +
    + ) + } + + { + userData?.profile?.causeAreas && ( +
    < + h2 className="text-sm font-medium text-gray-500 uppercase tracking-wider"> Cause + Areas + + < ul + className="flex flex-wrap gap-2 mt-1"> + { + userData.profile.causeAreas.map((value, idx) => ( +
  • + {value?.causeArea?.name + } +
  • + )) + } + +
    + ) + } + + { + userData?.profile?.description && ( +
    +

    About

    + < p + className={pStyle}> {userData.profile.description}

    +
    + ) + } + + { + userData?.profile?.contactInfo && ( +
    +

    Contact

    + < p + className={pStyle}> {userData.profile.contactInfo}

    +
    + ) + } + + { + userData?.profile?.promptAnswers && ( +
    < + h2 className="text-sm font-medium text-gray-500 uppercase tracking-wider"> Prompt + Answers + + < ul + className="flex flex-wrap gap-2 mt-1"> + { + userData.profile.promptAnswers.map((value, idx) => ( +
  • + • {value.prompt} {value.answer} +
  • + )) + } + +
    + ) + } + + { + images && +
    + {/*

    Photos

    */} +
    + {Array.from(new Set(images)).map((img, index) => ( // Set is a hack to avoid a bug where duplicates fill in images when we navigate different pages +
    + {`Uploaded +
    + ))} +
    +
    + } + + {/*
    */ + } + {/*

    Creation Date

    */ + } + {/*

    */ + } + {/* {user.profile.createdAt}*/ + } + {/* {new Date(user.profile.createdAt).toLocaleDateString("en-US", {*/ + } + {/* year: "numeric",*/ + } + {/* month: "long",*/ + } + {/* day: "numeric",*/ + } + {/* })}*/ + } + {/*

    */ + } + {/*
    */ + } + + +
    + +
    +
    + { + image ? ( +
    +
    + {userData.name { + // const target = e.target as HTMLImageElement; + // target.onerror = null; + // target.src = `https://ui-avatars.com/api/?name=${encodeURIComponent(profile.name || 'U')}&background=random`; + // }} + /> +
    +
    + ) : + ( +
    {userData.name ? userData.name.charAt(0).toUpperCase() : 'U'} -
    - ) - } -
    - - {/* Profile Content */ - } -
    -

    - {userData.name} -

    - - < div - className="space-y-6 pt-4 border-t border-gray-200"> - - {userData?.profile?.desiredConnections && ( -
    < - h2 className="text-sm font-medium text-gray-500 uppercase tracking-wider"> Desired - Connections - - < ul - className="flex flex-wrap gap-2 mt-1"> - {userData?.profile?.desiredConnections.map((value, idx) => ( -
  • - {value?.connection?.name - } -
  • - )) - } - -
    - ) +
    + ) } - - { - userData?.profile?.gender && ( -
    -

    Gender

    - < p - className="mt-1 capitalize"> {userData.profile.gender}

    -
    - ) - } - - { - userData?.profile?.birthYear && ( -
    -

    Age

    - < p - className="mt-1 capitalize"> {new Date().getFullYear() - userData.profile.birthYear}

    -
    - ) - } - - { - userData?.profile?.location && ( -
    -

    Location

    - < p - className={pStyle}> {userData.profile.location}

    -
    - ) - } - - { - userData?.profile?.occupation && ( -
    -

    Occupation

    - < p - className={pStyle}> {userData.profile.occupation}

    -
    - ) - } - - { - userData?.profile?.personalityType && ( -
    -

    Personality - Type

    - < p - className={pStyle}> {userData.profile.personalityType}

    -
    - ) - } - - { - userData?.profile?.conflictStyle && ( -
    -

    Conflict - Style

    - < p - className={pStyle}> {userData.profile.conflictStyle}

    -
    - ) - } - - { - userData?.profile?.intellectualInterests && ( -
    < - h2 className="text-sm font-medium text-gray-500 uppercase tracking-wider"> Interests - - < ul - className="flex flex-wrap gap-2 mt-1"> - { - userData.profile.intellectualInterests.map((value, idx) => ( -
  • - {value?.interest?.name - } -
  • - )) - } - -
    - ) - } - - { - userData?.profile?.causeAreas && ( -
    < - h2 className="text-sm font-medium text-gray-500 uppercase tracking-wider"> Cause - Areas - - < ul - className="flex flex-wrap gap-2 mt-1"> - { - userData.profile.causeAreas.map((value, idx) => ( -
  • - {value?.causeArea?.name - } -
  • - )) - } - -
    - ) - } - - { - userData?.profile?.description && ( -
    -

    About

    - < p - className={pStyle}> {userData.profile.description}

    -
    - ) - } - - { - userData?.profile?.contactInfo && ( -
    -

    Contact

    - < p - className={pStyle}> {userData.profile.contactInfo}

    -
    - ) - } - - { - userData?.profile?.promptAnswers && ( -
    < - h2 className="text-sm font-medium text-gray-500 uppercase tracking-wider"> Prompt - Answers - - < ul - className="flex flex-wrap gap-2 mt-1"> - { - userData.profile.promptAnswers.map((value, idx) => ( -
  • - • {value.prompt} {value.answer} -
  • - )) - } - -
    - ) - } - - { - images && -
    - {/*

    Photos

    */} -
    - {Array.from(new Set(images)).map((img, index) => ( // Set is a hack to avoid a bug where duplicates fill in images when we navigate different pages -
    - {`Uploaded -
    - ))} -
    -
    - } - - {/*
    */ - } - {/*

    Creation Date

    */ - } - {/*

    */ - } - {/* {user.profile.createdAt}*/ - } - {/* {new Date(user.profile.createdAt).toLocaleDateString("en-US", {*/ - } - {/* year: "numeric",*/ - } - {/* month: "long",*/ - } - {/* day: "numeric",*/ - } - {/* })}*/ - } - {/*

    */ - } - {/*
    */ - } - -
    -