aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/PropertiesButtons.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2025-04-23 22:02:51 -0400
committerbobzel <zzzman@gmail.com>2025-04-23 22:02:51 -0400
commit0e6d7b45c14301d426f85eeef0a96ab8dceebc25 (patch)
tree5eb67dd31b631189caf6ceb1192088c8e934349a /src/client/views/PropertiesButtons.tsx
parentdb2029602586985b7113fa436851b19746eac673 (diff)
parent78ac87b8acf63079071e5e8805692ed8c30042ce (diff)
Merge branch 'master' into aarav_edit
Diffstat (limited to 'src/client/views/PropertiesButtons.tsx')
-rw-r--r--src/client/views/PropertiesButtons.tsx23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/client/views/PropertiesButtons.tsx b/src/client/views/PropertiesButtons.tsx
index 66936c64c..28566ba1d 100644
--- a/src/client/views/PropertiesButtons.tsx
+++ b/src/client/views/PropertiesButtons.tsx
@@ -385,18 +385,19 @@ export class PropertiesButtons extends React.Component {
const followLoc = this.selectedDoc._followLinkLocation;
const linkedToLightboxView = () => Doc.Links(this.selectedDoc).some(link => Doc.getOppositeAnchor(link, this.selectedDoc)?._isLightbox);
- let active = false;
- // prettier-ignore
- switch (value[0]) {
- case 'linkInPlace': active = linkButton && followLoc === OpenWhere.lightbox && !linkedToLightboxView(); break;
- case 'linkOnRight': active = linkButton && followLoc === OpenWhere.addRight; break;
- case 'enterPortal': active = linkButton && this.selectedDoc._followLinkLocation === OpenWhere.lightbox && linkedToLightboxView(); break;
- case 'toggleDetail':active = ScriptCast(this.selectedDoc.onClick)?.script.originalScript.includes('toggleDetail'); break;
- case 'nothing': active = !linkButton && this.selectedDoc.onClick === undefined;break;
- default:
- }
+ const active = () => {
+ // prettier-ignore
+ switch (value[0]) {
+ case 'linkInPlace': return linkButton && followLoc === OpenWhere.lightbox && !linkedToLightboxView(); break;
+ case 'linkOnRight': return linkButton && followLoc === OpenWhere.addRight; break;
+ case 'enterPortal': return linkButton && this.selectedDoc._followLinkLocation === OpenWhere.lightbox && linkedToLightboxView(); break;
+ case 'toggleDetail':return ScriptCast(this.selectedDoc.onClick)?.script.originalScript.includes('toggleDetail'); break;
+ case 'nothing': return !linkButton && this.selectedDoc.onClick === undefined;break;
+ default: return false;
+ }
+ };
return (
- <div className="list-item" key={`${value}`} style={{ backgroundColor: active ? Colors.LIGHT_BLUE : undefined }} onClick={click}>
+ <div className="list-item" key={`${value}`} style={{ backgroundColor: active() ? Colors.LIGHT_BLUE : undefined }} onClick={click}>
{value[1]}
</div>
);