Skip to content

Commit

Permalink
Actualize styles
Browse files Browse the repository at this point in the history
  • Loading branch information
AmsterGet committed Dec 12, 2023
1 parent 0b3ca66 commit 020e425
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 30 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ export const SelectDefectManually = ({
const [commentEditor, setCommentEditor] = useState(null);
const defectFromTIGroup =
itemData.issue && itemData.issue.issueType.startsWith(TO_INVESTIGATE_LOCATOR_PREFIX);
const [llmSuggestLoading, setLllmSuggestLoading] = useState(false);
const [llmSuggestLoading, setLlmSuggestLoading] = useState(false);
const [suggestionApplied, setSuggestionApplied] = useState(false);

const source = modalState.selectManualChoice;

Expand Down Expand Up @@ -118,11 +119,12 @@ export const SelectDefectManually = ({
const suggestedComment = "This defect is not a bug. It's a feature";
const { comment: existingComment } = source.issue;
const comment = existingComment ? `${existingComment}\n${suggestedComment}` : suggestedComment;
setLllmSuggestLoading(true);
setLlmSuggestLoading(true);
// TODO: API request will be here instead of a timeout
setTimeout(() => {
handleDefectCommentChange(comment);
setLllmSuggestLoading(false);
setSuggestionApplied(true);
setLlmSuggestLoading(false);
}, 1000);
};

Expand Down Expand Up @@ -232,25 +234,6 @@ export const SelectDefectManually = ({
isNarrowView={getDefectTypeNarrowView()}
/>
<div className={cx('defect-comment')}>
{extensions.map((extensionComponent) => (
<extensionComponent.component
key={extensionComponent.name}
onChangeComment={handleDefectCommentChange}
comment={source.issue.comment}
/>
))}
<div className={cx('llm-suggestion-control')}>
{llmSuggestLoading ? (
<span className={cx('loader')}>
<BubblesPreloader color="#eabcff" />
</span>
) : (
<button className={cx('ask-ai-button')} onClick={loadLlmSuggestion}>
<span className={cx('ai-icon')}>{Parser(AiIcon)}</span>
Generate with AI
</button>
)}
</div>
<MarkdownEditor
value={
modalState.decisionType === SELECT_DEFECT_MANUALLY
Expand All @@ -268,6 +251,26 @@ export const SelectDefectManually = ({
mode="dark"
controlled
/>
<div className={cx('llm-suggestion-control', { applied: suggestionApplied })}>
{llmSuggestLoading ? (
<span className={cx('loader')}>
<BubblesPreloader color="#eabcff" />
</span>
) : (
<button className={cx('ask-ai-button')} onClick={loadLlmSuggestion}>
<span className={cx('ai-icon')}>{Parser(AiIcon)}</span>
{suggestionApplied ? 'Pasted' : 'Ask AI to generate a comment'}
</button>
)}
</div>
{extensions.map((extensionComponent) => (
<extensionComponent.component
key={extensionComponent.name}
onChangeComment={handleDefectCommentChange}
comment={source.issue.comment}
item={itemData}
/>
))}
</div>
{!debugMode && (
<ActionButtonsBar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,28 @@
}

.llm-suggestion-control {
display: flex;
align-items: center;
justify-content: flex-end;
height: 22px;
margin: 10px 0;
font-size: 13px;
color: #eabcff;

&.applied {
color: #515151;
path {
fill: #515151;
}
}
}

.ask-ai-button {
display: inline-flex;
align-items: center;
height: 22px;
gap: 8px;
padding: 0;
background: none;
border: none;
color: #eabcff;
color: inherit;
cursor: pointer;

&:hover {
Expand Down Expand Up @@ -82,6 +89,7 @@
//}

.loader {
display: inline-block;
width: 50px;
height: 6px;
}

0 comments on commit 020e425

Please sign in to comment.