-
Notifications
You must be signed in to change notification settings - Fork 0
Show Title Unlock Criteria on Hover #5
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -59,6 +59,7 @@ h2 { | |||
| width: 100%; | ||||
| flex-grow: 1; | ||||
| overflow-y: auto; | ||||
| overflow-x: visible; | ||||
| border-radius: 8px; | ||||
| background-color: rgba(30, 30, 30, 0.4); /* Slightly darker but still transparent */ | ||||
| border: 1px solid rgba(255, 255, 255, 0.05); | ||||
|
|
@@ -176,6 +177,39 @@ h2 { | |||
| border-radius: 4px; | ||||
| } | ||||
|
|
||||
| /* Title tooltip styles */ | ||||
| .title-with-tooltip { | ||||
| position: relative; | ||||
| cursor: help; | ||||
| } | ||||
|
|
||||
| .title-tooltip { | ||||
| visibility: hidden; | ||||
| opacity: 0; | ||||
| position: fixed; | ||||
| background-color: rgba(20, 20, 20, 0.98); | ||||
| color: #fff; | ||||
| padding: 0.6rem 0.9rem; | ||||
| border-radius: 6px; | ||||
| font-size: 0.85rem; | ||||
| max-width: 280px; | ||||
| text-align: left; | ||||
| z-index: 10000; | ||||
| box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6); | ||||
| border: 1px solid rgba(245, 128, 37, 0.4); | ||||
| pointer-events: none; | ||||
| transition: opacity 0.2s ease, visibility 0.2s ease; | ||||
| line-height: 1.4; | ||||
| white-space: normal; | ||||
| word-wrap: break-word; | ||||
| transform: translateY(8px); | ||||
|
||||
| transform: translateY(8px); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -757,12 +757,52 @@ function ProfileModal({ isOpen, onClose, netid }) { | |
| <div className="title-display static-title"> | ||
| {loadingTitles ? ( | ||
| <span>Loading title...</span> | ||
| ) : displayUser && displayUser.selected_title_id && userTitles.find(t => String(t.id) === String(displayUser.selected_title_id))?.name ? ( | ||
| ) : displayUser && displayUser.selected_title_id && userTitles.find(t => String(t.id) === String(displayUser.selected_title_id)) ? ( | ||
| // Display the equipped title if available | ||
| <span className="displayed-title-name">{userTitles.find(t => String(t.id) === String(displayUser.selected_title_id)).name}</span> | ||
| ) : userTitles.find(t => t.is_equipped)?.name ? ( | ||
| (() => { | ||
| const equippedTitle = userTitles.find(t => String(t.id) === String(displayUser.selected_title_id)); | ||
| return ( | ||
| <span | ||
| className="displayed-title-name title-with-tooltip" | ||
| onMouseEnter={(e) => { | ||
| const tooltip = e.currentTarget.querySelector('.title-tooltip'); | ||
| if (tooltip) { | ||
| const rect = e.currentTarget.getBoundingClientRect(); | ||
| tooltip.style.top = `${rect.bottom + 8}px`; | ||
| tooltip.style.left = `${rect.left}px`; | ||
| } | ||
| }} | ||
|
Comment on lines
+767
to
+774
|
||
| > | ||
| {equippedTitle.name} | ||
| {equippedTitle.description && ( | ||
| <span className="title-tooltip">{equippedTitle.description}</span> | ||
| )} | ||
| </span> | ||
| ); | ||
| })() | ||
|
Comment on lines
+762
to
+782
|
||
| ) : userTitles.find(t => t.is_equipped) ? ( | ||
| // Alternatively check for is_equipped flag from the API response | ||
| <span className="displayed-title-name">{userTitles.find(t => t.is_equipped).name}</span> | ||
| (() => { | ||
| const equippedTitle = userTitles.find(t => t.is_equipped); | ||
| return ( | ||
| <span | ||
| className="displayed-title-name title-with-tooltip" | ||
| onMouseEnter={(e) => { | ||
| const tooltip = e.currentTarget.querySelector('.title-tooltip'); | ||
| if (tooltip) { | ||
| const rect = e.currentTarget.getBoundingClientRect(); | ||
| tooltip.style.top = `${rect.bottom + 8}px`; | ||
| tooltip.style.left = `${rect.left}px`; | ||
| } | ||
| }} | ||
| > | ||
| {equippedTitle.name} | ||
| {equippedTitle.description && ( | ||
| <span className="title-tooltip">{equippedTitle.description}</span> | ||
| )} | ||
| </span> | ||
| ); | ||
| })() | ||
| ) : ( | ||
| // Display message if no title is equipped | ||
| <span className="no-title-display">User has no title selected</span> | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Setting overflow-x to visible while overflow-y is auto (line 61) can cause unexpected behavior in some browsers, as they may force both overflow properties to the same value. Consider using a wrapper element for the tooltip or alternative positioning strategies to avoid potential cross-browser issues.