Files
feishin/src/renderer/features/settings/components/settings-section.tsx
T
Shawn 27a62a2a02 feat(sidebar): multi-level playlist folders with tree and navigation views (#2017)
Group playlists into folders using a configurable separator (default '/').
Three view modes:
- Single: first-level grouping only (original behavior)
- Tree: full recursive nesting with connecting lines (configurable indent and line color)
- Navigation: drill-down view with stacked breadcrumb chain

Folders are sorted before playlists at every level. New settings render as
indented sub-options under the master 'Enable folders' toggle.
2026-05-13 17:07:45 -07:00

47 lines
1.3 KiB
TypeScript

import { ReactNode } from 'react';
import { SettingsOptions } from '/@/renderer/features/settings/components/settings-option';
import { useSettingSearchContext } from '/@/renderer/features/settings/context/search-context';
import { Stack } from '/@/shared/components/stack/stack';
import { TextTitle } from '/@/shared/components/text-title/text-title';
export type SettingOption = {
control: ReactNode;
description: ReactNode | string;
indent?: boolean;
isHidden?: boolean;
note?: string;
title: string;
};
interface SettingsSectionProps {
extra?: ReactNode;
options: SettingOption[];
title?: ReactNode;
}
export const SettingsSection = ({ extra, options, title }: SettingsSectionProps) => {
const keyword = useSettingSearchContext();
const hasKeyword = keyword !== '';
const values = options.filter(
(o) => !o.isHidden && (!hasKeyword || o.title.toLocaleLowerCase().includes(keyword)),
);
return (
<>
{title && (
<TextTitle fw={600} order={4}>
{title}
</TextTitle>
)}
<Stack gap="xl" px="xl">
{values.map((option) => (
<SettingsOptions key={`option-${option.title}`} {...option} />
))}
{extra}
</Stack>
</>
);
};