Skip to content

Commit bdbee43

Browse files
authored
Fix UI Tweaks sidebar project row overflow (ilysenko#1129)
* Cover sidebar project row geometry * Avoid sidebar project row overflow
1 parent c370485 commit bdbee43

4 files changed

Lines changed: 15 additions & 11 deletions

File tree

linux-features/ui-tweaks/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ Tracked default in `feature.json`:
170170
"sidebar": {
171171
"projectName": {
172172
"enabled": true,
173-
"style": "font-weight: 700 !important; padding-top: 0.25rem;"
173+
"style": "font-weight: 700 !important;"
174174
}
175175
}
176176
}
@@ -184,8 +184,8 @@ Config keys:
184184
- `style`: CSS declaration list inserted into the project-name rule, such as
185185
`font-weight: 800 !important; color: red;`. It is not arbitrary CSS; unsafe
186186
syntax that could escape the scoped rule warns and falls back to the default.
187-
The default is `font-weight: 700 !important; padding-top: 0.25rem;`, so
188-
project names are bold with a small top offset and no color is forced.
187+
The default is `font-weight: 700 !important;`, so project names are bold
188+
without changing the fixed row geometry or forcing a color.
189189

190190
## Drift Behavior
191191

linux-features/ui-tweaks/feature.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"sidebar": {
4040
"projectName": {
4141
"enabled": true,
42-
"style": "font-weight: 700 !important; padding-top: 0.25rem;"
42+
"style": "font-weight: 700 !important;"
4343
}
4444
}
4545
}

linux-features/ui-tweaks/patches/sidebar-project-name.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"use strict";
22

3-
const DEFAULT_PROJECT_NAME_STYLE = "font-weight: 700 !important; padding-top: 0.25rem;";
3+
const DEFAULT_PROJECT_NAME_STYLE = "font-weight: 700 !important;";
44
const PROJECTS_SIDEBAR_ASSET_PATTERN =
55
/^app-initial~notebook-preview-panel~app-main~pull-request-route~projects-index-page~cloud-en~lpx9dmpy-[^.]+\.js$/;
66
const PROJECT_NAME_SELECTOR = ".group\\/folder-row .text-fade-truncate.pr-1";

linux-features/ui-tweaks/test.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -504,17 +504,18 @@ test("feature manifest defaults reach descriptor context through the feature loa
504504
const [descriptor] = loadLinuxFeaturePatchDescriptors({ featuresRoot });
505505
const patched = descriptor.apply(projectBundleFixture(), {});
506506

507-
assert.match(patched, /font-weight: 700 !important; padding-top: 0.25rem;/);
507+
assert.match(patched, /font-weight: 700 !important;/);
508+
assert.doesNotMatch(patched, /padding-top/);
508509
} finally {
509510
fs.rmSync(tempDir, { recursive: true, force: true });
510511
}
511512
});
512513

513-
test("default project name style is bold with top padding and no forced color", () => {
514+
test("default project name style is bold without changing fixed row geometry", () => {
514515
const featureJson = JSON.parse(fs.readFileSync(path.join(__dirname, "feature.json"), "utf8"));
515516
assert.equal(featureJson.tweaks.sidebar.projectName.style, DEFAULT_PROJECT_NAME_STYLE);
516517
assert.match(DEFAULT_PROJECT_NAME_STYLE, /font-weight:\s*700\s*!important/);
517-
assert.match(DEFAULT_PROJECT_NAME_STYLE, /padding-top:\s*0\.25rem/);
518+
assert.doesNotMatch(DEFAULT_PROJECT_NAME_STYLE, /(?:padding|margin|height)/i);
518519
assert.doesNotMatch(DEFAULT_PROJECT_NAME_STYLE, /color/i);
519520
assert.doesNotMatch(sidebarProjectNameCss(DEFAULT_PROJECT_NAME_STYLE), /#000|black/i);
520521
});
@@ -573,7 +574,8 @@ test("invalid feature settings warn and fall back to defaults", () => {
573574
const patched = descriptors[0].apply(projectBundleFixture(), {});
574575

575576
assert.match(warnings.join("\n"), /WARN: Linux feature 'ui-tweaks' settings/);
576-
assert.match(patched, /font-weight: 700 !important; padding-top: 0.25rem;/);
577+
assert.match(patched, /font-weight: 700 !important;/);
578+
assert.doesNotMatch(patched, /padding-top/);
577579
} finally {
578580
fs.rmSync(tempDir, { recursive: true, force: true });
579581
}
@@ -638,7 +640,8 @@ test("invalid and empty styles warn and fall back without throwing", () => {
638640
);
639641

640642
assert.match(value, new RegExp(STYLE_ID));
641-
assert.match(value, /font-weight: 700 !important; padding-top: 0.25rem;/);
643+
assert.match(value, /font-weight: 700 !important;/);
644+
assert.doesNotMatch(value, /padding-top/);
642645
assert.equal(warnings.length, 1);
643646
assert.match(warnings[0], /^WARN: ui-tweaks sidebar project name style/);
644647
}
@@ -663,7 +666,8 @@ test("unsafe styles warn, stay scoped, and fall back to the default", () => {
663666
);
664667

665668
assert.match(value, new RegExp(STYLE_ID));
666-
assert.match(value, /font-weight: 700 !important; padding-top: 0.25rem;/);
669+
assert.match(value, /font-weight: 700 !important;/);
670+
assert.doesNotMatch(value, /padding-top/);
667671
assert.doesNotMatch(value, /body\{display:none\}/);
668672
assert.equal(value.includes(unsafeStyle), false);
669673
assert.equal(warnings.length, 1);

0 commit comments

Comments
 (0)