mirror of
https://github.com/hzrd149/nostrudel.git
synced 2025-09-26 19:47:25 +02:00
small cleanup
This commit is contained in:
@@ -59,7 +59,7 @@ export const NoteRelays = memo(({ event, ...props }: NoteRelaysProps) => {
|
||||
{eventRelays.map((url) => (
|
||||
<Flex alignItems="center" key={url}>
|
||||
<RelayFavicon relay={url} size="2xs" mr="2" />
|
||||
<Text>{url}</Text>
|
||||
<Text isTruncated>{url}</Text>
|
||||
</Flex>
|
||||
))}
|
||||
</PopoverBody>
|
||||
|
@@ -40,22 +40,24 @@ function useUserPointer() {
|
||||
}
|
||||
}
|
||||
|
||||
function useUserTop4Relays(pubkey: string) {
|
||||
function useUserTopRelays(pubkey: string, count: number = 4) {
|
||||
// get user relays
|
||||
const userRelays = useFallbackUserRelays(pubkey)
|
||||
.filter((r) => r.mode & RelayMode.WRITE)
|
||||
.map((r) => r.url);
|
||||
// merge the users relays with client relays
|
||||
const readRelays = useReadRelayUrls();
|
||||
// find the top 4
|
||||
return userRelays.length === 0 ? readRelays : relayScoreboardService.getRankedRelays(userRelays).slice(0, 4);
|
||||
if (userRelays.length === 0) return readRelays;
|
||||
const sorted = relayScoreboardService.getRankedRelays(userRelays);
|
||||
|
||||
return !count ? sorted : sorted.slice(0, count);
|
||||
}
|
||||
|
||||
const UserView = () => {
|
||||
const { pubkey, relays: pointerRelays } = useUserPointer();
|
||||
const isMobile = useIsMobile();
|
||||
const navigate = useNavigate();
|
||||
const userTopRelays = useUserTop4Relays(pubkey);
|
||||
const userTopRelays = useUserTopRelays(pubkey);
|
||||
|
||||
const matches = useMatches();
|
||||
const lastMatch = matches[matches.length - 1];
|
||||
|
Reference in New Issue
Block a user