Skip to content

Commit

Permalink
feat: remove support for pre-Library X UI
Browse files Browse the repository at this point in the history
  • Loading branch information
rxri committed Sep 7, 2024
1 parent 35e407d commit 6e250c6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 41 deletions.
29 changes: 2 additions & 27 deletions jsHelper/spicetifyWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -1853,7 +1853,7 @@ Spicetify.ContextMenu = (() => {
let navLinkFactoryCtx = null;
let refreshNavLinks = null;

Spicetify._renderNavLinks = (list, isTouchScreenUi, isPreLibX = false) => {
Spicetify._renderNavLinks = (list, isTouchScreenUi) => {
const [refreshCount, refresh] = Spicetify.React.useReducer((x) => x + 1, 0);
refreshNavLinks = refresh;

Expand All @@ -1866,7 +1866,7 @@ Spicetify._renderNavLinks = (list, isTouchScreenUi, isPreLibX = false) => {
)
return;

const navLinkFactory = isTouchScreenUi ? NavLinkGlobal : isPreLibX ? NavLinkSidebarLegacy : NavLinkSidebar;
const navLinkFactory = isTouchScreenUi ? NavLinkGlobal : NavLinkSidebar;

if (!navLinkFactoryCtx) navLinkFactoryCtx = Spicetify.React.createContext(null);
const registered = [];
Expand Down Expand Up @@ -1951,31 +1951,6 @@ const NavLink = ({ appProper, appRoutePath, icon, activeIcon }) => {
return NavLinkFactory && Spicetify.React.createElement(NavLinkFactory, { appProper, appRoutePath, createIcon, isActive }, null);
};

const NavLinkSidebarLegacy = ({ appProper, appRoutePath, createIcon, isActive }) => {
return Spicetify.React.createElement(
"li",
{ className: "main-navBar-navBarItem InvalidDropTarget" },
Spicetify.React.createElement(
Spicetify.ReactComponent.TooltipWrapper,
{ label: appProper, placement: "right" },
Spicetify.React.createElement(
Spicetify.ReactComponent.Navigation,
{
to: appRoutePath,
referrer: "other",
className: Spicetify.classnames("link-subtle", "main-navBar-navBarLink", {
"main-navBar-navBarLinkActive active": isActive,
}),
onClick: () => undefined,
"aria-label": appProper,
},
createIcon(),
Spicetify.React.createElement(Spicetify.ReactComponent.TextComponent, { variant: "mestoBold" }, appProper)
)
)
);
};

const NavLinkSidebar = ({ appProper, appRoutePath, createIcon, isActive }) => {
const isSidebarCollapsed = Spicetify.Platform.LocalStorageAPI.getItem("ylx-sidebar-state") === 1;

Expand Down
14 changes: 0 additions & 14 deletions src/apply/apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,20 +335,6 @@ func insertNavLink(str string, appNameArray string) string {
1)
}

// pre-Library X
sidebarItemMatch := utils.SeekToCloseParen(
str,
`\("li",\{className:[\w$\.]+\}?,(?:children:)?[\w$\.,()]+\(\w+,\{uri:"spotify:user:@:collection",to:"/collection"`,
'(', ')')

if sidebarItemMatch != "" {
str = strings.Replace(
str,
sidebarItemMatch,
fmt.Sprintf("%s,Spicetify._renderNavLinks([%s], false, true)", sidebarItemMatch, appNameArray),
1)
}

// Global Navbar
utils.ReplaceOnce(&str, `(,[a-zA-Z_\$][\w\$]*===(?:[a-zA-Z_\$][\w\$]*\.){2}HOME_NEXT_TO_NAVIGATION&&.+?)\]`, func(submatches ...string) string {
return fmt.Sprintf("%s,Spicetify._renderNavLinks([%s], true)]", submatches[1], appNameArray)
Expand Down

0 comments on commit 6e250c6

Please sign in to comment.