Files
mtdb_movie/common/resources/client/admin/appearance/section-list.tsx
maher 703f50a09d
Some checks failed
Build / run (push) Has been cancelled
first commit
2025-10-29 11:42:25 +01:00

37 lines
956 B
TypeScript
Executable File

import {NavLink} from 'react-router-dom';
import {AppearanceButton} from './appearance-button';
import {useAppearanceStore} from './appearance-store';
import {Trans} from '../../i18n/trans';
import {Fragment, useMemo} from 'react';
export function SectionList() {
const sections = useAppearanceStore(s => s.config?.sections);
const sortedSection = useMemo(() => {
if (!sections) return [];
return Object.entries(sections || [])
.map(([key, value]) => {
return {
...value,
key,
};
})
.sort((a, b) => (a?.position || 1) - (b?.position || 1));
}, [sections]);
return (
<Fragment>
{sortedSection.map(section => {
return (
<AppearanceButton
key={section.key}
to={section.key}
elementType={NavLink}
>
<Trans {...section.label} />
</AppearanceButton>
);
})}
</Fragment>
);
}