interface: address hunter review

This commit is contained in:
Liam Fitzgerald 2021-11-24 13:18:40 -05:00
parent f615ddf920
commit 1e180f420a
3 changed files with 10 additions and 9 deletions

View File

@ -1,4 +1,4 @@
import { Association, Group, JoinRequests } from '@urbit/api';
import { Association, Group, JoinRequests, abortJoin } from '@urbit/api';
import { useCallback } from 'react';
import { reduce } from '../reducers/group-update';
import _ from 'lodash';
@ -9,7 +9,6 @@ import {
reduceStateN
} from './base';
import api from '~/logic/api';
import { abortJoin } from '@urbit/api';
export interface GroupState {
groups: {

View File

@ -1,4 +1,4 @@
import { deSig, Invites } from '@urbit/api';
import { deSig, Invite, Invites } from '@urbit/api';
import { reduce } from '../reducers/invite-update';
import _ from 'lodash';
import {
@ -32,9 +32,11 @@ export default useInviteState;
export function useInviteForResource(app: string, ship: string, name: string) {
const { invites } = useInviteState();
return _.compact(Object.entries(invites?.[app] || {}).map(([uid, invite]) => {
if (invite.resource.ship === deSig(ship) && invite.resource.name === name) {
return invite;
}
}))?.[0];
const matches = Object.entries(invites?.[app] || {})
.reduce((acc, [uid, invite]) => {
const isMatch = (invite.resource.ship === deSig(ship)
&& invite.resource.name === name)
return isMatch ? [invite, ...acc] : acc;
}, [] as Invite[])
return matches?.[0];
}

View File

@ -91,7 +91,7 @@ export const LaunchApp = (props: LaunchAppProps): ReactElement | null => {
<NewGroup />
</ModalButton>
<Button
bg="washedGray"
backgroundColor="washedGray"
color="black"
border={0}
p={0}