2021-12-24 16:15:28 +03:00
|
|
|
import { FC } from 'react';
|
2021-12-25 12:31:48 +03:00
|
|
|
import { OrderingDropdown } from '../utils/OrderingDropdown';
|
2021-12-25 12:24:37 +03:00
|
|
|
import { SHORT_URLS_ORDERABLE_FIELDS } from '../short-urls/data';
|
2021-12-24 16:15:28 +03:00
|
|
|
import { SimpleCard } from '../utils/SimpleCard';
|
2022-03-05 21:57:48 +03:00
|
|
|
import { LabeledFormGroup } from '../utils/forms/LabeledFormGroup';
|
2022-03-06 12:58:30 +03:00
|
|
|
import { DEFAULT_SHORT_URLS_ORDERING, Settings, ShortUrlsListSettings as ShortUrlsSettings } from './reducers/settings';
|
2021-12-24 16:15:28 +03:00
|
|
|
|
2022-03-12 22:51:30 +03:00
|
|
|
interface ShortUrlsListSettingsProps {
|
2021-12-24 16:15:28 +03:00
|
|
|
settings: Settings;
|
2021-12-25 12:49:12 +03:00
|
|
|
setShortUrlsListSettings: (settings: ShortUrlsSettings) => void;
|
2021-12-24 16:15:28 +03:00
|
|
|
}
|
|
|
|
|
2022-03-12 22:51:30 +03:00
|
|
|
export const ShortUrlsListSettings: FC<ShortUrlsListSettingsProps> = (
|
2021-12-25 12:49:12 +03:00
|
|
|
{ settings: { shortUrlsList }, setShortUrlsListSettings },
|
|
|
|
) => (
|
2021-12-24 16:15:28 +03:00
|
|
|
<SimpleCard title="Short URLs list" className="h-100">
|
2022-03-05 21:57:48 +03:00
|
|
|
<LabeledFormGroup noMargin label="Default ordering for short URLs list:">
|
|
|
|
<OrderingDropdown
|
|
|
|
items={SHORT_URLS_ORDERABLE_FIELDS}
|
|
|
|
order={shortUrlsList?.defaultOrdering ?? DEFAULT_SHORT_URLS_ORDERING}
|
|
|
|
onChange={(field, dir) => setShortUrlsListSettings({ defaultOrdering: { field, dir } })}
|
|
|
|
/>
|
|
|
|
</LabeledFormGroup>
|
2021-12-24 16:15:28 +03:00
|
|
|
</SimpleCard>
|
|
|
|
);
|