From 850db40d5e439ca3ec996d63c9f70596e99394d1 Mon Sep 17 00:00:00 2001 From: martines3000 Date: Fri, 7 Jun 2024 11:16:35 +0200 Subject: [PATCH] feat: address identicons, deployment url handling --- packages/dapp/.env.example | 4 + packages/dapp/package.json | 1 + packages/dapp/public/endorse.png | Bin 0 -> 9190 bytes packages/dapp/src/app/api/og/route.tsx | 27 +++---- packages/dapp/src/app/layout.tsx | 10 +-- packages/dapp/src/app/opengraph-image.tsx | 12 +-- .../src/app/profile/[slug]/ShareDialog.tsx | 4 +- .../dapp/src/app/profile/[slug]/UserBadge.tsx | 3 +- packages/dapp/src/app/profile/[slug]/page.tsx | 28 ++++--- packages/dapp/src/app/profile/page.tsx | 2 +- .../dapp/src/components/Address/index.tsx | 31 +------- .../dapp/src/components/CopyIcon/index.tsx | 36 +++++++++ .../src/components/EndorseForm/FeeDisplay.tsx | 2 +- .../src/components/Endorsee/EndorseeBadge.tsx | 69 +----------------- .../src/components/ProfileAvatar/index.tsx | 32 ++------ packages/dapp/src/utils/appUrl.ts | 7 ++ packages/dapp/src/utils/index.ts | 2 + pnpm-lock.yaml | 9 +++ 18 files changed, 116 insertions(+), 163 deletions(-) create mode 100644 packages/dapp/public/endorse.png create mode 100644 packages/dapp/src/components/CopyIcon/index.tsx create mode 100644 packages/dapp/src/utils/appUrl.ts diff --git a/packages/dapp/.env.example b/packages/dapp/.env.example index 281623c..0aa4dc5 100644 --- a/packages/dapp/.env.example +++ b/packages/dapp/.env.example @@ -18,3 +18,7 @@ NEXT_PUBLIC_SEPOLIA_ENDPOINT= # Airstack AIRSTACK_API_URL= AIRSTACK_API_KEY= + +# Next.js Vercel +# Should be only set for local development, on Vercel it will be set automatically +NEXT_PUBLIC_VERCEL_PROJECT_PRODUCTION_URL= diff --git a/packages/dapp/package.json b/packages/dapp/package.json index 1ecdd65..88c490b 100644 --- a/packages/dapp/package.json +++ b/packages/dapp/package.json @@ -30,6 +30,7 @@ "@vercel/analytics": "^1.3.1", "@vercel/speed-insights": "^1.0.11", "@wagmi/core": "^2.10.5", + "blo": "^1.2.0", "class-variance-authority": "^0.7.0", "clsx": "^2.1.1", "cmdk": "^1.0.0", diff --git a/packages/dapp/public/endorse.png b/packages/dapp/public/endorse.png new file mode 100644 index 0000000000000000000000000000000000000000..e0648d7af698134e3ef60bf03787582756856784 GIT binary patch literal 9190 zcmXw9byQT{*B-h%h7yKGx=Uh)hM_?kq(nfa8>GR3p+OoXMLJ%jQ@TTt?viFeN#lXrJ!kKI&e`!iJ4#zqnE;mt7XSbdsH!OF0syFd$ahz4Oyu*~g!};jz+9=S z0MYl!KFS$$qBU$do#RYWE7bbzv6GI9>YGaErF^Zk}DQ3 zRoxx{d-9aVtzO5Ahn;g4{ybyz&Ieum()6c?s|=A=RFOj*zCPtVYkv;Al|z>a+&ip` zS3qp6MV2I;78s%aX9HR84q_jXX|`<2Gg*B<GQjq z>v?1J)6AHm?T<~D=j+rc+&K>v#^^Opfl_yhYVU0}H_Pl3=O^9v)`R|vQC8sh@T-53 zpy2DD8xwSF{s3qquNY#od)H)9?~(86bCS}<0+sPEZN&^c1 z4t$PE-MGl&R-=xzN>2pvJ+8Z*Ijs?q&fNNVDj~Q`BwZ4Cd-(B%bj?Wkk|LZ5uY%Vz zn_zD{f)&-hu-Qx`>z8q{_63nL6^47Q5Dj@6w*6q20foOFCrL)(-F8GgHw*r0+{FJh zp#NJgkcy^li2?bIA5DvxAT-S5Y1OH1lL@$jx`Y-0R0Du?iOkeXZ|#&%$Ti08$CL9s z?#W(*3)|Pf_vvMXL_9~z(qkLakqeAM)HR1E_<#9(8PF!_mLkow2U-lBa9)kCH%Bgp zpG=I_hlh^8dQ1dQpTr-VB?S;pzowcTiL@X-4PXP5!HUAb&k|^`C+*)>?lrvr6Mbhx z#pW9so#wQ=VkexoMJEuVBLNXk*Ff$f5%UfGtKazOjMQLlr7n&WMp0N7YV13fc}dB6 zyIScl%N#sTOzUBRLGd{}7oPNJ_{kcP(MSQux@}mDVvh;}+Wf?);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ef1iJIuULZ-z5Q}D! zrMpuO_D-F>fKDV#HlV{FzBL~4Mv!q!q|#OV=cZ!a*;qF{F}|li1}Ps;6U! z4Rwt_y&JRE!mBqM-=EmbeSxcg*lf5?&IUXD5csblq9vx?2f^VJ%6u8G~jqLJ>9Bx}8P1L`%{YP-pkuh6<%+8Q0!&57R zx>7m^Vwzx;z^L_qEecd@Q1z6j`CpbiV4ae>{^J-Uhlt78pQ@$UV3~N$WQ@;2RB!rT zK2fq(sDiGWis!QfLbU58)*MNv-{YQi>0#+nh(-b;-meF%XEx#)*erzOpGK#5t5-Zx z;=5giKmJEi@@Lpu_u+ZOX;zytv_Z4~N3;qKE5L!s?iF)_RaQLu729gOf4vYXQI!7( z(`Mo}XictT*pohy)Pucnr2CpOK6A?XpM~&+Nbj$M-kx+n{xOv}_IffTzEJujvWw^O Zk!q+k!$LbB71_T7P*v1asFJe`{XaNyS=ayo literal 0 HcmV?d00001 diff --git a/packages/dapp/src/app/api/og/route.tsx b/packages/dapp/src/app/api/og/route.tsx index 547f62a..5f40dc6 100644 --- a/packages/dapp/src/app/api/og/route.tsx +++ b/packages/dapp/src/app/api/og/route.tsx @@ -7,6 +7,8 @@ import { } from '@/utils'; import { ImageResponse } from 'next/og'; import type { NextRequest } from 'next/server'; +import { blo } from 'blo'; +import { APP_URL } from '@/utils'; export const runtime = 'edge'; @@ -25,7 +27,6 @@ export async function GET(req: NextRequest) { const _platform = validateOrGetDefaultPlatform(platform); - // FIXME: Add description const { address, avatar, description, displayName, error } = _platform === PlatformType.ethereum ? await getMinimalProfileFromAddress(account as `0x${string}`) @@ -54,18 +55,12 @@ export async function GET(req: NextRequest) {
- {avatar ? ( - Profile avatar - ) : ( -
- {/* TODO */}A -
- )} + Profile avatar

