Skip to content

Commit

Permalink
Merge pull request #899 from culturecreates/feature/issue-828
Browse files Browse the repository at this point in the history
fix :fixed sidebar navigation issue for calendar switching
  • Loading branch information
AbhishekPAnil authored Jan 15, 2024
2 parents ed0ac7d + 656b5d4 commit 6aeebe3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { MenuOutlined } from '@ant-design/icons';
import ResponsiveSidebar from '../../Sidebar/Responsive';

function NavigationBar(props) {
const { currentCalendarData, allCalendarsData } = props;
const { currentCalendarData, allCalendarsData, pageNumber, setPageNumber } = props;

const [open, setOpen] = useState(false);

Expand All @@ -31,6 +31,8 @@ function NavigationBar(props) {
<ResponsiveSidebar
allCalendarsData={allCalendarsData}
currentCalendarData={currentCalendarData}
pageNumber={pageNumber}
setPageNumber={setPageNumber}
onClose={onClose}
open={open}
/>
Expand Down
8 changes: 5 additions & 3 deletions src/components/Sidebar/Responsive/ResponsiveSidebar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { contentLanguageBilingual } from '../../../utils/bilingual';
import i18n from 'i18next';

function ResponsiveSidebar(props) {
const { allCalendarsData, currentCalendarData, onClose, open } = props;
const { allCalendarsData, currentCalendarData, onClose, open, pageNumber, setPageNumber } = props;
const { t } = useTranslation();
let { calendarId } = useParams();
const navigate = useNavigate();
Expand Down Expand Up @@ -63,11 +63,13 @@ function ResponsiveSidebar(props) {
};

const onSidebarClickHandler = ({ item }) => {
onClose();
navigate(`${PathName.Dashboard}/${calendarId}${item.props.path}`);
};
const logoutHandler = ({ key }) => {
switch (key) {
case 'userProfile':
onClose();
navigate(`${PathName.Dashboard}/${calendarId}${PathName.Profile}/${user?.id}`);
break;
case 'help':
Expand Down Expand Up @@ -95,7 +97,7 @@ function ResponsiveSidebar(props) {
className="sidebar-navigation-menu-responsive-drawer"
title={
<div className="sidebar-calendar-menu-responsive">
<CalendarList allCalendarsData={allCalendarsData}>
<CalendarList pageNumber={pageNumber} setPageNumber={setPageNumber} allCalendarsData={allCalendarsData}>
<Menu
defaultSelectedKeys={['1']}
style={{
Expand Down Expand Up @@ -135,7 +137,7 @@ function ResponsiveSidebar(props) {
itemLayout="horizontal"
dataSource={items}
renderItem={(item) => (
<List.Item onClick={() => logoutHandler(item)}>
<List.Item className="sidebar-footer-item" onClick={() => logoutHandler(item)}>
<List.Item.Meta avatar={item.icon} title={<span>{item.label}</span>} />
</List.Item>
)}
Expand Down
7 changes: 6 additions & 1 deletion src/pages/Dashboard/Dashboard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,12 @@ function Dashboard() {
<ErrorLayout>
<Layout className="dashboard-wrapper">
<Header className="dashboard-header">
<NavigationBar currentCalendarData={currentCalendarData} allCalendarsData={allCalendarsData} />
<NavigationBar
currentCalendarData={currentCalendarData}
allCalendarsData={allCalendarsData}
pageNumber={pageNumber}
setPageNumber={setPageNumber}
/>
</Header>
<Layout>
<Sidebar
Expand Down

0 comments on commit 6aeebe3

Please sign in to comment.