Skip to content

Commit

Permalink
chore: simpler fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Benmuiruri committed Aug 30, 2024
1 parent ca4cf74 commit 61b68d6
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 18 deletions.
6 changes: 6 additions & 0 deletions webapp/src/css/inbox.less
Original file line number Diff line number Diff line change
Expand Up @@ -1461,6 +1461,12 @@ mm-search-bar {
#mobile-detection {
display: inline;
}
.mobile-only {
display: initial;
}
.desktop-only {
display: none;
}
.item-content {
padding: 0;
}
Expand Down
9 changes: 7 additions & 2 deletions webapp/src/ts/modules/contacts/contacts.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,13 @@ <h4>
<div class="padding"></div>
</div>

<mm-fast-action-button
[config]="{ button: { type: getFastActionButtonType(), label: 'contact.new_place.button' } }"
<mm-fast-action-button class="mobile-only"
[config]="{ button: { type: buttonType.FAB, label: 'contact.new_place.button' } }"
[fastActions]="fastActionList">
</mm-fast-action-button>

<mm-fast-action-button class="desktop-only"
[config]="{ button: { type: buttonType.FLAT, label: 'contact.new_place.button' } }"
[fastActions]="fastActionList">
</mm-fast-action-button>
</div>
Expand Down
6 changes: 2 additions & 4 deletions webapp/src/ts/modules/contacts/contacts.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { TranslateService } from '@mm-services/translate.service';
import { OLD_REPORTS_FILTER_PERMISSION } from '@mm-modules/reports/reports-filters.component';
import { FastAction, FastActionButtonService } from '@mm-services/fast-action-button.service';
import { PerformanceService } from '@mm-services/performance.service';
import { ButtonType } from '@mm-components/fast-action-button/fast-action-button.component';

@Component({
templateUrl: './contacts.component.html'
Expand All @@ -36,6 +37,7 @@ export class ContactsComponent implements OnInit, AfterViewInit, OnDestroy {
private listContains;
private destroyed?: boolean;
private isOnlineOnly?: boolean;
readonly buttonType = ButtonType;

fastActionList?: FastAction[];
contactsList;
Expand Down Expand Up @@ -517,10 +519,6 @@ export class ContactsComponent implements OnInit, AfterViewInit, OnDestroy {
});
}

getFastActionButtonType() {
return this.fastActionButtonService.getButtonTypeForContentList();
}

exportContacts() {
this.exportService.export('contacts', this.filters, { humanReadable: true });
}
Expand Down
9 changes: 7 additions & 2 deletions webapp/src/ts/modules/messages/messages.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,13 @@ <h4>{{msg.contact || msg.from || ('messages.unknown.sender' | translate)}}</h4>
<div class="loader" *ngIf="loading"></div>
<div class="padding"></div>
</div>
<mm-fast-action-button
[config]="{ button: { type: getFastActionButtonType() } }"
<mm-fast-action-button class="mobile-only"
[config]="{ button: { type: buttonType.FAB } }"
[fastActions]="fastActionList">
</mm-fast-action-button>

<mm-fast-action-button class="desktop-only"
[config]="{ button: { type: buttonType.FLAT } }"
[fastActions]="fastActionList">
</mm-fast-action-button>
</div>
Expand Down
6 changes: 2 additions & 4 deletions webapp/src/ts/modules/messages/messages.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { ResponsiveService } from '@mm-services/responsive.service';
import { FastAction, FastActionButtonService } from '@mm-services/fast-action-button.service';
import { PerformanceService } from '@mm-services/performance.service';
import { ExtractLineageService } from '@mm-services/extract-lineage.service';
import { ButtonType } from '@mm-components/fast-action-button/fast-action-button.component';

@Component({
templateUrl: './messages.component.html'
Expand All @@ -24,6 +25,7 @@ export class MessagesComponent implements OnInit, OnDestroy {
private globalActions: GlobalActions;
private messagesActions: MessagesActions;
private destroyed = false;
readonly buttonType = ButtonType;

subscriptions: Subscription = new Subscription();
fastActionList?: FastAction[];
Expand Down Expand Up @@ -144,10 +146,6 @@ export class MessagesComponent implements OnInit, OnDestroy {
});
}

getFastActionButtonType() {
return this.fastActionButtonService.getButtonTypeForContentList();
}

private openSendMessageModal(modalService:ModalService, event) {
const target = $(event.target).closest('.send-message');

Expand Down
9 changes: 7 additions & 2 deletions webapp/src/ts/modules/reports/reports.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,13 @@ <h4><span>{{ report.heading }}</span></h4>
<div class="padding"></div>
</div>

<mm-fast-action-button
[config]="{ button: { type: getFastActionButtonType(), label: 'report.new_report.button' } }"
<mm-fast-action-button class="mobile-only"
[config]="{ button: { type: buttonType.FAB, label: 'report.new_report.button' } }"
[fastActions]="fastActionList">
</mm-fast-action-button>

<mm-fast-action-button class="desktop-only"
[config]="{ button: { type: buttonType.FLAT, label: 'report.new_report.button' } }"
[fastActions]="fastActionList">
</mm-fast-action-button>
</div>
Expand Down
6 changes: 2 additions & 4 deletions webapp/src/ts/modules/reports/reports.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { FastAction, FastActionButtonService } from '@mm-services/fast-action-bu
import { XmlFormsService } from '@mm-services/xml-forms.service';
import { PerformanceService } from '@mm-services/performance.service';
import { ExtractLineageService } from '@mm-services/extract-lineage.service';
import { ButtonType } from '@mm-components/fast-action-button/fast-action-button.component';

const PAGE_SIZE = 50;
const CAN_DEFAULT_FACILITY_FILTER = 'can_default_facility_filter';
Expand All @@ -42,6 +43,7 @@ export class ReportsComponent implements OnInit, AfterViewInit, OnDestroy {
private isOnlineOnly = false;
private canDefaultFilter = false;
private trackInitialLoadPerformance;
readonly buttonType = ButtonType;

subscription: Subscription = new Subscription();
reportsList;
Expand Down Expand Up @@ -526,8 +528,4 @@ export class ReportsComponent implements OnInit, AfterViewInit, OnDestroy {
const isMaxReportsSelected = this.selectedReports?.length >= this.LIMIT_SELECT_ALL_REPORTS;
return isMaxReportsSelected || this.reportsList?.length === this.selectedReports?.length;
}

getFastActionButtonType() {
return this.fastActionButtonService.getButtonTypeForContentList();
}
}

0 comments on commit 61b68d6

Please sign in to comment.