mirror of
https://github.com/Dictionarry-Hub/profilarr.git
synced 2026-01-22 10:51:02 +01:00
refactor: remove tweaks functionality from profile handling (#145)
- removed because I couldn't integrate it nicely with the rest of the application, will keep in the todo pile for later.
This commit is contained in:
@@ -8,17 +8,8 @@ import ProfileGeneralTab from './ProfileGeneralTab';
|
||||
import ProfileScoringTab from './scoring/ProfileScoringTab';
|
||||
import ProfileQualitiesTab from './ProfileQualitiesTab';
|
||||
import ProfileLangaugesTab from './ProfileLangaugesTab';
|
||||
import ProfileTweaksTab from './ProfileTweaksTab';
|
||||
import QUALITIES from '../../constants/qualities';
|
||||
|
||||
const DEFAULT_TWEAKS = {
|
||||
preferFreeleech: true,
|
||||
allowLosslessAudio: true,
|
||||
allowDVNoFallback: false,
|
||||
allowBleedingEdgeCodecs: false,
|
||||
allowPrereleases: false
|
||||
};
|
||||
|
||||
function unsanitize(text) {
|
||||
if (!text) return '';
|
||||
return text.replace(/\\:/g, ':').replace(/\\n/g, '\n');
|
||||
@@ -70,15 +61,11 @@ function ProfileModal({
|
||||
// Language state
|
||||
const [language, setLanguage] = useState('must_english');
|
||||
|
||||
// Tweaks state
|
||||
const [tweaks, setTweaks] = useState(DEFAULT_TWEAKS);
|
||||
|
||||
const tabs = [
|
||||
{id: 'general', label: 'General'},
|
||||
{id: 'scoring', label: 'Scoring'},
|
||||
{id: 'qualities', label: 'Qualities'},
|
||||
{id: 'languages', label: 'Languages'},
|
||||
{id: 'tweaks', label: 'Tweaks'}
|
||||
{id: 'languages', label: 'Languages'}
|
||||
];
|
||||
|
||||
const resetState = () => {
|
||||
@@ -124,7 +111,6 @@ function ProfileModal({
|
||||
|
||||
// Reset other states
|
||||
setLanguage('must_english');
|
||||
setTweaks(DEFAULT_TWEAKS);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
@@ -185,12 +171,6 @@ function ProfileModal({
|
||||
});
|
||||
setTagScores(initialTagScores);
|
||||
|
||||
// Tweaks
|
||||
setTweaks({
|
||||
...DEFAULT_TWEAKS,
|
||||
...(content.tweaks || {})
|
||||
});
|
||||
|
||||
// Qualities setup - include all qualities, set enabled status
|
||||
const allQualitiesMap = {}; // Map of all qualities by id
|
||||
QUALITIES.forEach(quality => {
|
||||
@@ -335,7 +315,6 @@ function ProfileModal({
|
||||
|
||||
// Initialize with defaults
|
||||
setLanguage('must_english');
|
||||
setTweaks(DEFAULT_TWEAKS);
|
||||
}
|
||||
|
||||
setLoading(false);
|
||||
@@ -401,8 +380,7 @@ function ProfileModal({
|
||||
})
|
||||
}
|
||||
: null,
|
||||
language,
|
||||
tweaks
|
||||
language
|
||||
};
|
||||
|
||||
if (isCloning || !initialProfile) {
|
||||
@@ -589,12 +567,6 @@ function ProfileModal({
|
||||
onLanguageChange={setLanguage}
|
||||
/>
|
||||
)}
|
||||
{activeTab === 'tweaks' && (
|
||||
<ProfileTweaksTab
|
||||
tweaks={tweaks}
|
||||
onTweaksChange={setTweaks}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
@@ -638,8 +610,7 @@ ProfileModal.propTypes = {
|
||||
id: PropTypes.number.isRequired,
|
||||
name: PropTypes.string.isRequired
|
||||
}),
|
||||
language: PropTypes.string,
|
||||
tweaks: PropTypes.object
|
||||
language: PropTypes.string
|
||||
})
|
||||
}),
|
||||
isOpen: PropTypes.bool.isRequired,
|
||||
|
||||
@@ -1,179 +0,0 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import {InfoIcon, AlertTriangle} from 'lucide-react';
|
||||
|
||||
const ProfileTweaksTab = ({tweaks, onTweaksChange}) => {
|
||||
const handleTweakChange = key => {
|
||||
onTweaksChange({
|
||||
...tweaks,
|
||||
[key]: !tweaks[key]
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<div className='h-full flex flex-col'>
|
||||
<div className='mt-4 space-y-4'>
|
||||
<div className='flex gap-2 p-3 text-xs bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg'>
|
||||
<InfoIcon className='h-4 w-4 text-blue-600 dark:text-blue-400 flex-shrink-0' />
|
||||
<p className='text-blue-700 dark:text-blue-300'>
|
||||
Tweaks are custom changes that can be toggled according
|
||||
to your preference. These settings are profile-specific
|
||||
and won't create merge conflicts when synchronizing with
|
||||
remote repositories. Use tweaks to fine-tune your
|
||||
profile's behavior without affecting the core
|
||||
configuration.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className='space-y-2'>
|
||||
{/* Allow Dolby Vision without Fallback */}
|
||||
<div
|
||||
onClick={() => handleTweakChange('allowDVNoFallback')}
|
||||
className={`
|
||||
p-4 rounded-lg cursor-pointer select-none
|
||||
border transition-colors duration-200
|
||||
${
|
||||
tweaks.allowDVNoFallback
|
||||
? 'border-blue-200 dark:border-blue-800 bg-blue-50 dark:bg-blue-900/20'
|
||||
: 'border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800'
|
||||
}
|
||||
hover:border-blue-500 dark:hover:border-blue-400
|
||||
`}>
|
||||
<div className='space-y-1'>
|
||||
<h3 className='text-sm font-medium text-gray-900 dark:text-gray-100'>
|
||||
Allow Dolby Vision without Fallback
|
||||
</h3>
|
||||
<p className='text-xs text-gray-500 dark:text-gray-400'>
|
||||
Allow Dolby Vision releases that don't include
|
||||
HDR10 fallback. These may display incorrectly on
|
||||
non-Dolby Vision displays.
|
||||
</p>
|
||||
<div className='flex items-center gap-1.5 mt-2'>
|
||||
<AlertTriangle className='h-3 w-3 text-amber-500' />
|
||||
<p className='text-[10px] text-amber-600 dark:text-amber-400'>
|
||||
Only enable if your display supports Dolby
|
||||
Vision
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Allow Bleeding Edge Codecs */}
|
||||
<div
|
||||
onClick={() =>
|
||||
handleTweakChange('allowBleedingEdgeCodecs')
|
||||
}
|
||||
className={`
|
||||
p-4 rounded-lg cursor-pointer select-none
|
||||
border transition-colors duration-200
|
||||
${
|
||||
tweaks.allowBleedingEdgeCodecs
|
||||
? 'border-blue-200 dark:border-blue-800 bg-blue-50 dark:bg-blue-900/20'
|
||||
: 'border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800'
|
||||
}
|
||||
hover:border-blue-500 dark:hover:border-blue-400
|
||||
`}>
|
||||
<div className='space-y-1'>
|
||||
<h3 className='text-sm font-medium text-gray-900 dark:text-gray-100'>
|
||||
Allow Bleeding Edge Codecs
|
||||
</h3>
|
||||
<p className='text-xs text-gray-500 dark:text-gray-400'>
|
||||
Allow releases using newer codecs like AV1 and
|
||||
H.266/VVC. These may offer better compression
|
||||
but have limited hardware support.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Allow Lossless Audio */}
|
||||
<div
|
||||
onClick={() => handleTweakChange('allowLosslessAudio')}
|
||||
className={`
|
||||
p-4 rounded-lg cursor-pointer select-none
|
||||
border transition-colors duration-200
|
||||
${
|
||||
tweaks.allowLosslessAudio ?? true
|
||||
? 'border-blue-200 dark:border-blue-800 bg-blue-50 dark:bg-blue-900/20'
|
||||
: 'border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800'
|
||||
}
|
||||
hover:border-blue-500 dark:hover:border-blue-400
|
||||
`}>
|
||||
<div className='space-y-1'>
|
||||
<h3 className='text-sm font-medium text-gray-900 dark:text-gray-100'>
|
||||
Allow Lossless Audio
|
||||
</h3>
|
||||
<p className='text-xs text-gray-500 dark:text-gray-400'>
|
||||
Allow high-quality lossless audio formats
|
||||
including TrueHD + Atmos, DTS-HD MA, DTS-X,
|
||||
FLAC, and PCM.
|
||||
</p>
|
||||
<div className='flex items-center gap-1.5 mt-2'>
|
||||
<AlertTriangle className='h-3 w-3 text-amber-500' />
|
||||
<p className='text-[10px] text-amber-600 dark:text-amber-400'>
|
||||
May skip better quality releases if disabled
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Allow Prereleases */}
|
||||
<div
|
||||
onClick={() => handleTweakChange('allowPrereleases')}
|
||||
className={`
|
||||
p-4 rounded-lg cursor-pointer select-none
|
||||
border transition-colors duration-200
|
||||
${
|
||||
tweaks.allowPrereleases
|
||||
? 'border-blue-200 dark:border-blue-800 bg-blue-50 dark:bg-blue-900/20'
|
||||
: 'border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800'
|
||||
}
|
||||
hover:border-blue-500 dark:hover:border-blue-400
|
||||
`}>
|
||||
<div className='space-y-1'>
|
||||
<h3 className='text-sm font-medium text-gray-900 dark:text-gray-100'>
|
||||
Allow Prereleases
|
||||
</h3>
|
||||
<p className='text-xs text-gray-500 dark:text-gray-400'>
|
||||
Allow early releases like CAMs, Telecines,
|
||||
Telesyncs, and Screeners. These are typically
|
||||
available before official releases but at lower
|
||||
quality.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Prefer Freeleech */}
|
||||
<div
|
||||
onClick={() => handleTweakChange('preferFreeleech')}
|
||||
className={`
|
||||
p-4 rounded-lg cursor-pointer select-none
|
||||
border transition-colors duration-200
|
||||
${
|
||||
tweaks.preferFreeleech
|
||||
? 'border-blue-200 dark:border-blue-800 bg-blue-50 dark:bg-blue-900/20'
|
||||
: 'border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800'
|
||||
}
|
||||
hover:border-blue-500 dark:hover:border-blue-400
|
||||
`}>
|
||||
<div className='space-y-1'>
|
||||
<h3 className='text-sm font-medium text-gray-900 dark:text-gray-100'>
|
||||
Prefer Freeleech
|
||||
</h3>
|
||||
<p className='text-xs text-gray-500 dark:text-gray-400'>
|
||||
Prioritize releases tagged as freeleech when
|
||||
choosing between different indexers' releases.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
ProfileTweaksTab.propTypes = {
|
||||
tweaks: PropTypes.object.isRequired,
|
||||
onTweaksChange: PropTypes.func.isRequired
|
||||
};
|
||||
|
||||
export default ProfileTweaksTab;
|
||||
Reference in New Issue
Block a user