Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(outgoingFriends): alpha sort to outgoing friends AP-713 #1480

Merged
merged 1 commit into from
Feb 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pages/friends/list/FriendsList.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
/>
</div>
<FriendsFriend
v-for="friend in friends.outgoingRequests"
v-for="friend in alphaSortedOutgoing"
:friend="{
name: friend.userInfo.name,
address: friend.to,
Expand Down
8 changes: 8 additions & 0 deletions pages/friends/list/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
<script lang="ts">
import Vue from 'vue'
import { mapState } from 'vuex'
import { cloneDeep } from 'lodash'
import { DataStateType } from '~/store/dataState/types'

import { getAlphaSorted } from '~/libraries/ui/Friends'
import { OutgoingRequest } from '~/types/ui/friends'

type Route = 'active' | 'requests' | 'blocked' | 'add'
declare module 'vue/types/vue' {
Expand All @@ -28,6 +30,12 @@ export default Vue.extend({
alphaSortedFriends() {
return getAlphaSorted(this.friends.all)
},
alphaSortedOutgoing() {
return cloneDeep(this.friends.outgoingRequests).sort(
(a: OutgoingRequest, b: OutgoingRequest) =>
a.userInfo.name.localeCompare(b.userInfo.name),
)
},
},
watch: {
'$route.query'() {
Expand Down
2 changes: 1 addition & 1 deletion types/ui/friends.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export interface FriendRequest {
requestId: string
account: FriendAccount
pending: boolean
userInfo: RawUser | null
userInfo: RawUser
}

export interface IncomingRequest extends FriendRequest {
Expand Down