Skip to content

Commit

Permalink
[FEAT]Small UI enhancements (#169)
Browse files Browse the repository at this point in the history
* rendering winner response in selected winner frame

* fixed message sending Keys

* small fix in prompt winner frame

* icon text will not break icon on some devices
  • Loading branch information
NeonKirill authored Feb 25, 2025
1 parent ba3bdd2 commit 40d4230
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
2 changes: 2 additions & 0 deletions chat_client/static/css/chat.css
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ body{
line-height: 50px;
user-select: none;
font-size: 13px;
white-space: nowrap;
overflow: hidden;
}


Expand Down
15 changes: 11 additions & 4 deletions chat_client/static/js/builder_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ async function buildUserMessageHTML(userData, cid, messageID, messageText, timeC
*/
const shrinkNickname = (nick) => {
const index = nick.indexOf('_');
return (index !== -1 && index < 8) ? nick.substring(0, index) : nick.substring(0, 8);
return (index !== -1 && index < 7) ? nick.substring(0, index) : nick.substring(0, 7);
}

/**
Expand Down Expand Up @@ -195,12 +195,16 @@ async function buildSubmindHTML(promptID, submindID, submindUserData, submindRes
* Gets winner field HTML based on provided winner
* @return {string} built winner field HTML
* @param nickname of the winner
* @param winner_response
*/
async function buildPromptWinnerHTML(nickname) {
async function buildPromptWinnerHTML(nickname, winner_response) {
return `
<div class="d-flex flex-column align-items-center justify-content-center">
<span class="mt-2">Selected winner</span>
<span class="mt-2 mb-3 font-weight-bold">Selected winner</span>
${await buildPromptParticipantIcon(nickname)}
<div style="max-width: 400px; margin-top: 20px;">
${winner_response}
</div>
</div>
`
}
Expand Down Expand Up @@ -278,7 +282,10 @@ async function buildPromptHTML(prompt) {
});
if (promptData['winner'] === submindUserData['nickname']) {
winnerFound = true;
promptData['winner'] = await buildPromptWinnerHTML(submindUserData['nickname']);
promptData['winner'] = await buildPromptWinnerHTML(
submindUserData['nickname'],
data.proposed_responses['message_text']
);
}
submindsHTML += await buildSubmindHTML(prompt['_id'], submindID, submindUserData,
data.proposed_responses, data.submind_opinions, data.votes);
Expand Down
2 changes: 1 addition & 1 deletion chat_client/static/js/chat_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ async function buildConversation(conversationData, skin, remember=true,conversat
const textInputElem = document.getElementById(conversationData['_id'] + '-input');
if (chatInputButton.hasAttribute('data-target-cid')) {
textInputElem.addEventListener('keyup', async (e)=>{
if (e.shiftKey && e.key === 'Enter'){
if (e.key === 'Enter' && !e.shiftKey){
await sendMessage(textInputElem, conversationData['_id']);
}
});
Expand Down

0 comments on commit 40d4230

Please sign in to comment.