## Description * Added the ability to sort for 4 sub-sections under conversations folders, teams, channels and labels. * the sort options are basically created at, alphabetical and unread counts along with both directions. * for folders we don't have an unread count, so we sort it by only created and alphabetical. * all the sort preferences are stored on the frontend - easiest implementation for now. Fixes # CW-7193 ## Type of change Please delete options that are not relevant. - [ ] Bug fix (non-breaking change which fixes an issue) - [x] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality not to work as expected) - [ ] This change requires a documentation update ## How Has This Been Tested? Tested this locally by visually verifying the changes. Also ran the newly added tests for component level changes. Here is the screenshot of the changes: Added the sort option to sub sections in the conversation sidebar: <img width="282" height="848" alt="Screenshot 2026-06-02 at 1 58 12 AM" src="https://github.com/user-attachments/assets/4a7c6061-86e3-438a-92ae-ee643a0128b6" /> The sort options looks like this: <img width="783" height="698" alt="Screenshot 2026-06-02 at 1 58 49 AM" src="https://github.com/user-attachments/assets/a15bb0a7-b810-4423-a88c-fbd84d0476c0" /> ## Checklist: - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my code - [ ] I have commented on my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged and published in downstream modules --------- Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com> Co-authored-by: iamsivin <iamsivin@gmail.com>
75 lines
2.3 KiB
Vue
75 lines
2.3 KiB
Vue
<script setup>
|
|
import { computed } from 'vue';
|
|
import { useMapGetter } from 'dashboard/composables/store.js';
|
|
import Icon from 'next/icon/Icon.vue';
|
|
|
|
const props = defineProps({
|
|
to: { type: [Object, String], default: '' },
|
|
label: { type: String, default: '' },
|
|
icon: { type: [String, Object], default: '' },
|
|
expandable: { type: Boolean, default: false },
|
|
isExpanded: { type: Boolean, default: false },
|
|
isActive: { type: Boolean, default: false },
|
|
hasActiveChild: { type: Boolean, default: false },
|
|
getterKeys: { type: Object, default: () => ({}) },
|
|
});
|
|
|
|
const emit = defineEmits(['toggle']);
|
|
|
|
const showBadge = useMapGetter(props.getterKeys.badge);
|
|
const dynamicCount = useMapGetter(props.getterKeys.count);
|
|
const count = computed(() =>
|
|
dynamicCount.value > 99 ? '99+' : dynamicCount.value
|
|
);
|
|
</script>
|
|
|
|
<template>
|
|
<component
|
|
:is="to ? 'router-link' : 'div'"
|
|
class="flex items-center gap-2 px-1.5 py-1 rounded-lg h-8 min-w-0"
|
|
role="button"
|
|
draggable="false"
|
|
:to="to"
|
|
:title="label"
|
|
:class="{
|
|
'text-n-slate-12 bg-n-alpha-2 font-medium': isActive && !hasActiveChild,
|
|
'text-n-slate-12 font-medium': hasActiveChild,
|
|
'text-n-slate-11 hover:bg-n-alpha-2': !isActive && !hasActiveChild,
|
|
}"
|
|
@click.stop="emit('toggle')"
|
|
>
|
|
<div v-if="icon" class="relative flex items-center gap-2">
|
|
<Icon v-if="icon" :icon="icon" class="size-4" />
|
|
<span
|
|
v-if="showBadge"
|
|
class="size-2 -top-px ltr:-right-px rtl:-left-px bg-n-brand absolute rounded-full border border-n-solid-2"
|
|
/>
|
|
</div>
|
|
<div
|
|
class="flex items-center gap-1.5 flex-grow justify-between min-w-0 flex-1"
|
|
>
|
|
<span
|
|
class="truncate"
|
|
:class="{
|
|
'text-body-main': !isActive,
|
|
'font-medium text-sm': isActive || hasActiveChild,
|
|
}"
|
|
>
|
|
{{ label }}
|
|
</span>
|
|
<span
|
|
v-if="dynamicCount && !expandable"
|
|
class="inline-grid h-5 min-w-5 place-items-center rounded-full bg-n-slate-4 px-1 text-xxs font-medium leading-3 text-n-slate-12 dark:bg-n-slate-5 flex-shrink-0"
|
|
>
|
|
{{ count }}
|
|
</span>
|
|
</div>
|
|
<span
|
|
v-if="expandable"
|
|
v-show="isExpanded"
|
|
class="i-lucide-chevron-up size-3"
|
|
@click.stop="emit('toggle')"
|
|
/>
|
|
</component>
|
|
</template>
|