Skip to content

Commit

Permalink
feat(new autocomplete): make aiMessage completely hidden after transi…
Browse files Browse the repository at this point in the history
…tion ends
  • Loading branch information
yonadavGit committed Mar 27, 2024
1 parent 177d8ec commit eb2b5f0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
4 changes: 3 additions & 1 deletion static/css/s2.css
Original file line number Diff line number Diff line change
Expand Up @@ -2132,11 +2132,13 @@ div.interfaceLinks-row a {
z-index: 1;
position: absolute;
opacity: 0;
transition: opacity 2s ease;
visibility: hidden;
transition: opacity 2s ease, visibility 0s 2s;
}

.ai-message.visible {
opacity: 1;
visibility: visible;
transition: opacity 0.5s ease;
}

Expand Down
11 changes: 6 additions & 5 deletions static/js/Misc.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -1509,12 +1509,13 @@ const ToolTipped = ({ altText, classes, style, onClick, children }) => {
)};

const AiInfoTooltip = () => {
const [showMessage, setShowMessage] = useState(false);
const [mouseOnIcon, setMouseOnIcon] = useState(false);
const [mouseOnMessage, setMouseOnMessage] = useState(false);
const aiInfoIcon = (
<img className="ai-info-icon" src="/static/icons/ai-info.svg" alt="AI Info Icon"/>
<img className="ai-info-icon" src="/static/icons/ai-info.svg" alt="AI Info Icon" onMouseEnter={() => setMouseOnIcon(true)} onMouseLeave={() => setMouseOnIcon(false)}/>
);
const aiMessage = (
<div className="ai-info-messages-box">
<div className="ai-info-messages-box" onMouseEnter={() => setMouseOnMessage(true)} onMouseLeave={() => setMouseOnMessage(false)}>
<div className="ai-info-first-message">
<InterfaceText>
<EnglishText>Some of the text on this page has been AI generated and reviewed by our editors. <a href={"/sheets/541399?lang=en"}>Learn more.</a></EnglishText>
Expand All @@ -1532,9 +1533,9 @@ const AiInfoTooltip = () => {
</div>
);
return (
<div className="ai-info-tooltip" onMouseEnter={() => setShowMessage(true)} onMouseLeave={() => setShowMessage(false)}>
<div className="ai-info-tooltip">
{aiInfoIcon}
<div className={`ai-message ${showMessage ? 'visible' : ''}`}>
<div className={`ai-message ${(mouseOnIcon || mouseOnMessage) ? 'visible' : ''}`}>
{aiMessage}
</div>
</div>
Expand Down

0 comments on commit eb2b5f0

Please sign in to comment.