diff --git a/nostr/commit-signatures.jsonl b/nostr/commit-signatures.jsonl index b9ca7c6..61b32e5 100644 --- a/nostr/commit-signatures.jsonl +++ b/nostr/commit-signatures.jsonl @@ -53,3 +53,4 @@ {"kind":1640,"pubkey":"573634b648634cbad10f2451776089ea21090d9407f715e83c577b4611ae6edc","created_at":1771750234,"tags":[["author","Silberengel","silberengel7@protonmail.com"],["message","reformatting design"]],"content":"Signed commit: reformatting design","id":"3d9cac8d0ed3abac1a42c891a2352f21e6bf60c98af7fcac3b1703c5ab965f9f","sig":"d08ea355c001bf0c83eb0ab06e3dcae32a1bad0c565b626167e9c2218372532b2ba11e87f79521cafabc58c8cc5be5d9fb72235aec4dcb9f3f2556c040fc3599"} {"kind":1640,"pubkey":"573634b648634cbad10f2451776089ea21090d9407f715e83c577b4611ae6edc","created_at":1771750596,"tags":[["author","Silberengel","silberengel7@protonmail.com"],["message","fix git folders"]],"content":"Signed commit: fix git folders","id":"3d2475034fdfa5eea36e5caad946460b034a1e4e16b6ba6e3f7fb9b6e1b0a31f","sig":"3eb6e3300081a53434e0f692f0c46618369089bb25047a83138ef3ffd485f749cf817b480f5c8ff0458bb846d04654ba2730ba7d42272739af18a13e8dcb4ed4"} {"kind":1640,"pubkey":"573634b648634cbad10f2451776089ea21090d9407f715e83c577b4611ae6edc","created_at":1771753256,"tags":[["author","Silberengel","silberengel7@protonmail.com"],["message","markup and csv previews in file viewer\ncorrect image view\ncorrect syntax view\nadd copy, raw, and download buttons"]],"content":"Signed commit: markup and csv previews in file viewer\ncorrect image view\ncorrect syntax view\nadd copy, raw, and download buttons","id":"40e64c0a716e0ff594b736db14021e43583d5ff0918c1ec0c4fe2c07ddbdbc73","sig":"bb3a50267214a005104853e9b78dd94e4980024146978baef8612ef0400024032dd620749621f832ee9f0458e582084f12ed9c85a40c306f5bbc92e925198a97"} +{"kind":1640,"pubkey":"573634b648634cbad10f2451776089ea21090d9407f715e83c577b4611ae6edc","created_at":1771754094,"tags":[["author","Silberengel","silberengel7@protonmail.com"],["message","bug-fixes"]],"content":"Signed commit: bug-fixes","id":"146ea5bbc462c4f0188ec4a35a248c2cf518af7088714a4c1ce8e6e35f524e2a","sig":"dfc5d8d9a2f35e1898404d096f6e3e334885cdb0076caab0f3ea3efd1236e53d4172ed2b9ec16cff80ff364898c287ddb400b7a52cb65a3aedc05bb9df0f7ace"} diff --git a/src/lib/components/RepoHeaderEnhanced.svelte b/src/lib/components/RepoHeaderEnhanced.svelte index 21bde52..2ad5965 100644 --- a/src/lib/components/RepoHeaderEnhanced.svelte +++ b/src/lib/components/RepoHeaderEnhanced.svelte @@ -92,34 +92,49 @@ let showBranchMenu = $state(false); let showOwnerMenu = $state(false); let moreMenuElement = $state(null); + let menuButtonElement = $state(null); - // Adjust menu position to prevent overflow on both sides on mobile + // Adjust menu position to prevent overflow on the right side $effect(() => { - if (showMoreMenu && moreMenuElement) { - // Use requestAnimationFrame to ensure DOM is updated + if (showMoreMenu && moreMenuElement && menuButtonElement) { + // Use double requestAnimationFrame to ensure DOM is fully rendered requestAnimationFrame(() => { - if (!moreMenuElement) return; - const rect = moreMenuElement.getBoundingClientRect(); - const viewportWidth = window.innerWidth; - const padding = 10; // Padding from viewport edges - - let transformX = 0; - - // Check if menu overflows on the right - if (rect.right > viewportWidth - padding) { - const overflow = rect.right - (viewportWidth - padding); - transformX = -overflow; - } - - // Check if menu overflows on the left (after right adjustment) - const adjustedLeft = rect.left + transformX; - if (adjustedLeft < padding) { - // Menu would be cut off on the left, shift it right - transformX = padding - rect.left; - } - - moreMenuElement.style.transform = `translateX(${transformX}px)`; + requestAnimationFrame(() => { + if (!moreMenuElement || !menuButtonElement) return; + + const menuRect = moreMenuElement.getBoundingClientRect(); + const buttonRect = menuButtonElement.getBoundingClientRect(); + const viewportWidth = window.innerWidth; + const padding = 16; // Padding from viewport edges + + // Menu is positioned with left: 0, so its left edge aligns with button's left edge + // Calculate where the menu's right edge currently is + const menuWidth = menuRect.width || 280; // Fallback to min-width + const currentLeft = buttonRect.left; + const currentRight = currentLeft + menuWidth; + + let transformX = 0; + + // Check if menu overflows on the right + if (currentRight > viewportWidth - padding) { + // Menu would overflow on the right, shift it left + const rightOverflow = currentRight - (viewportWidth - padding); + transformX = -rightOverflow; + + // Re-check left after adjustment - ensure we don't go off left + const finalLeft = currentLeft + transformX; + if (finalLeft < padding) { + // If we'd go off left, position it at the left edge with padding + transformX = padding - currentLeft; + } + } + + moreMenuElement.style.transform = `translateX(${transformX}px)`; + }); }); + } else if (moreMenuElement) { + // Reset transform when menu closes + moreMenuElement.style.transform = ''; } }); @@ -149,6 +164,7 @@