mirror of
				https://github.com/lingble/chatwoot.git
				synced 2025-11-03 20:48:07 +00:00 
			
		
		
		
	* Enhancement: Updates sidebar to a new design (#2733) * feat: Changes primary navbar to new design (#2598) * feat: updates design for secondary navbar (#2612) * Changes primary nvbar to new design * Updates design for contexual sidebar * Fixes issues with JSON * Remove duplication of notificatons in Navigation * Fixes broken tests * Fixes broken tests * Update app/javascript/dashboard/components/layout/AvailabilityStatus.vue * Update app/javascript/dashboard/components/layout/AvailabilityStatus.vue * Update app/javascript/dashboard/components/layout/SidebarItem.vue Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com> * Update app/javascript/dashboard/components/layout/SidebarItem.vue Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com> * Update app/javascript/dashboard/modules/sidebar/components/Secondary.vue Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com> Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com> * Chore: Update design changes to features * Fixes menu transitions and refactors code * Refactors sidebar routeing logic * lint error fixes * Fixes dropdown menu styles * Fixes secondary new item links * Fixes lint scss issues * fixes linter issues * Fixes broken test cases * Update AvailabilityStatus.spec.js * Review feedbacks * Fixes add modal for label * Add tooltip for primary menu item * Tooltip for notifications * Adds tooltip for primary menu items * Review fixes * Review fixes * Fix merge issues * fixes logo size for login pages * fixes Merge breaks with styles Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com> Co-authored-by: Pranav Raj S <pranav@chatwoot.com>
		
			
				
	
	
		
			150 lines
		
	
	
		
			3.7 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
			
		
		
	
	
			150 lines
		
	
	
		
			3.7 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
<template>
 | 
						|
  <woot-dropdown-menu>
 | 
						|
    <woot-dropdown-header :title="$t('SIDEBAR.SET_AVAILABILITY_TITLE')" />
 | 
						|
    <woot-dropdown-item
 | 
						|
      v-for="status in availabilityStatuses"
 | 
						|
      :key="status.value"
 | 
						|
      class="status-items"
 | 
						|
    >
 | 
						|
      <woot-button
 | 
						|
        size="small"
 | 
						|
        :color-scheme="status.disabled ? '' : 'secondary'"
 | 
						|
        :variant="status.disabled ? 'smooth' : 'clear'"
 | 
						|
        class-names="status-change--dropdown-button"
 | 
						|
        @click="changeAvailabilityStatus(status.value)"
 | 
						|
      >
 | 
						|
        <availability-status-badge :status="status.value" />
 | 
						|
        {{ status.label }}
 | 
						|
      </woot-button>
 | 
						|
    </woot-dropdown-item>
 | 
						|
    <woot-dropdown-divider />
 | 
						|
  </woot-dropdown-menu>
 | 
						|
</template>
 | 
						|
 | 
						|
<script>
 | 
						|
import { mapGetters } from 'vuex';
 | 
						|
import { mixin as clickaway } from 'vue-clickaway';
 | 
						|
import WootDropdownItem from 'shared/components/ui/dropdown/DropdownItem';
 | 
						|
import WootDropdownMenu from 'shared/components/ui/dropdown/DropdownMenu';
 | 
						|
import WootDropdownHeader from 'shared/components/ui/dropdown/DropdownHeader';
 | 
						|
import WootDropdownDivider from 'shared/components/ui/dropdown/DropdownDivider';
 | 
						|
import AvailabilityStatusBadge from '../widgets/conversation/AvailabilityStatusBadge';
 | 
						|
 | 
						|
const AVAILABILITY_STATUS_KEYS = ['online', 'busy', 'offline'];
 | 
						|
 | 
						|
export default {
 | 
						|
  components: {
 | 
						|
    WootDropdownHeader,
 | 
						|
    WootDropdownDivider,
 | 
						|
    WootDropdownMenu,
 | 
						|
    WootDropdownItem,
 | 
						|
    AvailabilityStatusBadge,
 | 
						|
  },
 | 
						|
 | 
						|
  mixins: [clickaway],
 | 
						|
 | 
						|
  data() {
 | 
						|
    return {
 | 
						|
      isStatusMenuOpened: false,
 | 
						|
      isUpdating: false,
 | 
						|
    };
 | 
						|
  },
 | 
						|
 | 
						|
  computed: {
 | 
						|
    ...mapGetters({
 | 
						|
      getCurrentUserAvailability: 'getCurrentUserAvailability',
 | 
						|
      getCurrentAccountId: 'getCurrentAccountId',
 | 
						|
    }),
 | 
						|
    availabilityDisplayLabel() {
 | 
						|
      const availabilityIndex = AVAILABILITY_STATUS_KEYS.findIndex(
 | 
						|
        key => key === this.currentUserAvailability
 | 
						|
      );
 | 
						|
      return this.$t('PROFILE_SETTINGS.FORM.AVAILABILITY.STATUSES_LIST')[
 | 
						|
        availabilityIndex
 | 
						|
      ];
 | 
						|
    },
 | 
						|
    currentAccountId() {
 | 
						|
      return this.getCurrentAccountId;
 | 
						|
    },
 | 
						|
    currentUserAvailability() {
 | 
						|
      return this.getCurrentUserAvailability;
 | 
						|
    },
 | 
						|
    availabilityStatuses() {
 | 
						|
      return this.$t('PROFILE_SETTINGS.FORM.AVAILABILITY.STATUSES_LIST').map(
 | 
						|
        (statusLabel, index) => ({
 | 
						|
          label: statusLabel,
 | 
						|
          value: AVAILABILITY_STATUS_KEYS[index],
 | 
						|
          disabled:
 | 
						|
            this.currentUserAvailability === AVAILABILITY_STATUS_KEYS[index],
 | 
						|
        })
 | 
						|
      );
 | 
						|
    },
 | 
						|
  },
 | 
						|
 | 
						|
  methods: {
 | 
						|
    openStatusMenu() {
 | 
						|
      this.isStatusMenuOpened = true;
 | 
						|
    },
 | 
						|
    closeStatusMenu() {
 | 
						|
      this.isStatusMenuOpened = false;
 | 
						|
    },
 | 
						|
    changeAvailabilityStatus(availability) {
 | 
						|
      const accountId = this.currentAccountId;
 | 
						|
      if (this.isUpdating) {
 | 
						|
        return;
 | 
						|
      }
 | 
						|
 | 
						|
      this.isUpdating = true;
 | 
						|
      this.$store
 | 
						|
        .dispatch('updateAvailability', {
 | 
						|
          availability: availability,
 | 
						|
          account_id: accountId,
 | 
						|
        })
 | 
						|
        .finally(() => {
 | 
						|
          this.isUpdating = false;
 | 
						|
        });
 | 
						|
    },
 | 
						|
  },
 | 
						|
};
 | 
						|
</script>
 | 
						|
 | 
						|
<style lang="scss">
 | 
						|
@import '~dashboard/assets/scss/variables';
 | 
						|
 | 
						|
.status {
 | 
						|
  display: flex;
 | 
						|
  flex-direction: row;
 | 
						|
  align-items: center;
 | 
						|
  justify-content: space-between;
 | 
						|
  padding: var(--space-micro) var(--space-smaller);
 | 
						|
}
 | 
						|
 | 
						|
.status-view {
 | 
						|
  display: flex;
 | 
						|
  align-items: baseline;
 | 
						|
 | 
						|
  & &--title {
 | 
						|
    color: var(--b-600);
 | 
						|
    font-size: var(--font-size-small);
 | 
						|
    font-weight: var(--font-weight-medium);
 | 
						|
    margin-left: var(--space-small);
 | 
						|
 | 
						|
    &:first-letter {
 | 
						|
      text-transform: capitalize;
 | 
						|
    }
 | 
						|
  }
 | 
						|
}
 | 
						|
 | 
						|
.status-change {
 | 
						|
  .dropdown-pane {
 | 
						|
    top: -132px;
 | 
						|
    right: var(--space-normal);
 | 
						|
  }
 | 
						|
 | 
						|
  .status-items {
 | 
						|
    display: flex;
 | 
						|
    align-items: baseline;
 | 
						|
  }
 | 
						|
}
 | 
						|
</style>
 |