Skip to content

Commit

Permalink
minor fix: remove ellipsis function
Browse files Browse the repository at this point in the history
  • Loading branch information
hj940709 committed Apr 29, 2024
1 parent 7fa6632 commit 4f2d276
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 16 deletions.
2 changes: 1 addition & 1 deletion client/components/ChatBot/Chatbot.scss
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
max-width: 30em;
max-width: 15em;
font-size: 1.15rem;
}

Expand Down
12 changes: 4 additions & 8 deletions client/components/ChatBot/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
mcExerciseTouched,
} from 'Utilities/redux/practiceReducer'
import {
cut_and_ellipsis,
formatGreenFeedbackText,
hiddenFeatures
} from 'Utilities/common'
Expand Down Expand Up @@ -224,7 +223,7 @@ const Chatbot = () => {
return (
<div className="chatbot">
<Button onClick={toggleCollapse} className="chatbot-toggle"
style={{background: "mistyrose"}}>
style={{background: "mistyrose", margin: 0}}>
{isCollapsed ?
<Icon name="angle up" size='large' /> :
<Icon name="angle down" size='large' />}
Expand All @@ -234,12 +233,9 @@ const Chatbot = () => {
{/************ current context BANNER = current exercise LEMMA ************/}
<div className="chatbot-context-info">
{validToChat && (
<div className="chatbot-context-item flex space-between">
<div>
{/* make sure the words to display are not too long */
currentWord.choices?.length
? cut_and_ellipsis(currentWord.choices.join('/'),15)
: currentWord.base}
<div className="flex space-between">
<div className="chatbot-context-item">
{currentWord.choices?.length ? currentWord.choices.join('/') : currentWord.base}
</div>
{
/* Display lightbulbs */
Expand Down
7 changes: 0 additions & 7 deletions client/util/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -295,13 +295,6 @@ export const capitalize_first_char_only = word => {
return p1.toUpperCase() + p2
}

// if word is too long: cut it off at N characters, attach ellipsis...
export const cut_and_ellipsis = (word, n) => {
if (word.length < n) return word

const p1 = word.slice(0, n)
return p1 + "..."
}


// coloring difficulty
Expand Down

0 comments on commit 4f2d276

Please sign in to comment.