Skip to content

Commit

Permalink
chore: use Invite type directly from core (#891)
Browse files Browse the repository at this point in the history
  • Loading branch information
achou11 authored Dec 12, 2024
1 parent cb2cee3 commit c654080
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 20 deletions.
11 changes: 2 additions & 9 deletions src/frontend/hooks/useProjectInvitesListener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@ import {useCallback, useEffect, useState} from 'react';
import {useApi} from '../contexts/ApiContext';
import {useQueryClient} from '@tanstack/react-query';
import {INVITE_KEY} from './server/invites';
import {MapBuffers} from '@comapeo/core/dist/types';
import {
InviteInternal,
InviteRemovalReason,
} from '@comapeo/core/dist/invite-api';
import {Invite, InviteRemovalReason} from '@comapeo/core/dist/invite-api';

export const useProjectInvitesListener = ({
inviteId,
Expand All @@ -25,10 +21,7 @@ export const useProjectInvitesListener = ({
}, [queryClient]);

useEffect(() => {
function shouldInterceptCancel(
val: MapBuffers<InviteInternal>,
reason: InviteRemovalReason,
) {
function shouldInterceptCancel(val: Invite, reason: InviteRemovalReason) {
if (
reason === 'canceled' &&
inviteId === val.inviteId &&
Expand Down
16 changes: 5 additions & 11 deletions src/frontend/sharedComponents/ProjectInviteBottomSheet/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import * as React from 'react';
import {MapBuffers} from '@comapeo/core/dist/types';
import {
InviteInternal,
InviteRemovalReason,
} from '@comapeo/core/dist/invite-api';
import {Invite, InviteRemovalReason} from '@comapeo/core/dist/invite-api';

import {BottomSheetModal, useBottomSheetModal} from '../BottomSheetModal';
import {
Expand Down Expand Up @@ -174,14 +170,12 @@ export const ProjectInviteBottomSheet = ({

function useAcceptedInvite() {
const api = useApi();
const [acceptedInvite, setAcceptedInvite] =
React.useState<MapBuffers<InviteInternal> | null>(null);
const [acceptedInvite, setAcceptedInvite] = React.useState<Invite | null>(
null,
);

React.useEffect(() => {
function onInviteRemoved(
invite: MapBuffers<InviteInternal>,
reason: InviteRemovalReason,
) {
function onInviteRemoved(invite: Invite, reason: InviteRemovalReason) {
if (reason === 'accepted') {
setAcceptedInvite(invite);
}
Expand Down

0 comments on commit c654080

Please sign in to comment.