Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ticket-#597 - Reference Hover #701

Merged
merged 2 commits into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions app/components/Chatbot/ChatEntry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,11 @@ const ReferencePopup = (citation: Citation) => {
const parsed = citation.text?.match(/^###.*?###\s+"""(.*?)"""$/ms)
if (!parsed) return undefined
return (
<div className="reference-contents bordered">
<div className="reference-contents bordered z-index-2">
<ReferenceSummary {...citation} titleClass="large-bold" />
<div className="grey padding-bottom-16 padding-top-32 xs">Referenced excerpt</div>
<div
className="default"
className="default inner-html"
dangerouslySetInnerHTML={{
__html: md.render(parsed[1]),
}}
Expand All @@ -124,12 +124,12 @@ const ReferenceLink = (citation: Citation) => {
if (!index || index > MAX_REFERENCES) return ''

return (
<>
<span className="ref-container">
<Link id={`${id}-ref`} to={`#${id}`} className={`reference-link ref-${index}`}>
<span>{index}</span>
</Link>
<ReferencePopup {...citation} />
</>
</span>
)
}

Expand Down
12 changes: 10 additions & 2 deletions app/components/Chatbot/chat_entry.css
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ article.stampy {
display: inline-block;
text-align: center;
}
.ref-container {
position: relative;
}

.ref-1 {
background: #dbffed;
Expand Down Expand Up @@ -145,15 +148,20 @@ article.stampy {
.reference-contents {
visibility: hidden;
transition: visibility 0.2s;
max-width: 600px;
width: 512px;
word-wrap: break-word;
background-color: white;
border: 1px solid var(--colors-cool-grey-200, #dfe3e9);
padding: var(--spacing-40);
position: absolute;
transform: translateX(50%);
text-decoration: unset;
z-index: 3;
right: 0px;
top: 40px;
}
.reference-contents .inner-html {
height: 275px;
overflow: hidden;
}

.reference-contents:hover,
Expand Down
5 changes: 4 additions & 1 deletion app/components/Chatbot/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,10 @@ const QuestionInput = ({
}

return (
<div className={'widget-ask ' + (fixed ? 'fixed col-10' : 'col-9')} ref={clickDetectorRef}>
<div
className={'widget-ask ' + (fixed ? 'fixed col-10 z-index-4' : 'col-9')}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would z-index-1 suffice? i.e. use the smallest possible value

ref={clickDetectorRef}
>
{results.length > 0 ? (
<Button className="full-width suggestion" action={() => handleAsk(results[0].title)}>
<p className="default">{results[0].title}</p>
Expand Down
Loading