Fix invites used order, adjust layout (#2139)
parent
040ce03215
commit
1975f4936a
|
@ -43,7 +43,14 @@ export function useInviteCodesQuery() {
|
||||||
}
|
}
|
||||||
|
|
||||||
const available = res.data.codes.filter(isInviteAvailable)
|
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 {
|
return {
|
||||||
disabled: false,
|
disabled: false,
|
||||||
|
|
|
@ -142,6 +142,7 @@ function InviteCode({
|
||||||
const pal = usePalette('default')
|
const pal = usePalette('default')
|
||||||
const invitesState = useInvitesState()
|
const invitesState = useInvitesState()
|
||||||
const {setInviteCopied} = useInvitesAPI()
|
const {setInviteCopied} = useInvitesAPI()
|
||||||
|
const uses = invite.uses
|
||||||
|
|
||||||
const onPress = React.useCallback(() => {
|
const onPress = React.useCallback(() => {
|
||||||
Clipboard.setString(invite.code)
|
Clipboard.setString(invite.code)
|
||||||
|
@ -185,7 +186,7 @@ function InviteCode({
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
{invite.uses.length > 0 ? (
|
{uses.length > 0 ? (
|
||||||
<View
|
<View
|
||||||
style={{
|
style={{
|
||||||
flexDirection: 'column',
|
flexDirection: 'column',
|
||||||
|
@ -193,19 +194,19 @@ function InviteCode({
|
||||||
paddingTop: 6,
|
paddingTop: 6,
|
||||||
}}>
|
}}>
|
||||||
<Text style={pal.text}>
|
<Text style={pal.text}>
|
||||||
<Trans>Used by:</Trans>
|
<Trans>Used by:</Trans>{' '}
|
||||||
</Text>
|
{uses.map((use, i) => (
|
||||||
{invite.uses.map(use => (
|
|
||||||
<Link
|
<Link
|
||||||
key={use.usedBy}
|
key={use.usedBy}
|
||||||
href={makeProfileLink({handle: use.usedBy, did: ''})}
|
href={makeProfileLink({handle: use.usedBy, did: ''})}
|
||||||
style={{
|
style={{
|
||||||
flexDirection: 'row',
|
flexDirection: 'row',
|
||||||
}}>
|
}}>
|
||||||
<Text style={pal.text}>• </Text>
|
|
||||||
<UserInfoText did={use.usedBy} style={pal.link} />
|
<UserInfoText did={use.usedBy} style={pal.link} />
|
||||||
|
{i !== uses.length - 1 && <Text style={pal.text}>, </Text>}
|
||||||
</Link>
|
</Link>
|
||||||
))}
|
))}
|
||||||
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
) : null}
|
) : null}
|
||||||
</View>
|
</View>
|
||||||
|
|
Loading…
Reference in New Issue