fixed settings page sorting by list order
This commit was merged in pull request #81.
This commit is contained in:
@@ -4,6 +4,7 @@ import { getSettingsData, getMyProductConfig } from '../../../services/services'
|
||||
import queryKeys from '../../../services/queryKeys';
|
||||
import { useSelector } from 'react-redux';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import sortObjectByListOrder from '../../../helpers/sortObjectByListOrder'
|
||||
|
||||
const Settings = memo(({productData}) => {
|
||||
|
||||
@@ -59,6 +60,8 @@ const Settings = memo(({productData}) => {
|
||||
const settingsData = {data: data?.data?.settings, isFetching, isError, error}
|
||||
// console.log('data', settingsData)
|
||||
|
||||
const sortedSettingsConfig = sortObjectByListOrder(settingsConfig ? settingsConfig : {}) // SORTED SETTINGSCONFIG
|
||||
|
||||
return (
|
||||
<>
|
||||
{configIsFetching ?
|
||||
@@ -79,7 +82,7 @@ const Settings = memo(({productData}) => {
|
||||
<div className="tab tab-vertical">
|
||||
<ul className="nav nav-tabs" role="tablist">
|
||||
<>
|
||||
{Object.entries(settingsConfig).map(([key, value], index) => (
|
||||
{Object.entries(sortedSettingsConfig).map(([key, value], index) => (
|
||||
<li key={key} className="nav-item">
|
||||
<a className={`nav-link ${(activeTab == value.controls || (index == 0 & !activeTab)) && 'active show'}`}
|
||||
id={key}
|
||||
@@ -99,7 +102,7 @@ const Settings = memo(({productData}) => {
|
||||
</ul>
|
||||
<div className="tab-content">
|
||||
<>
|
||||
{Object.entries(settingsConfig).map(([key, value], index) => (
|
||||
{Object.entries(sortedSettingsConfig).map(([key, value], index) => (
|
||||
<div key={key} className={`tab-pane fade ${(activeTab == value.controls || (index == 0 & !activeTab)) && 'active show'}`}
|
||||
// id={value.controls} role="tabpanel"
|
||||
// aria-labelledby={key}
|
||||
@@ -116,4 +119,4 @@ const Settings = memo(({productData}) => {
|
||||
}
|
||||
)
|
||||
|
||||
export default Settings
|
||||
export default Settings
|
||||
Reference in New Issue
Block a user