mirror of
https://github.com/urbit/shrub.git
synced 2024-12-11 11:02:25 +03:00
interface: address hunter review
This commit is contained in:
parent
f615ddf920
commit
1e180f420a
@ -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: {
|
||||
|
@ -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];
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ export const LaunchApp = (props: LaunchAppProps): ReactElement | null => {
|
||||
<NewGroup />
|
||||
</ModalButton>
|
||||
<Button
|
||||
bg="washedGray"
|
||||
backgroundColor="washedGray"
|
||||
color="black"
|
||||
border={0}
|
||||
p={0}
|
||||
|
Loading…
Reference in New Issue
Block a user