* Add BountyStatusDisplay component * Implement help tooltip in BountyStatusDisplay * Add BountyStatusDisplay translations * Add styling to BountyStatusDisplay * Update translations * Add missing types * Add missing translation * Update local imports * Update local imports * Rename BountyStatusDisplay to BountyStatusView * Rewrite bounty status helpers * Add review suggestion * Change useMemo to useRef in BountyStatusView
13 lines
438 B
TypeScript
13 lines
438 B
TypeScript
// Copyright 2017-2021 @polkadot/app-bounties authors & contributors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
export function insertSpaceBeforeCapitalLetter (str: string): string {
|
|
return str.replace(/([a-z])([A-Z])/g, '$1 $2');
|
|
}
|
|
|
|
export function truncateTitle (str: string, maxLength: number): string {
|
|
const ellipsis = String.fromCharCode(8230);
|
|
|
|
return (str.length > maxLength) ? str.substr(0, maxLength - 1) + ellipsis : str;
|
|
}
|