-
Notifications
You must be signed in to change notification settings - Fork 153
Add question answers word cloud feature #771
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
Merged
Merged
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
3288e18
feat: add initial tab section for survey page
satyam73 d66d48e
feat: add ask-question-modal component
satyam73 0c03377
feat: create answer reply modal
satyam73 c396356
refactor: make question modal responsive
satyam73 4fb362b
refactor: answer and question modal code
satyam73 5694cd9
merge: develop-ember into feat/question-answers
satyam73 52830dd
Merge branch 'develop-ember' of https://github.com/Real-Dev-Squad/web…
satyam73 f93c94c
feat: added question and answers api
satyam73 0d85c33
feat: add word cloud with api
satyam73 1cad94f
styles: improve styles of survey page
satyam73 6160147
feat: add filter to answers
satyam73 afea8d1
merge: develop-ember into feat/question-answers
satyam73 2d924ac
feat: add min length for answer and handle max_characters null case
satyam73 87bad2d
feat: add wordCloud feature flag
satyam73 9931a71
chore: remove unnecessary code
satyam73 9e9b96a
feat: add toast messages for error cases in approving rejecting answers
satyam73 5c02d53
feat: add word cloud feature flag to word-cloud component
satyam73 89749a9
tests: fix failing tests
satyam73 051bf85
Merge branch 'develop' of https://github.com/Real-Dev-Squad/website-w…
satyam73 f56c4d0
Merge branch 'develop' into feat/question-answers
satyam73 ec815c3
refactor: remove unused code
satyam73 0c284c4
styles: add colors to variables
satyam73 e4a0053
Merge branch 'feat/question-answers' of https://github.com/Real-Dev-S…
satyam73 e498346
Merge branch 'develop' into feat/question-answers
satyam73 5cbe984
fix: eslint no-duplicate-id error
satyam73 caf170e
Merge branch 'develop' into feat/question-answers
satyam73 ddb2efa
Merge branch 'develop' into feat/question-answers
satyam73 3004741
Merge branch 'develop' into feat/question-answers
satyam73 96b3079
Merge branch 'develop' into feat/question-answers
satyam73 efafc34
Merge branch 'develop' into feat/question-answers
satyam73 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| <BaseModal | ||
| @closeModal={{@closeModal}} | ||
| @openModal={{@openModal}} | ||
| @isOpen={{@isOpen}} | ||
| > | ||
| <div class="answer-reply-modal"> | ||
| <h4 class="answer-reply-modal__heading">Host asked you a question😀</h4> | ||
| <form> | ||
| <Reusables::InputBox | ||
| @field={{@questionAsked.question}} | ||
| @name="answer" | ||
| @type="text" | ||
| @placeHolder="Enter your answer" | ||
| @required={{true}} | ||
| @isError={{@validationDetails.isError}} | ||
| @helperText={{@validationDetails.helperText}} | ||
| @variant="input--full-width" | ||
| @value={{@answerValue}} | ||
| @shouldShowHelperText={{@validationDetails.isHelperTextVisible}} | ||
| @onInput={{@inputHandler}} | ||
| /> | ||
| <p class="answer-reply-modal__info-text"> | ||
| <span class="answer-reply-modal__info-icon">¡</span> | ||
| Do not use abusive words, this event is moderated!</p> | ||
| <div class="answer-reply-modal__actions"> | ||
| <Reusables::Button | ||
| @text="Cancel" | ||
| @type="button" | ||
| @variant="dark btn--sm btn-light answer-reply-modal__cancel-button" | ||
| @test="question-modal-cancel" | ||
| @onClick={{@closeModal}} | ||
| /> | ||
| <Reusables::Button | ||
| @type="button" | ||
| @text="Submit" | ||
| @variant="dark btn--sm btn-pink answer-reply-modal__submit-button" | ||
| @test="question-modal-cancel" | ||
| @disabled={{@submitButtonState.isDisabled}} | ||
| @isLoading={{@submitButtonState.isLoading}} | ||
| @onClick={{@onSubmit}} | ||
| /> | ||
| </div> | ||
| </form> | ||
| </div> | ||
|
|
||
| </BaseModal> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| <div | ||
| class="answer-view-card | ||
| {{if this.isApproved 'answer-view-card--approved' ''}} | ||
| {{if this.isPending 'answer-view-card--pending' ''}} | ||
| {{if this.isRejected 'answer-view-card--rejected' ''}} | ||
| " | ||
| > | ||
| <p class="answer-view-card__text"> | ||
| {{this.answerText}} | ||
|
|
||
| {{#if this.isTextMoreThanMaxCharacters}} | ||
| <button | ||
| class="answer-view-card__read-more-button" | ||
| {{on "click" this.toggleReadMore}} | ||
| type="button" | ||
| >{{this.readMoreOrLessText}}</button> | ||
| {{/if}} | ||
| </p> | ||
|
|
||
| <div class="answer-view-card__buttons"> | ||
| <Reusables::IconButton | ||
| @id="reject-button-{{@id}}" | ||
| @class="icon-button--sm icon-button--red-outlined" | ||
| @title="Reject Answer" | ||
| @onClick={{@onReject}} | ||
| @icon="material-symbols:close-small-outline-rounded" | ||
| /> | ||
| <Reusables::IconButton | ||
| @id="approve-button-{{@id}}" | ||
| @class="icon-button--sm icon-button--green" | ||
| @title="Approve Answer" | ||
| @onClick={{@onApprove}} | ||
| @icon="material-symbols:done-rounded" | ||
| /> | ||
| </div> | ||
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| import Component from '@glimmer/component'; | ||
| import { tracked } from '@glimmer/tracking'; | ||
| import { readMoreFormatter } from '../utils/common-utils'; | ||
| import { action } from '@ember/object'; | ||
| import { ANSWER_STATUS } from '../constants/live'; | ||
|
|
||
| const maxCharactersToShow = 70; | ||
| export default class AnswerViewCardComponent extends Component { | ||
| @tracked answerText = readMoreFormatter( | ||
| this.args.answerObject.answer, | ||
| maxCharactersToShow, | ||
| ); | ||
|
|
||
| @tracked isTextMoreThanMaxCharacters = | ||
| this.args.answerObject.answer?.length > maxCharactersToShow; | ||
| @tracked isReadMoreEnabled = false; | ||
| @tracked readMoreOrLessText = this.isReadMoreEnabled ? 'Less' : 'More'; | ||
| @tracked isApproved = | ||
| this.args.answerObject.status === ANSWER_STATUS.APPROVED; | ||
| @tracked isPending = this.args.answerObject.status === ANSWER_STATUS.PENDING; | ||
| @tracked isRejected = | ||
| this.args.answerObject.status === ANSWER_STATUS.REJECTED; | ||
|
|
||
| @action toggleReadMore() { | ||
| this.isReadMoreEnabled = !this.isReadMoreEnabled; | ||
| this.readMoreOrLessText = this.isReadMoreEnabled ? 'Less' : 'More'; | ||
| if (this.isReadMoreEnabled) { | ||
| this.answerText = this.args.answerObject.answer; | ||
| } else { | ||
| this.answerText = readMoreFormatter( | ||
| this.args.answerObject.answer, | ||
| maxCharactersToShow, | ||
| ); | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| <BaseModal | ||
| @closeModal={{@closeModal}} | ||
| @openModal={{@openModal}} | ||
| @isOpen={{@isOpen}} | ||
| > | ||
| <div class="ask-question-modal"> | ||
| <h4 class="ask-question-modal__heading">Ask Question</h4> | ||
| <textarea | ||
| class="ask-question-modal__textarea" | ||
| name="question" | ||
| id="question" | ||
| placeholder="Enter your question here" | ||
| {{on "input" @onInput}} | ||
| value={{@question}} | ||
| ></textarea> | ||
| <div class="ask-question-modal__checkbox-container"> | ||
| <input | ||
| {{on "change" @toggleMaxCharacterChecked}} | ||
| class="ask-question-modal__checkbox" | ||
| type="checkbox" | ||
| name="is-max-characters-checked" | ||
| id="is-max-characters-checked" | ||
| checked={{@isMaxCharactersChecked}} | ||
| /> | ||
| <label | ||
| class="ask-question-modal__checkbox-label" | ||
| for="is-max-characters-checked" | ||
| >Do you want answer to be of limited characters?</label> | ||
| </div> | ||
| <input | ||
| type="number" | ||
| name="max-characters" | ||
| id="max-characters" | ||
| min="1" | ||
| class="ask-question-modal__max-characters-input | ||
| {{if | ||
| @isMaxCharactersChecked | ||
| 'visibility--visible' | ||
| 'visibility--hidden' | ||
| }}" | ||
| value={{@maxCharacters}} | ||
| placeholder="Enter your characters limit" | ||
| {{on "input" @onCharacterLimitInput}} | ||
| /> | ||
| <div class="ask-question-modal__actions"> | ||
| <Reusables::Button | ||
| @text="Cancel" | ||
| @variant="dark btn--sm btn-light ask-question-modal__cancel-button" | ||
| @test="question-modal-cancel" | ||
| @onClick={{@closeModal}} | ||
| /> | ||
| <Reusables::Button | ||
| @text="Submit" | ||
| @variant="dark btn--sm btn-pink ask-question-modal__submit-button" | ||
| @test="question-modal-cancel" | ||
| @onClick={{@onSubmit}} | ||
| @disabled={{(or @isSubmitButtonDisabled @isQuestionApiLoading)}} | ||
| @isLoading={{@isQuestionApiLoading}} | ||
| /> | ||
| </div> | ||
| </div> | ||
| </BaseModal> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| <div class="survey-page"> | ||
| <AskQuestionModal | ||
| @isOpen={{this.isAskQuestionModalOpen}} | ||
| @closeModal={{this.closeAskQuestionModal}} | ||
| @openModal={{this.openAskQuestionModal}} | ||
| @onSubmit={{this.onQuestionSubmit}} | ||
| @toggleMaxCharacterChecked={{this.toggleMaxCharacterChecked}} | ||
| @isMaxCharactersChecked={{this.isMaxCharactersChecked}} | ||
| @maxCharacters={{this.maxCharacters}} | ||
| @onCharacterLimitInput={{this.onCharacterLimitInput}} | ||
| @onInput={{this.onQuestionInput}} | ||
| @isSubmitButtonDisabled={{this.isQuestionSubmitButtonDisabled}} | ||
| @question={{this.question}} | ||
| @isQuestionApiLoading={{this.isQuestionApiLoading}} | ||
| /> | ||
| <div class="survey-page__question-container"> | ||
| <Reusables::Button | ||
| @text="Ask Question" | ||
| @variant="dark btn--sm btn-pink" | ||
| @test="ask-question" | ||
| @onClick={{this.openAskQuestionModal}} | ||
| @disabled={{this.isAskQuestionButtonDisabled}} | ||
| @title={{if | ||
| this.isAskQuestionButtonDisabled | ||
| "This is a host only feature" | ||
| "" | ||
| }} | ||
| /> | ||
| <div class="survey-page__recent-question"> | ||
| <h3 class="survey-page__recent-question-heading">Recent Question</h3> | ||
| <p class="survey-page__recent-question-text">{{(or | ||
| @questionAsked.question "No recent question" | ||
| )}}</p> | ||
| </div> | ||
| </div> | ||
| <div class="survey-page__answers-container"> | ||
| <h2 class="survey-page__answers-heading"> | ||
| Answers | ||
| </h2> | ||
| <div class="survey-page__filter"> | ||
| <label for="answer-status">Filter: </label> | ||
| <select | ||
| name="answer-status" | ||
| id="answer-status" | ||
| {{on "change" this.onAnswerFilterChange}} | ||
| > | ||
| {{#each this.ANSWER_STATUS_FILTERS as |status|}} | ||
| <option value={{status}}>{{status}}</option> | ||
| {{/each}} | ||
| </select> | ||
| </div> | ||
| <div class="survey-page__answers"> | ||
| {{#if this.isAnswersPresent}} | ||
| {{#each this.answers as |answer|}} | ||
| <AnswerViewCard | ||
| @id={{answer.id}} | ||
| @answerObject={{answer}} | ||
| @onReject={{@onAnswerReject}} | ||
| @onApprove={{@onAnswerApprove}} | ||
| /> | ||
| {{/each}} | ||
| {{else}} | ||
| <div>No answers present currently!</div> | ||
| {{/if}} | ||
|
|
||
| </div> | ||
| </div> | ||
| </div> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.