-
Notifications
You must be signed in to change notification settings - Fork 101
feat(header): reintroduce consolidated <unraid-header> + matched boot logo #2701
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
Open
Eli Bosley (elibosley)
wants to merge
10
commits into
master
Choose a base branch
from
fix/consolidated-header-boot-logo
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
77a609b
Reapply "feat(header): gate consolidated <unraid-header> on Unraid 7.3+"
elibosley 91c7545
fix(header): match boot logo to mounted logo to remove mount jump/flash
elibosley 2a55f39
fix(header): gate consolidated header on Unraid 7.4+ (was 7.3+)
elibosley d5b1ccc
fix(header): remove version gate, always use consolidated header
elibosley a92ad19
fix(header): stretch consolidated header banner to actual box height
elibosley 304c015
fix(header): eliminate boot-logo mount jump + theme-aware boot logo
elibosley c7ae278
fix(header): neutral placeholder color for boot version (no color flash)
elibosley a6bfaca
fix(header): size boot SVGs via attributes to stop pre-CSS reflow
elibosley 020b754
fix(header): inline boot layout styles to kill first-paint reflow
elibosley f9ed842
fix(header): scope boot logo sizing so it doesn't stretch the version…
elibosley File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,6 +29,7 @@ hotssd="60" | |
| maxssd="70" | ||
| power="" | ||
| theme="white" | ||
| headerLogo="" | ||
| locale="" | ||
| raw="" | ||
| rtl="" | ||
|
|
||
114 changes: 108 additions & 6 deletions
114
emhttp/plugins/dynamix/include/DefaultPageLayout/Header.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,109 @@ | ||
| <div id="header" class="<?=$display['banner']?>"> | ||
| <unraid-header-os-version></unraid-header-os-version> | ||
| <? if ($display['usage'] && $themeHelper->isSidebarTheme()): ?> | ||
| <span id='array-usage-sidenav'></span> | ||
| <? endif; ?> | ||
| <?include "$docroot/plugins/dynamix.my.servers/include/myservers2.php"?> | ||
| <?php | ||
| // This webGUI ships a single consolidated header web component (<unraid-header>) | ||
| // that owns the whole header and its responsive layout. | ||
| $headerClass = trim($display['banner'] . ' unraid-consolidated-header'); | ||
| ?> | ||
| <div id="header" class="<?=$headerClass?>"> | ||
| <?php | ||
| require_once "$docroot/plugins/dynamix.my.servers/include/state.php"; | ||
| $headerServerState = new ServerState(); | ||
| ?> | ||
| <script> | ||
| window.LOCALE = <?= json_encode($_SESSION['locale'] ?? 'en_US', JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP) ?>; | ||
| </script> | ||
| <?php | ||
| // The consolidated header owns the array-usage bar for sidebar themes, | ||
| // where the legacy #array-usage-sidenav widget used to be injected. | ||
| $headerShowArrayUsage = ($display['usage'] && $themeHelper->isSidebarTheme()) ? 'true' : 'false'; | ||
| $headerLogoStyle = (($display['headerLogo'] ?? '') === 'theme') ? 'theme' : ''; | ||
| // OS version for the boot version placeholder, so the light-DOM logo+version | ||
| // group matches the mounted logo+version group (mounted shows the same info | ||
| // icon + version) and the logo does not jump on upgrade. | ||
| $headerBootVersion = @parse_ini_file('/etc/unraid-version')['version'] ?? ''; | ||
| // Shared Unraid wordmark path (same as the mounted HeaderLogo). Rendered | ||
| // with the gradient by default, or in currentColor when the theme-adaptive | ||
| // logo option is selected, matching the mounted logo. | ||
| $headerBootLogoPath = 'M146.7,29.47H135l-3,9h-6.49L138.93,0h8l13.41,38.49h-7.09L142.62,6.93l-5.83,16.88h8ZM29.69,0V25.4c0,8.91-5.77,13.64-14.9,13.64S0,34.31,0,25.4V0H6.54V25.4c0,5.17,3.19,7.92,8.25,7.92s8.36-2.75,8.36-7.92V0ZM50.86,12v26.5H44.31V0h6.11l17,26.5V0H74V38.49H67.9ZM171.29,0h6.54V38.49h-6.54Zm51.07,24.69c0,9-5.88,13.8-15.17,13.8H192.67V0H207.3c9.18,0,15.06,4.78,15.06,13.8ZM215.82,13.8c0-5.28-3.3-8.14-8.52-8.14h-8.08V32.77h8c5.33,0,8.63-2.8,8.63-8.08ZM108.31,23.92c4.34-1.6,6.93-5.28,6.93-11.55C115.24,3.68,110.18,0,102.48,0H88.84V38.49h6.55V5.66h6.87c3.8,0,6.21,1.82,6.21,6.71s-2.41,6.76-6.21,6.76H98.88l9.21,19.36h7.53Z'; | ||
| ?> | ||
| <style> | ||
| /* Light-DOM fallback: paint the logo + version before <unraid-header> | ||
| mounts so the header does not pop in on page load. The mount engine | ||
| calls replaceChildren(), so this markup is discarded on upgrade. To | ||
| avoid a position jump, the boot logo/version are pinned to where the | ||
| mounted logo/version land (measured). Values are in px, not rem, | ||
| because the webgui light DOM roots at 62.5% (1rem = 10px) while the | ||
| mounted component's `.unapi` scope roots at 16px, so rem here would | ||
| render half-size. `padding-top` top-anchors the logo at the mounted | ||
| offset (the logo left inset is shared with #UnraidHeader in | ||
| default-base.css). Only exists pre-mount, so this never affects the | ||
| mounted layout. */ | ||
| #header.unraid-consolidated-header .unraid-header-boot-logo { | ||
| display: flex; | ||
| flex-direction: column; | ||
| align-items: flex-start; | ||
| justify-content: flex-start; | ||
| gap: 13px; /* logo -> version visual gap (measured) */ | ||
| height: 100%; | ||
| padding-top: 12px; /* desktop: mounted logo top offset */ | ||
| } | ||
| /* Scope to the logo link's svg only — a bare `.unraid-header-boot-logo svg` | ||
| descendant selector also matches the version info icon below and would | ||
| stretch it to the logo width. */ | ||
| #header.unraid-consolidated-header .unraid-header-boot-logo a svg { | ||
| display: block; | ||
| width: 14rem; | ||
| max-width: 100%; | ||
| max-height: 3rem; | ||
| height: auto; | ||
| } | ||
| /* Theme-adaptive logo: render the wordmark in the header text color like | ||
| the mounted HeaderLogo, instead of the gradient. */ | ||
| #header.unraid-consolidated-header .unraid-header-boot-logo-theme { | ||
| color: var(--header-text-primary); | ||
| } | ||
| /* Boot version placeholder mirroring the mounted HeaderVersion (info icon | ||
| + version text) so the group height matches and there is no size flash. | ||
| px sizing matches the mounted text-xs / text-sm (12px / 14px). */ | ||
| #header.unraid-consolidated-header .unraid-header-boot-version { | ||
| display: inline-flex; | ||
| align-items: center; | ||
| gap: 4px; | ||
| /* Neutral placeholder gray. The real per-theme secondary color | ||
| (--header-text-secondary: #999 on white/black, #606e7f on | ||
| gray/azure) only exists in the mounted .unapi scope, so a fixed | ||
| mid-gray reads fine on both light and dark header backgrounds and | ||
| makes the swap-in a gentle shift instead of a dark->gray flash. */ | ||
| color: #999; | ||
| font-weight: 600; | ||
| line-height: 1; | ||
| font-size: 12px; | ||
| white-space: nowrap; | ||
| } | ||
| #header.unraid-consolidated-header .unraid-header-boot-version svg { | ||
| width: 12px; | ||
| height: 12px; | ||
| flex-shrink: 0; | ||
| } | ||
| @media (min-width: 30rem) { | ||
| #header.unraid-consolidated-header .unraid-header-boot-logo a svg { | ||
| width: 16rem; | ||
| } | ||
| #header.unraid-consolidated-header .unraid-header-boot-version { | ||
| font-size: 14px; | ||
| } | ||
| } | ||
| /* Below sm the mounted logo sits in the middle grid band, pushed down by | ||
| the full-width uptime/registration strip, so top-anchor it lower to | ||
| match the mounted logo offset there (measured). */ | ||
| @media (max-width: 639.98px) { | ||
| #header.unraid-consolidated-header .unraid-header-boot-logo { | ||
| padding-top: 28px; | ||
| } | ||
| } | ||
| </style> | ||
| <unraid-header | ||
| server="<?= $headerServerState->getServerStateJsonForHtmlAttr() ?>" | ||
| show-array-usage="<?= $headerShowArrayUsage ?>" | ||
| header-logo-style="<?= $headerLogoStyle ?>" | ||
| ><span class="unraid-header-boot-logo" style="display:flex;flex-direction:column;align-items:flex-start;gap:13px;height:100%;text-align:left"><a href="https://unraid.net" target="_blank" rel="noopener" aria-label="Unraid"><?php if ($headerLogoStyle === 'theme'): ?><svg class="unraid-header-boot-logo-theme" xmlns="http://www.w3.org/2000/svg" width="140" height="24.6" viewBox="0 0 222.36 39.04" aria-hidden="true"><path fill="currentColor" d="<?=$headerBootLogoPath?>"/></svg><?php else: ?><svg xmlns="http://www.w3.org/2000/svg" width="140" height="24.6" viewBox="0 0 222.36 39.04" aria-hidden="true"><defs><linearGradient id="unraid-header-boot-logo-gradient" x1="47.53" y1="79.1" x2="170.71" y2="-44.08" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#e32929"/><stop offset="1" stop-color="#ff8d30"/></linearGradient></defs><path fill="url(#unraid-header-boot-logo-gradient)" d="<?=$headerBootLogoPath?>"/></svg><?php endif; ?></a><span class="unraid-header-boot-version" aria-hidden="true" style="display:inline-flex;align-items:center;gap:4px;color:#999;font-weight:600;line-height:1;white-space:nowrap"><svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="currentColor"><path fill-rule="evenodd" d="M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12Zm8.706-1.442c1.146-.573 2.437.463 2.126 1.706l-.709 2.836.042-.02a.75.75 0 0 1 .67 1.34l-.04.022c-1.147.573-2.438-.463-2.127-1.706l.71-2.836-.042.02a.75.75 0 1 1-.671-1.34l.041-.022ZM12 9a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Z" clip-rule="evenodd"/></svg><?= htmlspecialchars($headerBootVersion, ENT_QUOTES) ?></span></span></unraid-header> | ||
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.