refactor: improve logic
Signed-off-by: Sebastian <krupinski01@gmail.com>
This commit is contained in:
@@ -47,10 +47,10 @@ const selectedIdSet = computed(() => new Set(props.selectedMessageIds))
|
||||
const isOpened = (message: EntityInterface<MessageInterface>): boolean => {
|
||||
if (!props.selectedMessage) return false
|
||||
return (
|
||||
message.provider === props.selectedMessage.provider &&
|
||||
message.service === props.selectedMessage.service &&
|
||||
message.collection === props.selectedMessage.collection &&
|
||||
message.identifier === props.selectedMessage.identifier
|
||||
message.provider === selectedMessage.value.provider &&
|
||||
message.service === selectedMessage.value.service &&
|
||||
message.collection === selectedMessage.value.collection &&
|
||||
message.identifier === selectedMessage.value.identifier
|
||||
)
|
||||
}
|
||||
|
||||
@@ -61,12 +61,12 @@ const isSelected = (message: EntityInterface<MessageInterface>): boolean => {
|
||||
}
|
||||
|
||||
// Check if message is unread
|
||||
const isUnread = (message: EntityInterface<MessageInterface>): boolean => {
|
||||
const isUnread = (message: EntityObject): boolean => {
|
||||
return !message.properties.flags?.read
|
||||
}
|
||||
|
||||
// Check if message is flagged
|
||||
const isFlagged = (message: EntityInterface<MessageInterface>): boolean => {
|
||||
const isFlagged = (message: EntityObject): boolean => {
|
||||
return message.properties.flags?.flagged || false
|
||||
}
|
||||
|
||||
@@ -203,7 +203,7 @@ const handleSelectAllToggle = (value: boolean | null) => {
|
||||
|
||||
// Sorted messages (newest first)
|
||||
const sortedMessages = computed(() => {
|
||||
return [...props.messages].sort((a, b) => {
|
||||
return [...currentMessages.value].sort((a, b) => {
|
||||
const dateA = a.properties.date ? new Date(a.properties.date).getTime() : 0
|
||||
const dateB = b.properties.date ? new Date(b.properties.date).getTime() : 0
|
||||
return dateB - dateA
|
||||
@@ -216,12 +216,12 @@ const unreadCount = computed(() => {
|
||||
})
|
||||
|
||||
const totalCount = computed(() => {
|
||||
return props.selectedCollection?.properties.total ?? 0
|
||||
return selectedFolder.value?.properties.total ?? 0
|
||||
})
|
||||
|
||||
// True only when the collection explicitly provides total/unread counts
|
||||
const hasCountData = computed(() => {
|
||||
return props.selectedCollection?.properties.total != null
|
||||
return selectedFolder.value?.properties.total != null
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -290,7 +290,7 @@ const hasCountData = computed(() => {
|
||||
</div>
|
||||
|
||||
<!-- Empty state -->
|
||||
<div v-else-if="messages.length === 0" class="pa-8 text-center">
|
||||
<div v-else-if="currentMessages.length === 0" class="pa-8 text-center">
|
||||
<v-icon size="64" color="grey-lighten-1">mdi-email-outline</v-icon>
|
||||
<div class="text-h6 mt-4 text-medium-emphasis">No messages</div>
|
||||
<div class="text-body-2 text-medium-emphasis">
|
||||
|
||||
Reference in New Issue
Block a user