2024-05-14 19:16:04 +03:00
|
|
|
import clsx from 'clsx';
|
|
|
|
|
2024-05-20 17:45:37 +03:00
|
|
|
import SelectTree from '@/components/ui/SelectTree';
|
2024-06-26 19:47:31 +03:00
|
|
|
import { useConceptOptions } from '@/context/ConceptOptionsContext';
|
2024-05-20 17:45:37 +03:00
|
|
|
import { HelpTopic, topicParent } from '@/models/miscellaneous';
|
|
|
|
import { prefixes } from '@/utils/constants';
|
|
|
|
import { describeHelpTopic, labelHelpTopic } from '@/utils/labels';
|
2024-05-14 19:16:04 +03:00
|
|
|
|
|
|
|
interface TopicsStaticProps {
|
|
|
|
activeTopic: HelpTopic;
|
|
|
|
onChangeTopic: (newTopic: HelpTopic) => void;
|
|
|
|
}
|
|
|
|
|
2024-05-16 16:05:39 +03:00
|
|
|
function TopicsStatic({ activeTopic, onChangeTopic }: TopicsStaticProps) {
|
2024-05-14 19:16:04 +03:00
|
|
|
const { calculateHeight } = useConceptOptions();
|
|
|
|
return (
|
2024-05-20 17:45:37 +03:00
|
|
|
<SelectTree
|
|
|
|
items={Object.values(HelpTopic).map(item => item as HelpTopic)}
|
|
|
|
value={activeTopic}
|
2024-11-21 15:09:51 +03:00
|
|
|
onChangeValue={onChangeTopic}
|
2024-05-20 17:45:37 +03:00
|
|
|
prefix={prefixes.topic_list}
|
|
|
|
getParent={item => topicParent.get(item) ?? item}
|
|
|
|
getLabel={labelHelpTopic}
|
|
|
|
getDescription={describeHelpTopic}
|
2024-05-14 19:16:04 +03:00
|
|
|
className={clsx(
|
|
|
|
'sticky top-0 left-0',
|
2024-05-29 22:40:23 +03:00
|
|
|
'min-w-[14.5rem] max-w-[14.5rem] sm:min-w-[12.5rem] sm:max-w-[12.5rem] md:min-w-[14.5rem] md:max-w-[14.5rem]',
|
|
|
|
'cc-scroll-y',
|
2024-05-14 19:16:04 +03:00
|
|
|
'self-start',
|
2024-12-12 13:19:12 +03:00
|
|
|
'border-x border-t rounded-none',
|
2024-05-14 19:16:04 +03:00
|
|
|
'clr-controls',
|
|
|
|
'text-xs sm:text-sm',
|
|
|
|
'select-none'
|
|
|
|
)}
|
2024-05-29 22:40:23 +03:00
|
|
|
style={{ maxHeight: calculateHeight('1rem + 2px') }}
|
2024-05-20 17:45:37 +03:00
|
|
|
/>
|
2024-05-14 19:16:04 +03:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
export default TopicsStatic;
|