Compare commits
No commits in common. "ee03cc545e6ad449458fd2e9546f9553ecbfbe86" and "3eed2964a08d50057f22d8582d54ae4dbc95eac8" have entirely different histories.
ee03cc545e
...
3eed2964a0
@ -1,8 +1,9 @@
|
|||||||
import { CurrentUserMark } from '../../types/mark.ts'
|
import { CurrentUserMark } from '../../types/mark.ts'
|
||||||
import styles from './style.module.scss'
|
import styles from './style.module.scss'
|
||||||
|
|
||||||
|
import { MARK_TYPE_TRANSLATION } from '../../utils/const.ts'
|
||||||
import {
|
import {
|
||||||
findNextIncompleteCurrentUserMark,
|
findNextIncompleteCurrentUserMark,
|
||||||
getToolboxLabelByMarkType,
|
|
||||||
isCurrentUserMarksComplete,
|
isCurrentUserMarksComplete,
|
||||||
isCurrentValueLast
|
isCurrentValueLast
|
||||||
} from '../../utils'
|
} from '../../utils'
|
||||||
@ -52,7 +53,6 @@ const MarkFormField = ({
|
|||||||
: handleCurrentUserMarkChange(findNext()!)
|
: handleCurrentUserMarkChange(findNext()!)
|
||||||
}
|
}
|
||||||
const toggleActions = () => setDisplayActions(!displayActions)
|
const toggleActions = () => setDisplayActions(!displayActions)
|
||||||
const markLabel = getToolboxLabelByMarkType(selectedMark.mark.type)
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.container}>
|
<div className={styles.container}>
|
||||||
<div className={styles.trigger}>
|
<div className={styles.trigger}>
|
||||||
@ -78,14 +78,16 @@ const MarkFormField = ({
|
|||||||
<div className={styles.actionsWrapper}>
|
<div className={styles.actionsWrapper}>
|
||||||
<div className={styles.actionsTop}>
|
<div className={styles.actionsTop}>
|
||||||
<div className={styles.actionsTopInfo}>
|
<div className={styles.actionsTopInfo}>
|
||||||
<p className={styles.actionsTopInfoText}>Add {markLabel}</p>
|
<p className={styles.actionsTopInfoText}>Add your signature</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.inputWrapper}>
|
<div className={styles.inputWrapper}>
|
||||||
<form onSubmit={(e) => handleFormSubmit(e)}>
|
<form onSubmit={(e) => handleFormSubmit(e)}>
|
||||||
<input
|
<input
|
||||||
className={styles.input}
|
className={styles.input}
|
||||||
placeholder={markLabel}
|
placeholder={
|
||||||
|
MARK_TYPE_TRANSLATION[selectedMark.mark.type.valueOf()]
|
||||||
|
}
|
||||||
onChange={handleSelectedMarkValueChange}
|
onChange={handleSelectedMarkValueChange}
|
||||||
value={selectedMarkValue}
|
value={selectedMarkValue}
|
||||||
/>
|
/>
|
||||||
|
@ -246,22 +246,17 @@ export const CreatePage = () => {
|
|||||||
const input = userInput.toLowerCase()
|
const input = userInput.toLowerCase()
|
||||||
|
|
||||||
if (input.startsWith('npub')) {
|
if (input.startsWith('npub')) {
|
||||||
return handleAddNpubUser(input)
|
const pubkey = npubToHex(input)
|
||||||
|
if (pubkey) {
|
||||||
|
addUser(pubkey)
|
||||||
|
setUserInput('')
|
||||||
|
} else {
|
||||||
|
setError('Provided npub is not valid. Please enter correct npub.')
|
||||||
|
}
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (input.includes('@')) {
|
if (input.includes('@')) {
|
||||||
return await handleAddNip05User(input)
|
|
||||||
}
|
|
||||||
|
|
||||||
// If the user enters the domain (w/o @) assume it's the "root" and append _@
|
|
||||||
// https://github.com/nostr-protocol/nips/blob/master/05.md#showing-just-the-domain-as-an-identifier
|
|
||||||
if (input.includes('.')) {
|
|
||||||
return await handleAddNip05User(`_@${input}`)
|
|
||||||
}
|
|
||||||
|
|
||||||
setError('Invalid input! Make sure to provide correct npub or nip05.')
|
|
||||||
|
|
||||||
async function handleAddNip05User(input: string) {
|
|
||||||
setIsLoading(true)
|
setIsLoading(true)
|
||||||
setLoadingSpinnerDesc('Querying for nip05')
|
setLoadingSpinnerDesc('Querying for nip05')
|
||||||
const nip05Profile = await queryNip05(input)
|
const nip05Profile = await queryNip05(input)
|
||||||
@ -284,16 +279,7 @@ export const CreatePage = () => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleAddNpubUser(input: string) {
|
setError('Invalid input! Make sure to provide correct npub or nip05.')
|
||||||
const pubkey = npubToHex(input)
|
|
||||||
if (pubkey) {
|
|
||||||
addUser(pubkey)
|
|
||||||
setUserInput('')
|
|
||||||
} else {
|
|
||||||
setError('Provided npub is not valid. Please enter correct npub.')
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleUserRoleChange = (role: UserRole, pubkey: string) => {
|
const handleUserRoleChange = (role: UserRole, pubkey: string) => {
|
||||||
|
@ -1,4 +1,9 @@
|
|||||||
|
import { MarkType } from '../types/drawing.ts'
|
||||||
|
|
||||||
export const EMPTY: string = ''
|
export const EMPTY: string = ''
|
||||||
|
export const MARK_TYPE_TRANSLATION: { [key: string]: string } = {
|
||||||
|
[MarkType.FULLNAME.valueOf()]: 'Full Name'
|
||||||
|
}
|
||||||
export const ARRAY_BUFFER = 'arraybuffer'
|
export const ARRAY_BUFFER = 'arraybuffer'
|
||||||
export const DEFLATE = 'DEFLATE'
|
export const DEFLATE = 'DEFLATE'
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user