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 { useCallback } from 'react';
import { reduce } from '../reducers/group-update'; import { reduce } from '../reducers/group-update';
import _ from 'lodash'; import _ from 'lodash';
@ -9,7 +9,6 @@ import {
reduceStateN reduceStateN
} from './base'; } from './base';
import api from '~/logic/api'; import api from '~/logic/api';
import { abortJoin } from '@urbit/api';
export interface GroupState { export interface GroupState {
groups: { 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 { reduce } from '../reducers/invite-update';
import _ from 'lodash'; import _ from 'lodash';
import { import {
@ -32,9 +32,11 @@ export default useInviteState;
export function useInviteForResource(app: string, ship: string, name: string) { export function useInviteForResource(app: string, ship: string, name: string) {
const { invites } = useInviteState(); const { invites } = useInviteState();
return _.compact(Object.entries(invites?.[app] || {}).map(([uid, invite]) => { const matches = Object.entries(invites?.[app] || {})
if (invite.resource.ship === deSig(ship) && invite.resource.name === name) { .reduce((acc, [uid, invite]) => {
return invite; const isMatch = (invite.resource.ship === deSig(ship)
} && invite.resource.name === name)
}))?.[0]; return isMatch ? [invite, ...acc] : acc;
}, [] as Invite[])
return matches?.[0];
} }

View File

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