Compare commits

..

6 Commits

Author SHA1 Message Date
77b429a742 Don't move backward dot tooltip 2025-12-08 23:54:41 +00:00
0c1c56b54a Fix: Prevent false positive single dollar math detection in text nodes
Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
2025-12-08 23:52:36 +00:00
73a139ef9a fix: Fix browser navigation tooltip alignment
Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
2025-12-08 23:42:39 +00:00
5796bc56b5 fix: Adjust default tooltip horizontal position 2025-12-08 23:42:36 +00:00
7c1910c919 fix: Improve nav dot tooltip visibility and positioning
Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
2025-12-08 23:37:10 +00:00
60a4df2efc feat: Add tooltips to browser navigation dots
Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
2025-12-08 23:33:52 +00:00
3 changed files with 54 additions and 4 deletions

View File

@@ -106,7 +106,7 @@ function Article({ cache }) {
if (v.nodeName === '#text') { if (v.nodeName === '#text') {
const text = v.data; const text = v.data;
if (text.includes('\\[') || text.includes('\\(') || text.includes('$$') || text.includes('$')) { if (text.includes('\\[') || text.includes('\\(') || text.includes('$$') || /\$(?:[^$]*[^\s$])\$/.test(text)) {
return <Latex key={key} delimiters={latexDelimiters}>{text}</Latex>; return <Latex key={key} delimiters={latexDelimiters}>{text}</Latex>;
} }

View File

@@ -360,3 +360,33 @@ button.comment {
border-width: 0 2px 2px 0; border-width: 0 2px 2px 0;
transform: rotate(45deg); transform: rotate(45deg);
} }
.tooltip .tooltiptext {
visibility: hidden;
width: 140px;
background-color: #555;
color: #fff;
text-align: center;
border-radius: 6px;
padding: 5px 0;
position: absolute;
z-index: 1;
bottom: 110%;
left: 50%;
margin-left: -70px;
opacity: 0;
transition: opacity 0.2s;
font-size: 0.9rem;
line-height: 1.3;
}
.forwardDot .tooltiptext {
left: auto;
right: 0;
margin-left: 0;
}
.tooltip.show-tooltip .tooltiptext {
visibility: visible;
opacity: 1;
}

View File

@@ -1,4 +1,4 @@
import React from 'react'; import React, { useState } from 'react';
import moment from 'moment'; import moment from 'moment';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
@@ -32,6 +32,8 @@ export const ToggleDot = ({ id, article }) => (
); );
export const BackwardDot = () => { export const BackwardDot = () => {
const [showTooltip, setShowTooltip] = useState(false);
const goBackward = () => { const goBackward = () => {
localStorage.setItem('scrollLock', 'True'); localStorage.setItem('scrollLock', 'True');
window.history.back(); window.history.back();
@@ -42,15 +44,25 @@ export const BackwardDot = () => {
if (!document.fullscreenElement) return null; if (!document.fullscreenElement) return null;
return ( return (
<div className='dot backwardDot' onClick={goBackward}> <div
className={'dot backwardDot tooltip' + (showTooltip ? ' show-tooltip' : '')}
onClick={goBackward}
onMouseEnter={() => setShowTooltip(true)}
onMouseLeave={() => setShowTooltip(false)}
onTouchStart={() => setShowTooltip(true)}
onTouchEnd={() => setShowTooltip(false)}
>
<div className='button'> <div className='button'>
</div> </div>
<span className="tooltiptext">Browser Back</span>
</div> </div>
); );
}; };
export const ForwardDot = () => { export const ForwardDot = () => {
const [showTooltip, setShowTooltip] = useState(false);
const goForward = () => { const goForward = () => {
localStorage.setItem('scrollLock', 'True'); localStorage.setItem('scrollLock', 'True');
window.history.forward(); window.history.forward();
@@ -60,10 +72,18 @@ export const ForwardDot = () => {
if (!isMobile) return null; if (!isMobile) return null;
return ( return (
<div className='dot forwardDot' onClick={goForward}> <div
className={'dot forwardDot tooltip' + (showTooltip ? ' show-tooltip' : '')}
onClick={goForward}
onMouseEnter={() => setShowTooltip(true)}
onMouseLeave={() => setShowTooltip(false)}
onTouchStart={() => setShowTooltip(true)}
onTouchEnd={() => setShowTooltip(false)}
>
<div className='button'> <div className='button'>
</div> </div>
<span className="tooltiptext">Browser Forward</span>
</div> </div>
); );
}; };