Skip to content

Commit

Permalink
🐛 fix: global-nav styles
Browse files Browse the repository at this point in the history
  • Loading branch information
sanoojes committed Sep 9, 2024
1 parent aeec4fa commit 1c667e7
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 14 deletions.
1 change: 1 addition & 0 deletions extension/src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import Main from '@/components/Main';
import { logToConsole } from '@/utils/logUtils';
import { showError } from '@/components/error/ErrorBoundary';
import { getIsGlobalNav } from '@/utils/platformUtils';

async function main() {
try {
Expand Down
13 changes: 8 additions & 5 deletions extension/src/components/Main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,23 @@ import GrainManager from '@/components/grain/GrainManager';
import PlaybarManager from '@/components/playbar/PlaybarManager';
import UnderMainViewManager from '@/components/underMainView/UnderMainViewManager';
import { useLucidStore } from '@/store/useLucidStore';
import ArtworkManager from './artworkManager/ArtworkManager';
import WindowControlsManager from './windowControls/WindowControlsManager';
import ArtworkManager from '@/components/artworkManager/ArtworkManager';
import WindowControlsManager from '@/components/windowControls/WindowControlsManager';
import { manageBackgroundZIndex } from '@/utils/backgroundUtils';
import { replaceIcons } from '@/utils/replaceIcons';
import { usePathManagement } from '@/utils/pathUtils';
import ColorManager from './colors/ColorManager';
import ColorManager from '@/components/colors/ColorManager';
import { checkForGlobalNav } from '@/utils/navUtils';

const Main = () => {
const underMainViewRef = React.useRef<HTMLElement | null>(null);
const [previousPath, setPreviousPath] = React.useState<string | null>(null);
const { pageCategory, setPageCategory } = useLucidStore();
const { pageCategory, setPageCategory, isGlobalNav } = useLucidStore();

usePathManagement();

checkForGlobalNav();

React.useEffect(() => {
const setUnderMainView = () => {
if (document.getElementById('lucid-under-main-view')) {
Expand Down Expand Up @@ -79,7 +82,6 @@ const Main = () => {
<PlaybarManager />
<ArtworkManager />
<UnderMainViewManager />
<WindowControlsManager />
</div>
<div
id='background-container'
Expand All @@ -97,6 +99,7 @@ const Main = () => {
<SettingsManager />
</ModalContextProvider>
</div>
<WindowControlsManager />
</>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type {
BackgroundStyleSettings,
} from '@/types/settingTypes';
import CustomInput from '@/components/ui/CustomInput';
import SettingsCardWrapper from '../SettingsCardWrapper';
import SettingsCardWrapper from '@/components/settings/SettingsCardWrapper';

const BackgroundSettingsSection: React.FC = React.memo(() => {
const {
Expand Down
2 changes: 1 addition & 1 deletion extension/src/components/settings/ui/SettingSection.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import type { SettingSectionProps } from '@/types/settingTypes';
import SettingsCardWrapper from '../SettingsCardWrapper';
import SettingsCardWrapper from '@/components/settings/SettingsCardWrapper';

const SettingSection = ({
title,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
calculateInverseBrowserZoom,
calculateScaledPx,
} from '@/utils/zoomUtils';
import TransparentWindowControl from './TransparentWindowControl';
import TransparentWindowControl from '@/components/windowControls/TransparentWindowControl';
import { setWindowControlsHeight } from '@/utils/windowControlUtils';

const WindowControlsManager = React.memo(() => {
Expand Down Expand Up @@ -44,7 +44,7 @@ const WindowControlsManager = React.memo(() => {
}
}

setTopBarStyles();
setTimeout(setTopBarStyles, 1000);
window.addEventListener('resize', setTopBarStyles);

return () => {
Expand Down
17 changes: 17 additions & 0 deletions extension/src/utils/navUtils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { useLucidStore } from '@/store/useLucidStore';
import React from 'react';

export const setGlobalNav = (value: boolean) => {
const rootElement = document.querySelector('.Root');
if (rootElement) {
rootElement.classList.add(`${value ? 'global-nav' : 'control-nav'}`);
}
};

export const checkForGlobalNav = () => {
const { isGlobalNav } = useLucidStore();

React.useEffect(() => {
setGlobalNav(isGlobalNav);
}, [isGlobalNav]);
};
10 changes: 5 additions & 5 deletions src/theme.js

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions src/user.css
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,15 @@ option {
background-color: var(--spice-card) !important;
}

/* Main container */
.spotify__container--is-desktop .Root__top-container {
padding-top: calc(48px + var(--panel-gap) * 2);
}

.spotify__container--is-desktop .global-nav .Root__top-container {
padding-top: var(--panel-gap) !important;
}

/* Button styles */
.ap8U6ZVS8BqMxUdinBis
/* ADD: card close button */
Expand Down

0 comments on commit 1c667e7

Please sign in to comment.