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 { 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: {
|
||||||
|
@ -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];
|
||||||
}
|
}
|
||||||
|
@ -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}
|
||||||
|
Loading…
Reference in New Issue
Block a user