mirror of
https://git.vectorsigma.ru/public/photoview.git
synced 2026-08-03 21:09:05 +00:00
Updated ui layout.
This commit is contained in:
@@ -1,7 +1,11 @@
|
|||||||
import { gql } from '@apollo/client'
|
import { gql } from '@apollo/client'
|
||||||
import React, { useRef, useState } from 'react'
|
import React, { useRef, useState } from 'react'
|
||||||
import { useMutation, useQuery } from '@apollo/client'
|
import { useMutation, useQuery } from '@apollo/client'
|
||||||
import { InputLabelDescription, InputLabelTitle } from './SettingsPage'
|
import {
|
||||||
|
SectionTitle,
|
||||||
|
InputLabelDescription,
|
||||||
|
InputLabelTitle,
|
||||||
|
} from './SettingsPage'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import { thumbnailMethodQuery } from './__generated__/thumbnailMethodQuery'
|
import { thumbnailMethodQuery } from './__generated__/thumbnailMethodQuery'
|
||||||
import {
|
import {
|
||||||
@@ -60,111 +64,55 @@ const ThumbnailPreferences = () => {
|
|||||||
const methodItems: DropdownItem[] = [
|
const methodItems: DropdownItem[] = [
|
||||||
{
|
{
|
||||||
label: t(
|
label: t(
|
||||||
'settings.thumbnails.downsample_method.nearest_neighbor',
|
'settings.thumbnails.method.filter.nearest_neighbor',
|
||||||
'Nearest Neighbor'
|
'Nearest Neighbor (default)'
|
||||||
),
|
),
|
||||||
value: 0,
|
value: 0,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('settings.thumbnails.downsample_method.box', 'Box'),
|
label: t('settings.thumbnails.method.filter.box', 'Box'),
|
||||||
value: 1,
|
value: 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('settings.thumbnails.downsample_method.linear', 'Linear'),
|
label: t('settings.thumbnails.method.filter.linear', 'Linear'),
|
||||||
value: 2,
|
value: 2,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t(
|
label: t(
|
||||||
'settings.thumbnails.downsample_method.mitchell_netravali',
|
'settings.thumbnails.method.filter.mitchell_netravali',
|
||||||
'Mitchell-Netravali'
|
'Mitchell-Netravali'
|
||||||
),
|
),
|
||||||
value: 3,
|
value: 3,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t(
|
label: t('settings.thumbnails.method.filter.catmull_rom', 'Catmull-Rom'),
|
||||||
'settings.thumbnails.downsample_method.catmull_rom',
|
|
||||||
'Catmull-Rom'
|
|
||||||
),
|
|
||||||
value: 4,
|
value: 4,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('settings.thumbnails.downsample_method.Lanczos', 'Lanczos'),
|
label: t(
|
||||||
|
'settings.thumbnails.method.filter.Lanczos',
|
||||||
|
'Lanczos (highest quality)'
|
||||||
|
),
|
||||||
value: 5,
|
value: 5,
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
// const [enablePeriodicScanner, setEnablePeriodicScanner] = useState(false)
|
|
||||||
// const [thumbnailMethod, setThumbnailMethod] = useState({
|
|
||||||
// value: 0,
|
|
||||||
// unit: TimeUnit.Second,
|
|
||||||
// })
|
|
||||||
//
|
|
||||||
// const scanIntervalServerValue = useRef<number | null>(null)
|
|
||||||
//
|
|
||||||
// const scanIntervalQuery = useQuery<scanIntervalQuery>(SCAN_INTERVAL_QUERY, {
|
|
||||||
// onCompleted(data) {
|
|
||||||
// const queryScanInterval = data.siteInfo.periodicScanInterval
|
|
||||||
//
|
|
||||||
// if (queryScanInterval == 0) {
|
|
||||||
// setScanInterval({
|
|
||||||
// unit: TimeUnit.Second,
|
|
||||||
// value: 0,
|
|
||||||
// })
|
|
||||||
// } else {
|
|
||||||
// setScanInterval(
|
|
||||||
// convertToAppropriateUnit({
|
|
||||||
// unit: TimeUnit.Second,
|
|
||||||
// value: queryScanInterval,
|
|
||||||
// })
|
|
||||||
// )
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// setEnablePeriodicScanner(queryScanInterval > 0)
|
|
||||||
// },
|
|
||||||
// })
|
|
||||||
//
|
|
||||||
// const [setScanIntervalMutation, { loading: scanIntervalMutationLoading }] =
|
|
||||||
// useMutation<
|
|
||||||
// changeScanIntervalMutation,
|
|
||||||
// changeScanIntervalMutationVariables
|
|
||||||
// >(SCAN_INTERVAL_MUTATION)
|
|
||||||
//
|
|
||||||
// const onScanIntervalCheckboxChange = (checked: boolean) => {
|
|
||||||
// setEnablePeriodicScanner(checked)
|
|
||||||
//
|
|
||||||
// onScanIntervalUpdate(
|
|
||||||
// checked ? scanInterval : { value: 0, unit: TimeUnit.Second }
|
|
||||||
// )
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// const onScanIntervalUpdate = (scanInterval: TimeValue) => {
|
|
||||||
// const seconds = convertToSeconds(scanInterval)
|
|
||||||
//
|
|
||||||
// if (scanIntervalServerValue.current != seconds) {
|
|
||||||
// setScanIntervalMutation({
|
|
||||||
// variables: {
|
|
||||||
// interval: seconds,
|
|
||||||
// },
|
|
||||||
// })
|
|
||||||
// scanIntervalServerValue.current = seconds
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<div>
|
||||||
<div className="mt-4">
|
<SectionTitle>
|
||||||
|
{t('settings.thumbnails.title', 'Thumbnail preferences')}
|
||||||
|
</SectionTitle>
|
||||||
<label htmlFor="thumbnail_method_field">
|
<label htmlFor="thumbnail_method_field">
|
||||||
<InputLabelTitle>
|
<InputLabelTitle>
|
||||||
{t('settings.thumbnails.field.label', 'Downsampling method')}
|
{t('settings.thumbnails.method.label', 'Downsampling method')}
|
||||||
</InputLabelTitle>
|
</InputLabelTitle>
|
||||||
<InputLabelDescription>
|
<InputLabelDescription>
|
||||||
{t(
|
{t(
|
||||||
'settings.thumbnails.field.description',
|
'settings.thumbnails.method.description',
|
||||||
'The filter to use when generating thumbnails'
|
'The filter to use when generating thumbnails'
|
||||||
)}
|
)}
|
||||||
</InputLabelDescription>
|
</InputLabelDescription>
|
||||||
</label>
|
</label>
|
||||||
<div className="flex gap-2">
|
|
||||||
<Dropdown
|
<Dropdown
|
||||||
aria-label="Method"
|
aria-label="Method"
|
||||||
items={methodItems}
|
items={methodItems}
|
||||||
@@ -174,19 +122,13 @@ const ThumbnailPreferences = () => {
|
|||||||
updateDownsampleMethod(value)
|
updateDownsampleMethod(value)
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<Loader
|
<Loader
|
||||||
active={downsampleMethodQuery.loading || downsampleMutationData.loading}
|
active={downsampleMethodQuery.loading || downsampleMutationData.loading}
|
||||||
size="small"
|
size="small"
|
||||||
style={{ marginLeft: 16 }}
|
style={{ marginLeft: 16 }}
|
||||||
/>
|
/>
|
||||||
</>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default ThumbnailPreferences
|
export default ThumbnailPreferences
|
||||||
|
|
||||||
// <h3 className="font-semibold text-lg mt-4 mb-2">
|
|
||||||
// {t('settings.thumbnails.title', 'Thumbnail preferences')}
|
|
||||||
// </h3>
|
|
||||||
|
|||||||
Reference in New Issue
Block a user