{description}

}{' '}
- EES Logo + EES Logo
diff --git a/packages/dapp/src/app/layout.tsx b/packages/dapp/src/app/layout.tsx index 6d30841..5bb3749 100644 --- a/packages/dapp/src/app/layout.tsx +++ b/packages/dapp/src/app/layout.tsx @@ -16,23 +16,23 @@ const inter = Inter({ subsets: ['latin'] }); export const metadata: Metadata = { metadataBase: new URL('https://ees-eosin.vercel.app'), title: 'Endorse - Ethereum Endorsement Service', - description: '', // FIXME: Add description + description: 'The next generation Web3 social layer.', robots: { // FIXME: Update for production release index: false, follow: false, }, openGraph: { - description: 'TODO', // FIXME: Add description + description: 'The next generation Web3 social layer.', siteName: 'Endorse.fun', - title: 'Endorse - Ethereum Endorsement Service', // FIXME: Add description + title: 'Endorse - Ethereum Endorsement Service', type: 'article', url: '/', }, twitter: { card: 'summary_large_image', - title: 'Endorse - Ethereum Endorsement Service', // FIXME: Add description - description: 'TODO', // FIXME: Add description + title: 'Endorse - Ethereum Endorsement Service', + description: 'The next generation Web3 social layer.', }, }; diff --git a/packages/dapp/src/app/opengraph-image.tsx b/packages/dapp/src/app/opengraph-image.tsx index 2ca6196..4a74734 100644 --- a/packages/dapp/src/app/opengraph-image.tsx +++ b/packages/dapp/src/app/opengraph-image.tsx @@ -1,6 +1,7 @@ +import { APP_URL } from '@/utils'; import { ImageResponse } from 'next/og'; -export const runtime = 'nodejs'; // TODO: Test both nodejs and edge +export const runtime = 'nodejs'; export const alt = 'Check out my profile on Endorse.fun!'; export const size = { width: 1200, @@ -44,11 +45,12 @@ export default async function Image() {
- EES Logo + src={`${APP_URL}/endorse.png`} + /> */}
diff --git a/packages/dapp/src/app/profile/[slug]/ShareDialog.tsx b/packages/dapp/src/app/profile/[slug]/ShareDialog.tsx index abd0f28..c70d952 100644 --- a/packages/dapp/src/app/profile/[slug]/ShareDialog.tsx +++ b/packages/dapp/src/app/profile/[slug]/ShareDialog.tsx @@ -19,12 +19,14 @@ import { MemoizedImage } from '@/components/MemoizedImage'; type ShareDialogProps = { avatar: string | null; + address: `0x${string}`; shareLink: string; displayName: string; }; export function ShareDialog({ avatar, + address, shareLink, displayName, }: ShareDialogProps) { @@ -49,7 +51,7 @@ export function ShareDialog({ - +
{displayName}
diff --git a/packages/dapp/src/app/profile/[slug]/UserBadge.tsx b/packages/dapp/src/app/profile/[slug]/UserBadge.tsx index 6fde70f..7341f49 100644 --- a/packages/dapp/src/app/profile/[slug]/UserBadge.tsx +++ b/packages/dapp/src/app/profile/[slug]/UserBadge.tsx @@ -1,6 +1,5 @@ import { Card } from '@/components/ui/card'; import { ProfileAvatar } from '@/components/ProfileAvatar'; - import { getMinimalProfileFromAddress } from '@/lib/airstack/getMinimalProfileFromAddress'; import { formatAddress } from '@/utils'; import { Skeleton } from '@/components/ui/skeleton'; @@ -29,7 +28,7 @@ export const UserBadge = async ({
- +
diff --git a/packages/dapp/src/app/profile/[slug]/page.tsx b/packages/dapp/src/app/profile/[slug]/page.tsx index ebaba4e..b2a818f 100644 --- a/packages/dapp/src/app/profile/[slug]/page.tsx +++ b/packages/dapp/src/app/profile/[slug]/page.tsx @@ -1,16 +1,21 @@ +import Link from 'next/link'; +import type { Metadata } from 'next'; import { Address } from '@/components/Address'; import { Container } from '@/components/Container'; -import { getAvatarForPlatform, getProfileInfo } from '@/lib/airstack'; -import { getBasicPlatformProfileInfo } from '@/lib/airstack/getBasicPlatformProfileInfo'; -import { formatAddress } from '@/utils'; -import { validateOrGetDefaultPlatform } from '@/utils/platform'; +import { + getAvatarForPlatform, + getProfileInfo, + getBasicPlatformProfileInfo, +} from '@/lib/airstack'; +import { APP_URL, formatAddress } from '@/utils'; +import { + validateOrGetDefaultPlatform, + validateOrGetDefaultNetwork, +} from '@/utils'; import { Badges } from './Badges'; -import Link from 'next/link'; import { ShareDialog } from './ShareDialog'; import { ProfileAvatar } from '@/components/ProfileAvatar'; import { Feed } from './Feed'; -import { validateOrGetDefaultNetwork } from '@/utils/validateOrGetDefaultNetwork'; -import type { Metadata } from 'next'; type PageProps = { params: { slug: string }; @@ -34,7 +39,7 @@ export default async function Page({
- +
{basicProfileInfo.name ?? formatAddress(mainAddress)}
@@ -42,9 +47,8 @@ export default async function Page({
{ - const [isCopied, setIsCopied] = useState(false); - const formattedAddress = formatAddress(address); - const handleCopy = () => { - setIsCopied(true); - navigator.clipboard.writeText(address); - setTimeout(() => { - setIsCopied(false); - }, 1000); - }; - return (
{formattedAddress} - - +
diff --git a/packages/dapp/src/components/CopyIcon/index.tsx b/packages/dapp/src/components/CopyIcon/index.tsx new file mode 100644 index 0000000..ea46ed0 --- /dev/null +++ b/packages/dapp/src/components/CopyIcon/index.tsx @@ -0,0 +1,36 @@ +'use client'; + +import { cn } from '@/lib/utils'; +import { DocumentDuplicateIcon } from '@heroicons/react/24/outline'; +import { Check } from 'lucide-react'; +import { useState } from 'react'; + +export const CopyIcon = ({ value }: { value: string }) => { + const [isCopied, setIsCopied] = useState(false); + + const handleCopy = () => { + setIsCopied(true); + navigator.clipboard.writeText(value); + setTimeout(() => { + setIsCopied(false); + }, 1000); + }; + + return ( + <> + + + + ); +}; diff --git a/packages/dapp/src/components/EndorseForm/FeeDisplay.tsx b/packages/dapp/src/components/EndorseForm/FeeDisplay.tsx index c702799..ce53236 100644 --- a/packages/dapp/src/components/EndorseForm/FeeDisplay.tsx +++ b/packages/dapp/src/components/EndorseForm/FeeDisplay.tsx @@ -45,7 +45,7 @@ export const FeeDisplay = ({ data: endorsementPrice, isPending: isEndorsementPricePending, isError: isEndorsementPriceError, - } = useEndorsmentPrice(chainId ?? DEFAULT_CHAIN_ID); // FIXME: Replace with proper chainId + } = useEndorsmentPrice(chainId ?? DEFAULT_CHAIN_ID); const { data: feesPerGas, diff --git a/packages/dapp/src/components/Endorsee/EndorseeBadge.tsx b/packages/dapp/src/components/Endorsee/EndorseeBadge.tsx index 2ce9ef3..2f645d1 100644 --- a/packages/dapp/src/components/Endorsee/EndorseeBadge.tsx +++ b/packages/dapp/src/components/Endorsee/EndorseeBadge.tsx @@ -1,15 +1,9 @@ -'use client'; - -import { useMemo, useState } from 'react'; - -import { DocumentDuplicateIcon } from '@heroicons/react/24/outline'; import { PLATFORM_DATA, PlatformType } from '@/utils/platform'; import { cn } from '@/lib/utils'; -import { Skeleton } from '@/components/ui/skeleton'; import { formatAddress } from '@/utils'; -import { Check } from 'lucide-react'; -import { MemoizedImage } from '@/components/MemoizedImage'; import { MemoizedSVG } from '@/components/MemoizedSVG'; +import { ProfileAvatar } from '@/components/ProfileAvatar'; +import { CopyIcon } from '@/components/CopyIcon'; type EndorseeBadgeProps = { type: PlatformType; @@ -24,49 +18,6 @@ export const EndorseeBadge = ({ handle, address, }: EndorseeBadgeProps) => { - // Local state - const [avatarLoading, setAvatarLoading] = useState(true); - const [isCopied, setIsCopied] = useState(false); - - // Hooks - const Avatar = useMemo(() => { - if (!avatar) { - return ( -
- {/* FIXME: First leter of handle if it exists */}TODO -
- ); - } - - return ( -
- setAvatarLoading(false)} - /> - -
- ); - }, [avatar, avatarLoading, handle]); - - // Functions - const handleCopy = () => { - setIsCopied(true); - navigator.clipboard.writeText(address); - setTimeout(() => { - setIsCopied(false); - }, 1000); - }; - switch (type) { case PlatformType.ens: case PlatformType.lens: @@ -75,7 +26,7 @@ export const EndorseeBadge = ({ return ( <>
- {Avatar} +
{formatAddress(address)} - - +
diff --git a/packages/dapp/src/components/ProfileAvatar/index.tsx b/packages/dapp/src/components/ProfileAvatar/index.tsx index 01aecba..59f8028 100644 --- a/packages/dapp/src/components/ProfileAvatar/index.tsx +++ b/packages/dapp/src/components/ProfileAvatar/index.tsx @@ -4,6 +4,7 @@ import { cn } from '@/lib/utils'; import { useState } from 'react'; import { Skeleton } from '@/components/ui/skeleton'; import { MemoizedImage } from '@/components/MemoizedImage'; +import { blo } from 'blo'; type AvatarSize = | 'xs' @@ -19,6 +20,7 @@ type AvatarSize = type ProfileAvatarProps = { avatar: string | null; + address: `0x${string}`; size?: AvatarSize; }; @@ -35,31 +37,13 @@ const AVATAR_SIZES = { '6xl': 192, }; -export const ProfileAvatar = ({ avatar, size = 'md' }: ProfileAvatarProps) => { +export const ProfileAvatar = ({ + avatar, + address, + size = 'md', +}: ProfileAvatarProps) => { const [isLoading, setIsLoading] = useState(true); - if (!avatar) { - return ( -
- V -
- ); - } - return (
{ > =16'} + blob-to-it@1.0.4: resolution: {integrity: sha512-iCmk0W4NdbrWgRRuxOriU8aM5ijeVLI61Zulsmg/lUHNr7pYjoj+U77opLefNagevtrrbMt3JQ5Qip7ar178kA==} @@ -18392,6 +18399,8 @@ snapshots: blakejs@1.2.1: {} + blo@1.2.0: {} + blob-to-it@1.0.4: dependencies: browser-readablestream-to-it: 1.0.3