mirror of
https://github.com/irislib/iris-messenger.git
synced 2024-10-18 06:03:22 +00:00
more chat fixes
This commit is contained in:
parent
8fbde57db0
commit
b97db6ab58
@ -10,7 +10,7 @@ import Show from '../helpers/Show';
|
|||||||
import ProxyImg from '../ProxyImg.tsx';
|
import ProxyImg from '../ProxyImg.tsx';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
str: unknown;
|
str: string;
|
||||||
hidePicture?: boolean;
|
hidePicture?: boolean;
|
||||||
showTooltip?: boolean;
|
showTooltip?: boolean;
|
||||||
activity?: string;
|
activity?: string;
|
||||||
@ -23,7 +23,10 @@ const MyAvatar: React.FC<Props> = (props) => {
|
|||||||
const [avatar, setAvatar] = useState<string | null>(null);
|
const [avatar, setAvatar] = useState<string | null>(null);
|
||||||
const [hasError, setHasError] = useState<boolean>(false);
|
const [hasError, setHasError] = useState<boolean>(false);
|
||||||
|
|
||||||
const hex = React.useMemo(() => Key.toNostrHexAddress(props.str as string), [props.str]);
|
const hex = React.useMemo(
|
||||||
|
() => Key.toNostrHexAddress(props.str as string) || props.str,
|
||||||
|
[props.str],
|
||||||
|
);
|
||||||
|
|
||||||
const { picture, name } = useProfile(hex || '');
|
const { picture, name } = useProfile(hex || '');
|
||||||
|
|
||||||
|
@ -242,7 +242,12 @@ export default {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const hex = new Hex(address);
|
const hex = new Hex(address);
|
||||||
return hex.toBech32(prefix);
|
const bech32 = hex.toBech32(prefix);
|
||||||
|
if (bech32.length < 60) {
|
||||||
|
// not a nostr key
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return bech32;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// not a valid hex
|
// not a valid hex
|
||||||
console.error(address, e);
|
console.error(address, e);
|
||||||
|
Loading…
Reference in New Issue
Block a user