mirror of
https://github.com/balzack/databag.git
synced 2025-02-14 12:39:17 +00:00
display full node if different
This commit is contained in:
parent
42bd9607e8
commit
f6087e7f1e
@ -9,9 +9,6 @@ export function Cards({ showRegistry }) {
|
||||
|
||||
const { state, actions } = useCards();
|
||||
|
||||
useEffect(() => {
|
||||
}, [showRegistry]);
|
||||
|
||||
const onSelect = (item) => {
|
||||
actions.select(item);
|
||||
}
|
||||
@ -30,6 +27,17 @@ export function Cards({ showRegistry }) {
|
||||
return null
|
||||
}
|
||||
|
||||
const cardHandle = (item) => {
|
||||
const profile = item.data?.cardProfile
|
||||
if (profile) {
|
||||
if (profile.node == state.node) {
|
||||
return profile.handle;
|
||||
}
|
||||
return profile.handle + '@' + profile.node;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<CardsWrapper>
|
||||
<Drawer
|
||||
@ -56,7 +64,7 @@ export function Cards({ showRegistry }) {
|
||||
imageSet={cardProfile(item).imageSet} />
|
||||
</div>
|
||||
<div class="username">
|
||||
<span class="handle">{ cardProfile(item).handle }</span>
|
||||
<span class="handle">{ cardHandle(item) }</span>
|
||||
<span class="name">{ cardProfile(item).name }</span>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -46,7 +46,7 @@ export const CardItem = styled(List.Item)`
|
||||
}
|
||||
|
||||
.handle {
|
||||
font-size: 0.9em;
|
||||
font-size: 0.7em;
|
||||
font-weight: bold;
|
||||
}
|
||||
`;
|
||||
|
@ -1,15 +1,18 @@
|
||||
import { useContext, useState, useEffect } from 'react';
|
||||
import { CardContext } from 'context/CardContext';
|
||||
import { ProfileContext } from 'context/ProfileContext';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
|
||||
export function useCards() {
|
||||
|
||||
const [state, setState] = useState({
|
||||
cards: [],
|
||||
node: null,
|
||||
});
|
||||
|
||||
const navigate = useNavigate();
|
||||
const card = useContext(CardContext);
|
||||
const profile = useContext(ProfileContext);
|
||||
|
||||
const actions = {
|
||||
getImageUrl: card.actions.getImageUrl,
|
||||
@ -45,5 +48,9 @@ export function useCards() {
|
||||
})});
|
||||
}, [card])
|
||||
|
||||
useEffect(() => {
|
||||
updateState({ node: profile.state?.profile?.node });
|
||||
}, [profile])
|
||||
|
||||
return { state, actions };
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user