Skip to content

Commit

Permalink
fix: ui username & pubkey
Browse files Browse the repository at this point in the history
  • Loading branch information
ugur-eren committed Jul 15, 2024
1 parent de5b85a commit 80265e7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
18 changes: 14 additions & 4 deletions JoyboyCommunity/src/modules/Post/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {useProfile, useReact, useReactions, useReplyNotes, useStyles, useTheme}
import {useTipModal} from '../../hooks/modals';
import {useAuth} from '../../store/auth';
import {MainStackNavigationProps} from '../../types';
import {shortenPubkey} from '../../utils/helpers';
import {getElapsedTimeStringFull} from '../../utils/timestamp';
import stylesheet from './styles';

Expand Down Expand Up @@ -123,14 +124,23 @@ export const Post: React.FC<PostProps> = ({asComment, event}) => {
numberOfLines={1}
ellipsizeMode="middle"
>
{profile?.displayName ?? profile?.name ?? event?.pubkey}
{profile?.displayName ??
profile?.name ??
profile?.nip05 ??
shortenPubkey(event?.pubkey)}
</Text>

<View style={styles.infoDetails}>
{profile?.nip05 && (
{(profile?.nip05 || profile?.name) && (
<>
<Text color="textLight" fontSize={11} lineHeight={16}>
@{profile?.nip05}
<Text
color="textLight"
fontSize={11}
lineHeight={16}
numberOfLines={1}
ellipsizeMode="tail"
>
@{profile?.nip05 ?? profile.name}
</Text>

<View style={styles.infoDetailsDivider} />
Expand Down
3 changes: 3 additions & 0 deletions JoyboyCommunity/src/utils/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,6 @@ export const getArgentAppStoreURL = () => {
};

export const decimalsScale = (decimals: number) => `1${Array(decimals).fill('0').join('')}`;

export const shortenPubkey = (pubkey?: string, length = 6) =>
pubkey ? `${pubkey.slice(0, length)}...${pubkey.slice(-length)}` : undefined;

0 comments on commit 80265e7

Please sign in to comment.