mirror of
https://github.com/urbit/shrub.git
synced 2024-12-22 10:21:31 +03:00
parent
edf6456d6c
commit
bb03b6f278
@ -206,8 +206,9 @@ function InviteActions(props: {
|
|||||||
app?: string;
|
app?: string;
|
||||||
uid?: string;
|
uid?: string;
|
||||||
}) {
|
}) {
|
||||||
const { resource, api, app, uid } = props;
|
const { status, resource, api, app, uid } = props;
|
||||||
const inviteAccept = useInviteAccept(resource, api, app, uid);
|
const inviteAccept = useInviteAccept(resource, api, app, uid);
|
||||||
|
const set = useGroupState(s => s.set);
|
||||||
|
|
||||||
const inviteDecline = useCallback(async () => {
|
const inviteDecline = useCallback(async () => {
|
||||||
if (!(app && uid)) {
|
if (!(app && uid)) {
|
||||||
@ -216,15 +217,18 @@ function InviteActions(props: {
|
|||||||
await api.invite.decline(app, uid);
|
await api.invite.decline(app, uid);
|
||||||
}, [app, uid]);
|
}, [app, uid]);
|
||||||
|
|
||||||
const hideJoin = useCallback(async () => {
|
const hideJoin = useCallback(async (e) => {
|
||||||
await api.groups.hide(resource);
|
if(status?.progress === 'done') {
|
||||||
}, [api, resource]);
|
set(s => {
|
||||||
|
delete s.pendingJoin[resource]
|
||||||
const { status } = props;
|
});
|
||||||
if (status) {
|
e.stopPropagation();
|
||||||
if(status.progress === 'done') {
|
return;
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
await api.groups.hide(resource);
|
||||||
|
}, [api, resource, status]);
|
||||||
|
|
||||||
|
if (status) {
|
||||||
return (
|
return (
|
||||||
<Row gapX="2" alignItems="center" height={4}>
|
<Row gapX="2" alignItems="center" height={4}>
|
||||||
<StatelessAsyncButton
|
<StatelessAsyncButton
|
||||||
@ -232,7 +236,7 @@ function InviteActions(props: {
|
|||||||
backgroundColor="white"
|
backgroundColor="white"
|
||||||
onClick={hideJoin}
|
onClick={hideJoin}
|
||||||
>
|
>
|
||||||
Cancel
|
{status?.progress === 'done' ? 'Dismiss' : 'Cancel'}
|
||||||
</StatelessAsyncButton>
|
</StatelessAsyncButton>
|
||||||
</Row>
|
</Row>
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user