Skip to content

Commit

Permalink
feat: extract sticky header into own advanced feature toggle
Browse files Browse the repository at this point in the history
  • Loading branch information
Sv443 committed Nov 17, 2024
1 parent 5ca7f83 commit ad61f47
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 1 deletion.
Binary file modified assets/images/logo/logo.pdn
Binary file not shown.
1 change: 1 addition & 0 deletions assets/resources.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"css-above_queue_btns": "style/aboveQueueBtns.css",
"css-above_queue_btns_sticky": "style/aboveQueueBtnsSticky.css",
"css-anchor_improvements": "style/anchorImprovements.css",
"css-auto_like": "style/autoLike.css",
"css-fix_hdr": "style/fixHDR.css",
Expand Down
1 change: 0 additions & 1 deletion assets/style/aboveQueueBtns.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#side-panel ytmusic-tab-renderer ytmusic-queue-header-renderer {
position: sticky;
align-items: center;
top: 0;
z-index: 2;
Expand Down
3 changes: 3 additions & 0 deletions assets/style/aboveQueueBtnsSticky.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#side-panel ytmusic-tab-renderer ytmusic-queue-header-renderer {
position: sticky;
}
19 changes: 19 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
<!-- I messed up with the changelog parsing so this first split marker will just have to be here forever now -->
<div class="split"></div>

<!-- #region 2.2.1 -->
## 2.2.1
- **Changes:**
- The above-queue-button container's sticky positioning can now be turned off with a new advanced feature toggle in the config menu

<!-- <details><summary>Click to expand internal and plugin changes</summary>
- **Internal Changes:**
-
</details> -->

<div class="pr-link-cont">
<a href="https://github.com/Sv443/BetterYTM/pull/121" rel="noopener noreferrer">See pull request for more info</a>
</div>

<div class="split"></div>
<br>

<!-- #region 2.2.0 -->
## 2.2.0
- **Changes:**
Expand Down
4 changes: 4 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ export const migrations: DataMigrationsDict = {
// "autoLikePlayerBarToggleBtn",
]);
},
// 9 -> 10 (v2.2.1)
10: (oldData: FeatureConfig) => useDefaultConfig(oldData, [
"aboveQueueBtnsSticky",
]),
} as const satisfies DataMigrationsDict;

/** Uses the default config as the base, then overwrites all values with the passed {@linkcode baseData}, then sets all passed {@linkcode resetKeys} to their default values */
Expand Down
7 changes: 7 additions & 0 deletions src/features/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,13 @@ export const featInfo = {
default: true,
textAdornment: adornments.reload,
},
aboveQueueBtnsSticky: {
type: "toggle",
category: "songLists",
default: true,
advanced: true,
textAdornment: () => combineAdornments([adornments.advanced, adornments.reload]),
},

//#region cat:behavior
disableBeforeUnloadPopup: {
Expand Down
2 changes: 2 additions & 0 deletions src/features/layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,8 @@ export async function initAboveQueueBtns() {

if(!await addStyleFromResource("css-above_queue_btns"))
error("Couldn't add CSS for above queue buttons");
else if(getFeature("aboveQueueBtnsSticky"))
addStyleFromResource("css-above_queue_btns_sticky");

const contBtns = [
{
Expand Down
2 changes: 2 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,8 @@ export interface FeatureConfig {
rememberSongTimeReduction: number;
/** Minimum time in seconds the song needs to be played before it is remembered */
rememberSongTimeMinPlayTime: number;
/** Whether the above queue button container should use sticky positioning */
aboveQueueBtnsSticky: boolean;

//#region input
/** Arrow keys skip forwards and backwards */
Expand Down

0 comments on commit ad61f47

Please sign in to comment.