TC-98 | Add ProposalComments component with tab filters
This commit is contained in:
parent
3cef4c4d5b
commit
6e01a677ae
14 changed files with 876 additions and 336 deletions
|
@ -10,6 +10,30 @@ export const sliceAddress = (address) => {
|
|||
return '0x' + hashRender(address.slice(2))
|
||||
}
|
||||
|
||||
export const sliceEnsName = (name, size = 4, separator = '...') => {
|
||||
const chars = [...name]
|
||||
|
||||
const last = name
|
||||
.split('.')
|
||||
.pop()
|
||||
.slice(-size)
|
||||
|
||||
if (chars[0]?.length === 2 && last) {
|
||||
// 🐵🍆💦.eth -> 🐵🍆💦.eth
|
||||
if (chars.length - 4 <= 4) return name
|
||||
|
||||
// 🦍🦍🦍🦍🦍🦍🦍.eth -> 🦍🦍🦍...eth
|
||||
return [].concat(chars.slice(0, 3), separator, last).join('')
|
||||
}
|
||||
|
||||
if (chars.length <= 2 * size + 2 + separator.length) return name
|
||||
if (!name.includes('.')) return sliceAddress(name, size, separator)
|
||||
|
||||
return last.length
|
||||
? [].concat(chars.slice(0, 2 * size - last.length), separator, last).join('')
|
||||
: [].concat(chars.slice(0, size), separator, chars.slice(-size)).join('')
|
||||
}
|
||||
|
||||
const semVerRegex = /^(?<major>0|[1-9]\d*)\.(?<minor>0|[1-9]\d*)\.(?<patch>0|[1-9]\d*)(?:-(?<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?<buildmetadata>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/
|
||||
|
||||
export const parseSemanticVersion = (version) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue