Files
web/libs/base-ui/utils/string.ts
Matthew Bunday 1fe1802895 Base Quest Anniversary NFT mint (#460)
* Setup merkle tree dependencies

* Setup to use redis to fetch proofs

* Setup RainbowKit

* Move WalletConnectID to ENV var

* Update Content Security Policies for WalletConnect

* Refactor icons, add farcaster

* Get desktop social nav dropdown working

* Setup wallet connect button

* Get useravatar working

* Lint and fix CSP errors

* Setup shared lib infrastructure

* Work on mobile wallet connect button

* Wallet address copy function

* Mint progress

* Add FAQ

* Add NFT metadata

* Minting states in progress

* Minting

* Refactor

* Setup social sharing

* Lint

* Add more logging

* Update share text, add dummy id

* Update URL ala Gardo

* Fix lint

* Builder nft banner

* Improve banner

* Log mint errors

* Update FAQ

* Add utm for mint link

* allow cbhq for now

* useMintStateContext

* Environment tweaks

* Fix nav wrapping

* Fix eslint config for typescript

* Work towards claimed state

* Label nav with 'socials'

* Feedback updates

* Improve banner visibility and display logic

* Copy updates

* Fix eslintrc

* Fix lint / eslintrc, sigh

* Copy update in FAQ

* FAQ copy updates

* FAQ copy updates

* FAQ copy updates

* Update copy

* Remove mint button after minting

* Remove console log

* Remove wallet connect id

* Add error logging
2024-04-25 17:48:45 -04:00

23 lines
566 B
TypeScript

export function truncateMiddle(
str: string | null | undefined,
charactersAtFront: number,
charactersAtEnd: number,
): string {
if (!str) {
return '';
}
const truncationString = '…';
const trimmed = str.trim();
if (trimmed.length <= charactersAtFront + charactersAtEnd + truncationString.length) {
return str;
}
const startOfEnd = trimmed.length - charactersAtEnd;
const firstChars = trimmed.substring(0, charactersAtFront);
const lastChars = trimmed.substring(startOfEnd);
return firstChars + truncationString + lastChars;
}