Skip to content

Commit

Permalink
fix: ui and theme
Browse files Browse the repository at this point in the history
  • Loading branch information
aacmal committed Jul 1, 2023
1 parent 7bd585b commit 8e90083
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
9 changes: 5 additions & 4 deletions src/app/ThemeHandler.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

import useSettings from '@stores/settingsStore';
import setTheme from '@utils/theme';
import { usePathname } from 'next/navigation';
import React, { useEffect } from 'react';
import { shallow } from 'zustand/shallow';

type Props = {};

const ThemeHandler = (props: Props) => {
const ThemeHandler = () => {
const pathname = usePathname();
const { theme } = useSettings(
(state) => ({
theme: state.theme,
Expand All @@ -19,7 +19,8 @@ const ThemeHandler = (props: Props) => {
if (theme) {
setTheme(theme);
}
}, [theme]);
// update theme when pathname changes
}, [theme, pathname]);

return <></>;
};
Expand Down
13 changes: 6 additions & 7 deletions src/components/TopBar/TopBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,12 @@
import classNames from 'classnames';
import React, { useEffect } from 'react';

import { getLocalChapter } from '../../utils/chapter';
import DeveloperUtility from './DeveloperUtility/DeveloperUtility';
import DropdownSurahLists from './DropdownSurahLists/DropdownSurahLists';
import useSurah from '../../store/surahStore';
import { shallow } from 'zustand/shallow';
import useQuranReader from '@stores/quranReaderStore';
import {
usePathname,
useSelectedLayoutSegment,
useSelectedLayoutSegments,
} from 'next/navigation';
import { useParams, usePathname } from 'next/navigation';
import DropdownHadithLists from './DropdownHadithLists/DropdownHadithLists';

const TopBar = () => {
Expand All @@ -23,6 +18,7 @@ const TopBar = () => {
shallow
);
const pathname = usePathname();
const params = useParams();

const { currentChapter } = useQuranReader(
(state) => ({
Expand All @@ -31,7 +27,10 @@ const TopBar = () => {
shallow
);

if (chapterData.length === 0 || !pathname.includes('/quran')) return <></>;
const showTopBar =
Object.hasOwn(params, 'chapterId') || Object.hasOwn(params, 'juzId');

if (chapterData.length === 0 || !showTopBar) return <></>;
return (
<div
className={classNames(
Expand Down

1 comment on commit 8e90083

@vercel
Copy link

@vercel vercel bot commented on 8e90083 Jul 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

pustaka-islam – ./

pustakaislam.vercel.app
pustaka-islam-axcamz.vercel.app
pustaka-islam-git-master-axcamz.vercel.app

Please sign in to comment.