feat: Uses expanded layout as default if the breakpoint is less than or equal to 992px (#6134)

* feat: Uses expanded layout as default if the breakpoint is below 992px

* fixes: ES lint issue

* chore: Review fixes

* chore: Hide toggle sidebar menu in profile settings

* chore: Fix login screen

* Update app/javascript/dashboard/components/widgets/conversation/ConversationHeader.vue

Co-authored-by: Shivam Mishra <scm.mymail@gmail.com>

* chore: Review fixes

* chore: Review fixes

Co-authored-by: Shivam Mishra <scm.mymail@gmail.com>
Co-authored-by: Nithin David Thomas <1277421+nithindavid@users.noreply.github.com>
This commit is contained in:
Sivin Varghese
2023-01-09 13:26:31 +05:30
committed by GitHub
parent cbfbe6dbad
commit 4172cb4b23
15 changed files with 134 additions and 85 deletions

View File

@@ -42,7 +42,6 @@ $resolve-button-width: 13.2rem;
margin-right: var(--space-normal); margin-right: var(--space-normal);
min-width: 0; min-width: 0;
.user--profile__meta { .user--profile__meta {
align-items: flex-start; align-items: flex-start;
display: flex; display: flex;
@@ -54,13 +53,17 @@ $resolve-button-width: 13.2rem;
} }
} }
.header-actions-wrap { .header-actions-wrap {
align-items: center; align-items: center;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
flex-grow: 1; flex-grow: 1;
justify-content: flex-end; justify-content: flex-end;
margin-top: var(--space-small);
@include breakpoint(medium up) {
margin-top: 0;
}
&.has-open-sidebar { &.has-open-sidebar {
justify-content: flex-end; justify-content: flex-end;

View File

@@ -324,6 +324,7 @@
var(--space-one); var(--space-one);
.is-text { .is-text {
align-items: center;
display: inline-flex; display: inline-flex;
text-align: start; text-align: start;

View File

@@ -794,30 +794,15 @@ export default {
.conversations-list-wrap { .conversations-list-wrap {
flex-shrink: 0; flex-shrink: 0;
width: 34rem; flex-basis: clamp(32rem, 4vw + 34rem, 44rem);
overflow: hidden; overflow: hidden;
@include breakpoint(large up) {
width: 36rem;
}
@include breakpoint(xlarge up) {
width: 35rem;
}
@include breakpoint(xxlarge up) {
width: 38rem;
}
@include breakpoint(xxxlarge up) {
flex-basis: 46rem;
}
&.hide { &.hide {
display: none; display: none;
} }
&.list--full-width { &.list--full-width {
width: 100%; flex-basis: 100%;
@include breakpoint(xxxlarge up) {
flex-basis: 100%;
}
} }
} }
.filter--actions { .filter--actions {

View File

@@ -233,9 +233,6 @@ export default {
width: 40rem; width: 40rem;
} }
} }
.off-canvas-content.is-open-left {
transform: translateX(18.8rem);
}
.secondary-sidebar { .secondary-sidebar {
overflow-y: auto; overflow-y: auto;

View File

@@ -376,6 +376,10 @@ export default {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
.ProseMirror-menubar {
min-height: var(--space-two) !important;
}
> .ProseMirror { > .ProseMirror {
padding: 0; padding: 0;
word-break: break-word; word-break: break-word;

View File

@@ -166,10 +166,14 @@ export default {
.conversation-sidebar-wrap { .conversation-sidebar-wrap {
height: auto; height: auto;
flex: 0 0; flex: 0 0;
overflow: hidden; z-index: var(--z-index-low);
overflow: auto; overflow: auto;
background: white; background: white;
flex-basis: 28rem; flex-basis: 100%;
@include breakpoint(medium up) {
flex-basis: 28rem;
}
@include breakpoint(large up) { @include breakpoint(large up) {
flex-basis: 30em; flex-basis: 30em;

View File

@@ -1,53 +1,54 @@
<template> <template>
<div class="conv-header"> <div class="conv-header">
<div class="user"> <div class="conversation-header--details">
<back-button v-if="showBackButton" :back-url="backButtonUrl" /> <div class="user">
<Thumbnail <back-button v-if="showBackButton" :back-url="backButtonUrl" />
:src="currentContact.thumbnail" <Thumbnail
size="40px" :src="currentContact.thumbnail"
:badge="inboxBadge" :badge="inboxBadge"
:username="currentContact.name" :username="currentContact.name"
:status="currentContact.availability_status" :status="currentContact.availability_status"
/> />
<div class="user--profile__meta"> <div class="user--profile__meta">
<h3 class="user--name text-truncate"> <h3 class="user--name text-truncate">
<span class="margin-right-smaller">{{ currentContact.name }}</span> <span class="margin-right-smaller">{{ currentContact.name }}</span>
<fluent-icon <fluent-icon
v-if="!isHMACVerified" v-if="!isHMACVerified"
v-tooltip="$t('CONVERSATION.UNVERIFIED_SESSION')" v-tooltip="$t('CONVERSATION.UNVERIFIED_SESSION')"
size="14" size="14"
class="hmac-warning__icon" class="hmac-warning__icon"
icon="warning" icon="warning"
/> />
</h3> </h3>
<div class="conversation--header--actions"> <div class="conversation--header--actions text-truncate">
<inbox-name <inbox-name
v-if="hasMultipleInboxes" v-if="hasMultipleInboxes"
:inbox="inbox" :inbox="inbox"
class="margin-right-small" class="margin-right-small"
/> />
<span <span
v-if="isSnoozed" v-if="isSnoozed"
class="snoozed--display-text margin-right-small" class="snoozed--display-text margin-right-small"
> >
{{ snoozedDisplayText }} {{ snoozedDisplayText }}
</span> </span>
<woot-button <woot-button
class="user--profile__button margin-right-small" class="user--profile__button margin-right-small"
size="small" size="small"
variant="link" variant="link"
@click="$emit('contact-panel-toggle')" @click="$emit('contact-panel-toggle')"
> >
{{ contactPanelToggleText }} {{ contactPanelToggleText }}
</woot-button> </woot-button>
</div>
</div> </div>
</div> </div>
</div> <div
<div class="header-actions-wrap"
class="header-actions-wrap" :class="{ 'has-open-sidebar': isContactPanelOpen }"
:class="{ 'has-open-sidebar': isContactPanelOpen }" >
> <more-actions :conversation-id="currentChat.id" />
<more-actions :conversation-id="currentChat.id" /> </div>
</div> </div>
</div> </div>
</template> </template>
@@ -165,14 +166,27 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.text-truncate { @import '~dashboard/assets/scss/woot';
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.conv-header { .conv-header {
flex: 0 0 var(--space-jumbo); flex: 0 0 var(--space-jumbo);
flex-direction: row;
@include breakpoint(medium up) {
flex-direction: column;
}
}
.conversation-header--details {
display: flex;
justify-content: center;
flex-direction: column;
align-items: center;
width: 100%;
@include breakpoint(medium up) {
flex-direction: row;
}
} }
.option__desc { .option__desc {

View File

@@ -280,6 +280,7 @@ export default {
.message-text--metadata { .message-text--metadata {
align-items: flex-start; align-items: flex-start;
display: flex; display: flex;
margin-left: var(--space-small);
.time { .time {
margin-right: var(--space-small); margin-right: var(--space-small);

View File

@@ -23,5 +23,6 @@ export default {
}, },
DOCS_URL: '//www.chatwoot.com/docs/product/', DOCS_URL: '//www.chatwoot.com/docs/product/',
TESTIMONIAL_URL: 'https://testimonials.cdn.chatwoot.com/content.json', TESTIMONIAL_URL: 'https://testimonials.cdn.chatwoot.com/content.json',
SMALL_SCREEN_BREAKPOINT: 992,
}; };
export const DEFAULT_REDIRECT_URL = '/app/'; export const DEFAULT_REDIRECT_URL = '/app/';

View File

@@ -47,6 +47,7 @@ import AccountSelector from 'dashboard/components/layout/sidebarComponents/Accou
import AddLabelModal from 'dashboard/routes/dashboard/settings/labels/AddLabel'; import AddLabelModal from 'dashboard/routes/dashboard/settings/labels/AddLabel';
import NotificationPanel from 'dashboard/routes/dashboard/notifications/components/NotificationPanel'; import NotificationPanel from 'dashboard/routes/dashboard/notifications/components/NotificationPanel';
import uiSettingsMixin from 'dashboard/mixins/uiSettings'; import uiSettingsMixin from 'dashboard/mixins/uiSettings';
import wootConstants from 'dashboard/constants';
export default { export default {
components: { components: {
@@ -67,6 +68,7 @@ export default {
showAddLabelModal: false, showAddLabelModal: false,
showShortcutModal: false, showShortcutModal: false,
isNotificationPanel: false, isNotificationPanel: false,
isDesktopView: false,
}; };
}, },
computed: { computed: {
@@ -77,14 +79,53 @@ export default {
const { show_secondary_sidebar: showSecondarySidebar } = this.uiSettings; const { show_secondary_sidebar: showSecondarySidebar } = this.uiSettings;
return showSecondarySidebar; return showSecondarySidebar;
}, },
previouslyUsedDisplayType() {
const {
previously_used_conversation_display_type: conversationDisplayType,
} = this.uiSettings;
return conversationDisplayType;
},
},
watch: {
isDesktopView() {
const { LAYOUT_TYPES } = wootConstants;
this.updateUISettings({
conversation_display_type: !this.isDesktopView
? LAYOUT_TYPES.EXPANDED
: this.previouslyUsedDisplayType,
});
},
}, },
mounted() { mounted() {
this.handleResize();
window.addEventListener('resize', this.handleResize);
bus.$on(BUS_EVENTS.TOGGLE_SIDEMENU, this.toggleSidebar); bus.$on(BUS_EVENTS.TOGGLE_SIDEMENU, this.toggleSidebar);
}, },
beforeDestroy() { beforeDestroy() {
window.removeEventListener('resize', this.handleResize);
bus.$off(BUS_EVENTS.TOGGLE_SIDEMENU, this.toggleSidebar); bus.$off(BUS_EVENTS.TOGGLE_SIDEMENU, this.toggleSidebar);
}, },
methods: { methods: {
handleResize() {
const { SMALL_SCREEN_BREAKPOINT } = wootConstants;
let throttled = false;
const delay = 150;
if (throttled) {
return;
}
throttled = true;
setTimeout(() => {
throttled = false;
if (window.innerWidth <= SMALL_SCREEN_BREAKPOINT) {
this.isDesktopView = false;
} else {
this.isDesktopView = true;
}
}, delay);
},
toggleSidebar() { toggleSidebar() {
this.updateUISettings({ this.updateUISettings({
show_secondary_sidebar: !this.isSidebarOpen, show_secondary_sidebar: !this.isSidebarOpen,

View File

@@ -133,7 +133,10 @@ export default {
conversationDisplayType === LAYOUT_TYPES.CONDENSED conversationDisplayType === LAYOUT_TYPES.CONDENSED
? LAYOUT_TYPES.EXPANDED ? LAYOUT_TYPES.EXPANDED
: LAYOUT_TYPES.CONDENSED; : LAYOUT_TYPES.CONDENSED;
this.updateUISettings({ conversation_display_type: newViewType }); this.updateUISettings({
conversation_display_type: newViewType,
previously_used_conversation_display_type: newViewType,
});
}, },
fetchConversationIfUnavailable() { fetchConversationIfUnavailable() {
if (!this.conversationId) { if (!this.conversationId) {

View File

@@ -109,14 +109,7 @@ export default {
flex-shrink: 0; flex-shrink: 0;
overflow: hidden; overflow: hidden;
padding: var(--space-small); padding: var(--space-small);
position: unset;
@include breakpoint(xlarge down) {
position: absolute;
}
@include breakpoint(xlarge up) {
position: unset;
}
&:hover { &:hover {
overflow: auto; overflow: auto;

View File

@@ -13,6 +13,7 @@ export default {
headerTitle: 'PROFILE_SETTINGS.TITLE', headerTitle: 'PROFILE_SETTINGS.TITLE',
icon: 'edit', icon: 'edit',
showNewButton: false, showNewButton: false,
showSidemenuIcon: false,
}, },
children: [ children: [
{ {

View File

@@ -172,6 +172,7 @@ export default {
.selector-name { .selector-name {
align-items: center; align-items: center;
line-height: 1.2;
margin: 0 var(--space-small); margin: 0 var(--space-small);
} }

View File

@@ -4,7 +4,7 @@
<title> <title>
<%= @global_config['INSTALLATION_NAME'] %> <%= @global_config['INSTALLATION_NAME'] %>
</title> </title>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no, user-scalable=0"/>
<% if @global_config['DISPLAY_MANIFEST'] %> <% if @global_config['DISPLAY_MANIFEST'] %>
<meta name="msapplication-TileColor" content="#1f93ff"> <meta name="msapplication-TileColor" content="#1f93ff">
<meta name="msapplication-TileImage" content="/ms-icon-144x144.png"> <meta name="msapplication-TileImage" content="/ms-icon-144x144.png">