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';
|
2021-12-25 12:49:12 +03:00
|
|
|
import { DEFAULT_SHORT_URLS_ORDERING, Settings, ShortUrlsListSettings as ShortUrlsSettings } from './reducers/settings';
|
2021-12-24 16:15:28 +03:00
|
|
|
|
|
|
|
interface ShortUrlsListProps {
|
|
|
|
settings: Settings;
|
2021-12-25 12:49:12 +03:00
|
|
|
setShortUrlsListSettings: (settings: ShortUrlsSettings) => void;
|
2021-12-24 16:15:28 +03:00
|
|
|
}
|
|
|
|
|
2021-12-25 12:49:12 +03:00
|
|
|
export const ShortUrlsListSettings: FC<ShortUrlsListProps> = (
|
|
|
|
{ settings: { shortUrlsList }, setShortUrlsListSettings },
|
|
|
|
) => (
|
2021-12-24 16:15:28 +03:00
|
|
|
<SimpleCard title="Short URLs list" className="h-100">
|
2022-03-05 21:43:10 +03:00
|
|
|
<label className="form-label">Default ordering for short URLs list:</label>
|
|
|
|
<OrderingDropdown
|
|
|
|
items={SHORT_URLS_ORDERABLE_FIELDS}
|
|
|
|
order={shortUrlsList?.defaultOrdering ?? DEFAULT_SHORT_URLS_ORDERING}
|
|
|
|
onChange={(field, dir) => setShortUrlsListSettings({ defaultOrdering: { field, dir } })}
|
|
|
|
/>
|
2021-12-24 16:15:28 +03:00
|
|
|
</SimpleCard>
|
|
|
|
);
|