Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SF-3029 Hide bottom bar while answering or commenting #2841

Merged
merged 5 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core';
import { Component, EventEmitter, Input, OnInit, Output, QueryList, ViewChild, ViewChildren } from '@angular/core';
import { MatDialogRef } from '@angular/material/dialog';
import { translate } from '@ngneat/transloco';
import { VerseRef } from '@sillsdev/scripture';
Expand Down Expand Up @@ -32,8 +32,8 @@ import { QuestionDialogData } from '../../question-dialog/question-dialog.compon
import { QuestionDialogService } from '../../question-dialog/question-dialog.service';
import { AudioAttachment } from '../checking-audio-player/checking-audio-player.component';
import { CheckingTextComponent } from '../checking-text/checking-text.component';
import { CommentAction } from './checking-comments/checking-comments.component';
import { CheckingInput } from './checking-input-form/checking-input-form.component';
import { CheckingCommentsComponent, CommentAction } from './checking-comments/checking-comments.component';
import { CheckingInput, CheckingInputFormComponent } from './checking-input-form/checking-input-form.component';
import { CheckingQuestionComponent } from './checking-question/checking-question.component';

export interface AnswerAction {
Expand Down Expand Up @@ -81,6 +81,8 @@ enum LikeAnswerResponse {
styleUrls: ['./checking-answers.component.scss']
})
export class CheckingAnswersComponent extends SubscriptionDisposable implements OnInit {
@ViewChild(CheckingInputFormComponent) answerInput?: CheckingInputFormComponent;
@ViewChildren(CheckingCommentsComponent) allComments?: QueryList<CheckingCommentsComponent>;
@ViewChild(CheckingQuestionComponent) questionComponent?: CheckingQuestionComponent;
@Input() projectUserConfigDoc?: SFProjectUserConfigDoc;
@Input() textsByBookId?: TextsByBookId;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core';
import { translate } from '@ngneat/transloco';
import cloneDeep from 'lodash-es/cloneDeep';
import sortBy from 'lodash-es/sortBy';
Expand All @@ -14,6 +14,7 @@ import { UserService } from 'xforge-common/user.service';
import { QuestionDoc } from '../../../../core/models/question-doc';
import { SFProjectUserConfigDoc } from '../../../../core/models/sf-project-user-config-doc';
import { AudioAttachment } from '../../checking-audio-player/checking-audio-player.component';
import { CheckingInputFormComponent } from '../checking-input-form/checking-input-form.component';

export interface CommentAction {
action: 'delete' | 'save' | 'show-form' | 'hide-form' | 'show-comments';
Expand All @@ -29,6 +30,7 @@ export interface CommentAction {
styleUrls: ['./checking-comments.component.scss']
})
export class CheckingCommentsComponent extends SubscriptionDisposable implements OnInit {
@ViewChild(CheckingInputFormComponent) inputComponent?: CheckingInputFormComponent;
@Input() project?: SFProjectProfile;
@Input() projectUserConfigDoc?: SFProjectUserConfigDoc;
@Input() questionDoc?: QuestionDoc;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,8 @@ <h2 matSubheader>{{ t("filter_questions") }}</h2>
</as-split>
</div>
</div>
@if (projectDoc) {
<div id="question-nav">
@if (projectDoc && totalVisibleQuestions() > 0) {
<div id="question-nav" [ngClass]="{ hide: (textHasFocus && isScreenSmall) || showScriptureAudioPlayer }">
@if (!isQuestionListPermanent) {
<button mat-button type="button" (click)="setQuestionsOverlayVisibility(true)">
{{ t("view_questions") }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,10 @@ header {
margin-bottom: -10px;
margin-inline: -10px;
}

&.hide {
display: none;
}
}

#project-summary {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1074,6 +1074,12 @@ export class CheckingComponent extends DataLoadingComponent implements OnInit, A
}
}

get textHasFocus(): boolean {
const isAnswering = this.answersPanel?.answerInput != null;
const isCommenting = this.answersPanel?.allComments?.find(c => c.inputComponent != null) != null;
return isAnswering || isCommenting;
}

/**
* Retrieves the adjacent question based on the active question and the direction.
* Adjacent question might be outside the current filtered scope.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ export class DonutChartComponent extends SubscriptionDisposable implements After
this.oldData = this._data;
}
this._data = value;
this.constructSegments();
}
}

Expand Down
Loading