|
| 1 | +<script lang="ts" setup> |
| 2 | +import type { UserProfile } from '~~/shared/types/user'; |
| 3 | +import { formatMonthYear } from '~/utils/date'; |
| 4 | +const props = defineProps<{ |
| 5 | + userProfile: UserProfile; |
| 6 | +}>(); |
| 7 | +const displayUrl = computed(() => { |
| 8 | + if (props.userProfile.websiteUrl) { |
| 9 | + const cleanedUrl = cleanUrl(props.userProfile.websiteUrl); |
| 10 | + return cleanedUrl.length > 30 ? cleanedUrl.slice(0, 29) + '...' : cleanedUrl; |
| 11 | + } |
| 12 | + return ''; |
| 13 | +}); |
| 14 | +</script> |
| 15 | +<template> |
| 16 | + <div class="mt-2 flex flex-col"> |
| 17 | + <div class="px-4"> |
| 18 | + <h2 class="text-foreground text-2xl font-bold">{{ userProfile.displayName }}</h2> |
| 19 | + <p class="text-muted-foreground">{{ userProfile.username }}</p> |
| 20 | + <p class="mt-2">{{ userProfile.bio }}</p> |
| 21 | + <div class="mt-2 flex flex-wrap"> |
| 22 | + <a |
| 23 | + :href="userProfile.websiteUrl" |
| 24 | + target="_blank" |
| 25 | + rel="noopener noreferrer" |
| 26 | + class="text-brand-blue me-2 flex items-center gap-1 hover:underline" |
| 27 | + > |
| 28 | + <Icon class="text-muted-foreground" name="ic:sharp-link" size="18" /> |
| 29 | + {{ displayUrl }} |
| 30 | + </a> |
| 31 | + |
| 32 | + <p class="text-muted-foreground flex items-center gap-1"> |
| 33 | + <Icon name="ic:sharp-calendar-month" /> |
| 34 | + {{ $t('profile-info.joined') }} |
| 35 | + {{ formatMonthYear(userProfile.joinedAt) }} |
| 36 | + </p> |
| 37 | + </div> |
| 38 | + <div class="mt-4 flex space-x-4"> |
| 39 | + <span |
| 40 | + ><strong>{{ userProfile.followingCount }}</strong> |
| 41 | + <span class="text-muted-foreground ms-1"> {{ $t('profile-info.following') }} </span> |
| 42 | + </span> |
| 43 | + <span |
| 44 | + ><strong>{{ userProfile.followersCount }}</strong> |
| 45 | + <span class="text-muted-foreground ms-1"> {{ $t('profile-info.followers') }} </span> |
| 46 | + </span> |
| 47 | + </div> |
| 48 | + </div> |
| 49 | + </div> |
| 50 | +</template> |
0 commit comments