Skip to content

Commit

Permalink
base
Browse files Browse the repository at this point in the history
  • Loading branch information
Rohan-cp committed May 15, 2024
1 parent 6361260 commit 16a3ee6
Show file tree
Hide file tree
Showing 11 changed files with 13 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { TokensAddedToCollectionFeedEventQueryFragment$key } from '~/generated/T
import { MainTabStackNavigatorProp } from '~/navigation/types';
import { contexts } from '~/shared/analytics/constants';
import { removeNullValues } from '~/shared/relay/removeNullValues';
import unescape from '~/shared/utils/unescape';

import { Typography } from '../../Typography';
import { EventTokenGrid } from '../EventTokenGrid';
Expand Down Expand Up @@ -76,7 +75,7 @@ export function TokensAddedToCollectionFeedEvent({
);
}, [eventData.collection?.tokens, eventData.isPreFeed, eventData.newTokens]);

const collectionName = unescape(eventData.collection?.name ?? '');
const collectionName = eventData.collection?.name ?? '';

return (
<View className="flex flex-1 flex-col">
Expand Down
3 changes: 1 addition & 2 deletions apps/mobile/src/components/Feed/FeedListSectionHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { FeedListSectionHeaderFragment$key } from '~/generated/FeedListSectionHe
import { MainTabStackNavigatorProp } from '~/navigation/types';
import { contexts } from '~/shared/analytics/constants';
import { getTimeSince } from '~/shared/utils/time';
import unescape from '~/shared/utils/unescape';

import { GalleryTouchableOpacity } from '../GalleryTouchableOpacity';
import { Typography } from '../Typography';
Expand Down Expand Up @@ -62,7 +61,7 @@ export function FeedListSectionHeader({ feedEventRef }: FeedListSectionHeaderPro
return null;
}

const galleryName = unescape(feedEvent.eventData.gallery?.name || '');
const galleryName = feedEvent.eventData.gallery?.name || '';

return (
<View className="flex flex-row items-center justify-between bg-white dark:bg-black-900 px-3 pb-2">
Expand Down
3 changes: 1 addition & 2 deletions apps/mobile/src/components/Gallery/GalleryVirtualizedRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { Typography } from '~/components/Typography';
import { GalleryVirtualizedRowQueryFragment$key } from '~/generated/GalleryVirtualizedRowQueryFragment.graphql';
import { MainTabStackNavigatorProp } from '~/navigation/types';
import { contexts } from '~/shared/analytics/constants';
import unescape from '~/shared/utils/unescape';

import { GalleryTouchableOpacity } from '../GalleryTouchableOpacity';

Expand Down Expand Up @@ -68,7 +67,7 @@ export function GalleryVirtualizedRow({ queryRef, item, isOnCollectionScreen }:
properties={{ variant: 'collection title' }}
>
<Typography className="text-sm" font={{ family: 'ABCDiatype', weight: 'Bold' }}>
{unescape(item.name || 'Untitled')}
{item.name || 'Untitled'}
</Typography>
</GalleryTouchableOpacity>
</View>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import { GalleryPreviewCardQueryFragment$key } from '~/generated/GalleryPreviewC
import { MainTabStackNavigatorProp, RootStackNavigatorProp } from '~/navigation/types';
import { contexts } from '~/shared/analytics/constants';
import { ReportingErrorBoundary } from '~/shared/errors/ReportingErrorBoundary';
import unescape from '~/shared/utils/unescape';

import { BottomSheetRow } from '../BottomSheetRow';
import { GalleryTouchableOpacity } from '../GalleryTouchableOpacity';
Expand Down Expand Up @@ -85,7 +84,7 @@ export function GalleryPreviewCard({ galleryRef, isFeatured, queryRef }: Gallery
<View className="flex flex-row items-center justify-center">
<View className="flex flex-1 flex-col">
<Typography className="text-sm" font={{ family: 'ABCDiatype', weight: 'Bold' }}>
{gallery.name ? unescape(gallery.name) : 'Untitled'}
{gallery.name ?? 'Untitled'}
</Typography>
{descriptionFirstLine && (
<Typography
Expand Down
5 changes: 1 addition & 4 deletions apps/web/src/components/HoverCard/CommunityHoverCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,7 @@ function CommunityHoverCardContent({
{community.description && (
<StyledCardDescription>
<BaseM>
<Markdown
text={unescape(community.description)}
eventContext={contexts['Hover Card']}
/>
<Markdown text={community.description} eventContext={contexts['Hover Card']} />
</BaseM>
</StyledCardDescription>
)}
Expand Down
3 changes: 1 addition & 2 deletions apps/web/src/components/HoverCard/UserHoverCard.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import unescape from 'lodash/unescape';
import { Route } from 'nextjs-routes';
import { PropsWithChildren, useCallback, useMemo } from 'react';
import {
Expand Down Expand Up @@ -190,7 +189,7 @@ function UserHoverCardContent({
{user.bio && (
<StyledCardDescription>
<BaseM>
<Markdown text={unescape(user.bio)} eventContext={contexts['Hover Card']} />
<Markdown text={user.bio} eventContext={contexts['Hover Card']} />
</BaseM>
</StyledCardDescription>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { ProfilePicture } from '~/components/ProfilePicture/ProfilePicture';
import { SomeoneAdmiredYourCommentFragment$key } from '~/generated/SomeoneAdmiredYourCommentFragment.graphql';
import { AdmireIcon } from '~/icons/SocializeIcons';
import { ErrorWithSentryMetadata } from '~/shared/errors/ErrorWithSentryMetadata';
import unescape from '~/shared/utils/unescape';

import { NotificationPostPreviewWithBoundary } from './NotificationPostPreview';
import { StyledAdmireIconWrapper } from './SomeoneAdmiredYourToken';
Expand Down Expand Up @@ -95,7 +94,7 @@ export default function SomeoneAdmiredYourComment({ notificationRef, onClose }:
<strong>comment</strong>
</BaseM>
</StyledTextWrapper>
<StyledCaption>{unescape(comment?.comment ?? '')}</StyledCaption>
<StyledCaption>{comment?.comment ?? ''}</StyledCaption>
</VStack>
</VStack>
</HStack>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export function SomeoneRepliedToYourComment({ notificationRef, queryRef, onClose
<TimeAgoText as="span">{timeAgo}</TimeAgoText>
</StyledTextWrapper>
<VStack gap={4}>
<StyledCaption>{unescape(comment.comment)}</StyledCaption>
<StyledCaption>{comment.comment}</StyledCaption>

<HStack gap={4}>
<AdmireIcon
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import { CollectionNavbarFragment$key } from '~/generated/CollectionNavbarFragme
import { useIsMobileOrMobileLargeWindowWidth } from '~/hooks/useWindowSize';
import { contexts } from '~/shared/analytics/constants';
import colors from '~/shared/theme/colors';
import unescape from '~/shared/utils/unescape';

import {
NavbarCenterContent,
Expand Down Expand Up @@ -75,7 +74,7 @@ export function CollectionNavbar({ queryRef, username, collectionId }: Collectio

const unescapedCollectionName = useMemo(() => {
if (query.collectionById?.__typename === 'Collection') {
return unescape(query.collectionById?.name ?? '') || 'untitled';
return query.collectionById?.name || 'untitled';
}

return 'untitled';
Expand Down
15 changes: 4 additions & 11 deletions apps/web/src/scenes/NftDetailPage/NftDetailText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,15 +144,15 @@ function NftDetailText({ queryRef, tokenRef, authenticatedUserOwnsAsset, toggleL
}

track('Admire Token Click');
admireToken(token.id, token.dbid, info, decodedTokenName);
admireToken(token.id, token.dbid, info, name);
}, [
query.viewer?.__typename,
track,
admireToken,
token.id,
token.dbid,
info,
decodedTokenName,
name,
showAuthModal,
]);

Expand All @@ -169,16 +169,9 @@ function NftDetailText({ queryRef, tokenRef, authenticatedUserOwnsAsset, toggleL
token.dbid,
token.viewerAdmire.dbid,
query.viewer?.user?.dbid,
decodedTokenName
name
);
}, [
decodedTokenName,
query.viewer,
removeTokenAdmire,
token.dbid,
token.id,
token.viewerAdmire?.dbid,
]);
}, [name, query.viewer, removeTokenAdmire, token.dbid, token.id, token.viewerAdmire?.dbid]);

const isMobile = useIsMobileWindowWidth();

Expand Down
9 changes: 0 additions & 9 deletions packages/shared/src/utils/unescape.ts
Original file line number Diff line number Diff line change
@@ -1,9 +0,0 @@
import unescapeFn from 'lodash.unescape';

/** Fixes bug where lodash.unescape does not unescape double quotes in our code base */
export default function unescape(_s: string) {
const s = _s.trim();
// Check to see if string includes the double quote character; if string does not have it, this is slightly faster
// https://perf.link/#eyJpZCI6ImdubDgwbmp6cWduIiwidGl0bGUiOiJGaW5kaW5nIG51bWJlcnMgaW4gYW4gYXJyYXkgb2YgMTAwMCIsImJlZm9yZSI6ImNvbnN0IHN0ci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wMDAwLDE2NDYwMDAsMTQ3NTAwMCwxMDAwMCw5MDAwLDUwOTMwMDAsOTM0NjAwMCwzNzM1MDAwLDQ0NDcwMDAsMTI3ODAwMCw2MDI5MDAwLDE4MjgwMDAsMjI3MDAwMCw0MDI5MDAwLDM5ODcwMDAsNjEwMTAwMCwzMjU5MDAwLDU3NzYwMDAsOTAwMCwxMDkwMDAsMTAzNzAwMCw5MDAwLDU2NzcwMDAsMjA0NzAwMCw0MTIwMDAwXSwib3BzIjozNzg4NzYwfV0sInVwZGF0ZWQiOiIyMDIyLTAzLTIyVDAwOjMzOjQ0Ljk1N1oifQ%3D%3D
return s.includes('&#34;') ? unescapeFn(s).split('&#34;').join('"') : unescapeFn(s); // If string is undefined (e.g. empty) this will just return ""
}

0 comments on commit 16a3ee6

Please sign in to comment.