diff --git a/src/state/queries/invites.ts b/src/state/queries/invites.ts index a765b309..bfea402e 100644 --- a/src/state/queries/invites.ts +++ b/src/state/queries/invites.ts @@ -43,7 +43,14 @@ export function useInviteCodesQuery() { } const available = res.data.codes.filter(isInviteAvailable) - const used = res.data.codes.filter(code => !isInviteAvailable(code)) + const used = res.data.codes + .filter(code => !isInviteAvailable(code)) + .sort((a, b) => { + return ( + new Date(b.uses[0].usedAt).getTime() - + new Date(a.uses[0].usedAt).getTime() + ) + }) return { disabled: false, diff --git a/src/view/com/modals/InviteCodes.tsx b/src/view/com/modals/InviteCodes.tsx index 82a826ac..0ebb545c 100644 --- a/src/view/com/modals/InviteCodes.tsx +++ b/src/view/com/modals/InviteCodes.tsx @@ -142,6 +142,7 @@ function InviteCode({ const pal = usePalette('default') const invitesState = useInvitesState() const {setInviteCopied} = useInvitesAPI() + const uses = invite.uses const onPress = React.useCallback(() => { Clipboard.setString(invite.code) @@ -185,7 +186,7 @@ function InviteCode({ /> )} - {invite.uses.length > 0 ? ( + {uses.length > 0 ? ( - Used by: + Used by:{' '} + {uses.map((use, i) => ( + + + {i !== uses.length - 1 && , } + + ))} - {invite.uses.map(use => ( - - - - - ))} ) : null}