Skip to content

Commit

Permalink
chat: sidebar open by default (fixes #7366) (#7368)
Browse files Browse the repository at this point in the history
Co-authored-by: dogi <[email protected]>
  • Loading branch information
Mutugiii and dogi committed Dec 21, 2023
1 parent acaa91c commit 7722db0
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 19 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "planet",
"license": "AGPL-3.0",
"version": "0.13.94",
"version": "0.13.95",
"myplanet": {
"latest": "v0.12.11",
"min": "v0.11.50"
"latest": "v0.12.20",
"min": "v0.11.60"
},
"scripts": {
"ng": "ng",
Expand Down
4 changes: 2 additions & 2 deletions src/app/chat/chat-sidebar/chat-sidebar.component.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<mat-drawer-container class="sidebar-drawer" autosize>
<mat-drawer #drawer mode="side">
<mat-drawer #drawer mode="side" [opened]="deviceType !== deviceTypes.MOBILE">
<div class="header-container">
<div class="header" i18n>
<button type="button" mat-stroked-button color="primary" class="start-button" mat-button (click)="newChat()">
<button type="button" mat-raised-button color="primary" mat-button (click)="newChat()">
<mat-icon>add</mat-icon> Start New Chat
</button>
<button class="icon-button" mat-icon-button (click)="drawer.toggle()"><i class="material-icons">chevron_left</i></button>
Expand Down
28 changes: 19 additions & 9 deletions src/app/chat/chat-sidebar/chat-sidebar.component.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { Component, OnInit, OnDestroy } from '@angular/core';
import { Component, OnInit, OnDestroy, HostListener } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';

import { ChatService } from '../../shared/chat.service';
import { CouchService } from '../../shared/couchdb.service';
import { DeviceInfoService, DeviceType } from '../../shared/device-info.service';
import { SearchService } from '../../shared/forms/search.service';
import { showFormErrors } from '../../shared/table-helpers';
import { UserService } from '../../shared/user.service';
Expand All @@ -17,29 +18,34 @@ import { UserService } from '../../shared/user.service';
export class ChatSidebarComponent implements OnInit, OnDestroy {
readonly dbName = 'chat_history';
private onDestroy$ = new Subject<void>();
private _titleSearch = '';
get titleSearch(): string { return this._titleSearch.trim(); }
set titleSearch(value: string) {
this._titleSearch = value;
this.recordSearch();
this.filterConversations();
}
conversations: any;
filteredConversations: any;
selectedConversation: any;
isEditing: boolean;
fullTextSearch = false;
searchType: 'questions' | 'responses';
overlayOpen = false;
deviceType: DeviceType;
deviceTypes: typeof DeviceType = DeviceType;
titleForm: { [key: string]: FormGroup } = {};
private _titleSearch = '';
get titleSearch(): string { return this._titleSearch.trim(); }
set titleSearch(value: string) {
this._titleSearch = value;
this.recordSearch();
this.filterConversations();
}

constructor(
private chatService: ChatService,
private couchService: CouchService,
private deviceInfoService: DeviceInfoService,
private formBuilder: FormBuilder,
private searchService: SearchService,
private userService: UserService
) {}
) {
this.deviceType = this.deviceInfoService.getDeviceType();
}

ngOnInit() {
this.titleSearch = '';
Expand All @@ -53,6 +59,10 @@ export class ChatSidebarComponent implements OnInit, OnDestroy {
this.recordSearch(true);
}

@HostListener('window:resize') OnResize() {
this.deviceType = this.deviceInfoService.getDeviceType();
}

subscribeToNewChats() {
this.chatService.newChatAdded$
.pipe(takeUntil(this.onDestroy$))
Expand Down
6 changes: 1 addition & 5 deletions src/app/chat/chat-sidebar/chat-sidebar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,8 @@
.header {
padding: 10px;

.start-button {
border: solid;
margin-right: 0.5rem;
}

.icon-button {
margin-left: 10px;
background-color: $accent;
}
}
Expand Down

0 comments on commit 7722db0

Please sign in to comment.