mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-24 22:35:39 -04:00
New: UI Updates (Backup Restore in App, Profile Cloning)
UI Pulls from Sonarr
This commit is contained in:
@@ -96,43 +96,19 @@ class Naming extends Component {
|
||||
if (examples.singleTrackExample) {
|
||||
standardTrackFormatHelpTexts.push(`Single Track: ${examples.singleTrackExample}`);
|
||||
} else {
|
||||
standardTrackFormatErrors.push('Single Track: Invalid Format');
|
||||
standardTrackFormatErrors.push({ message: 'Single Track: Invalid Format' });
|
||||
}
|
||||
|
||||
// if (examples.multiEpisodeExample) {
|
||||
// standardTrackFormatHelpTexts.push(`Multi Episode: ${examples.multiEpisodeExample}`);
|
||||
// } else {
|
||||
// standardTrackFormatErrors.push('Multi Episode: Invalid Format');
|
||||
// }
|
||||
|
||||
// if (examples.dailyEpisodeExample) {
|
||||
// dailyEpisodeFormatHelpTexts.push(`Example: ${examples.dailyEpisodeExample}`);
|
||||
// } else {
|
||||
// dailyEpisodeFormatErrors.push('Invalid Format');
|
||||
// }
|
||||
|
||||
// if (examples.animeEpisodeExample) {
|
||||
// animeEpisodeFormatHelpTexts.push(`Single Episode: ${examples.animeEpisodeExample}`);
|
||||
// } else {
|
||||
// animeEpisodeFormatErrors.push('Single Episode: Invalid Format');
|
||||
// }
|
||||
|
||||
// if (examples.animeMultiEpisodeExample) {
|
||||
// animeEpisodeFormatHelpTexts.push(`Multi Episode: ${examples.animeMultiEpisodeExample}`);
|
||||
// } else {
|
||||
// animeEpisodeFormatErrors.push('Multi Episode: Invalid Format');
|
||||
// }
|
||||
|
||||
if (examples.artistFolderExample) {
|
||||
artistFolderFormatHelpTexts.push(`Example: ${examples.artistFolderExample}`);
|
||||
} else {
|
||||
artistFolderFormatErrors.push('Invalid Format');
|
||||
artistFolderFormatErrors.push({ message: 'Invalid Format' });
|
||||
}
|
||||
|
||||
if (examples.albumFolderExample) {
|
||||
albumFolderFormatHelpTexts.push(`Example: ${examples.albumFolderExample}`);
|
||||
} else {
|
||||
albumFolderFormatErrors.push('Invalid Format');
|
||||
albumFolderFormatErrors.push({ message: 'Invalid Format' });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,9 @@ class NamingModal extends Component {
|
||||
constructor(props, context) {
|
||||
super(props, context);
|
||||
|
||||
this._selectionStart = null;
|
||||
this._selectionEnd = null;
|
||||
|
||||
this.state = {
|
||||
case: 'title'
|
||||
};
|
||||
@@ -33,6 +36,40 @@ class NamingModal extends Component {
|
||||
this.setState({ case: event.value });
|
||||
}
|
||||
|
||||
onInputSelectionChange = (selectionStart, selectionEnd) => {
|
||||
this._selectionStart = selectionStart;
|
||||
this._selectionEnd = selectionEnd;
|
||||
}
|
||||
|
||||
onOptionPress = ({ isFullFilename, tokenValue }) => {
|
||||
const {
|
||||
name,
|
||||
value,
|
||||
onInputChange
|
||||
} = this.props;
|
||||
|
||||
const selectionStart = this._selectionStart;
|
||||
const selectionEnd = this._selectionEnd;
|
||||
|
||||
if (isFullFilename) {
|
||||
onInputChange({ name, value: tokenValue });
|
||||
} else if (selectionStart == null) {
|
||||
onInputChange({
|
||||
name,
|
||||
value: `${value}${tokenValue}`
|
||||
});
|
||||
} else {
|
||||
const start = value.substring(0, selectionStart);
|
||||
const end = value.substring(selectionEnd);
|
||||
const newValue = `${start}${tokenValue}${end}`;
|
||||
|
||||
onInputChange({ name, value: newValue });
|
||||
this._selectionStart = newValue.length - 1;
|
||||
this._selectionEnd = newValue.length - 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Render
|
||||
|
||||
@@ -188,7 +225,7 @@ class NamingModal extends Component {
|
||||
isFullFilename={true}
|
||||
tokenCase={this.state.case}
|
||||
size={sizes.LARGE}
|
||||
onInputChange={onInputChange}
|
||||
onPress={this.onOptionPress}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -210,7 +247,7 @@ class NamingModal extends Component {
|
||||
token={token}
|
||||
example={example}
|
||||
tokenCase={this.state.case}
|
||||
onInputChange={onInputChange}
|
||||
onPress={this.onOptionPress}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -234,7 +271,7 @@ class NamingModal extends Component {
|
||||
token={token}
|
||||
example={example}
|
||||
tokenCase={this.state.case}
|
||||
onInputChange={onInputChange}
|
||||
onPress={this.onOptionPress}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -255,7 +292,7 @@ class NamingModal extends Component {
|
||||
token={token}
|
||||
example={example}
|
||||
tokenCase={this.state.case}
|
||||
onInputChange={onInputChange}
|
||||
onPress={this.onOptionPress}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -281,7 +318,7 @@ class NamingModal extends Component {
|
||||
token={token}
|
||||
example={example}
|
||||
tokenCase={this.state.case}
|
||||
onInputChange={onInputChange}
|
||||
onPress={this.onOptionPress}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -302,7 +339,7 @@ class NamingModal extends Component {
|
||||
token={token}
|
||||
example={example}
|
||||
tokenCase={this.state.case}
|
||||
onInputChange={onInputChange}
|
||||
onPress={this.onOptionPress}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -323,7 +360,7 @@ class NamingModal extends Component {
|
||||
token={token}
|
||||
example={example}
|
||||
tokenCase={this.state.case}
|
||||
onInputChange={onInputChange}
|
||||
onPress={this.onOptionPress}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -350,7 +387,7 @@ class NamingModal extends Component {
|
||||
token={token}
|
||||
example={example}
|
||||
tokenCase={this.state.case}
|
||||
onInputChange={onInputChange}
|
||||
onPress={this.onOptionPress}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -371,7 +408,7 @@ class NamingModal extends Component {
|
||||
token={token}
|
||||
example={example}
|
||||
tokenCase={this.state.case}
|
||||
onInputChange={onInputChange}
|
||||
onPress={this.onOptionPress}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -392,7 +429,7 @@ class NamingModal extends Component {
|
||||
token={token}
|
||||
example={example}
|
||||
tokenCase={this.state.case}
|
||||
onInputChange={onInputChange}
|
||||
onPress={this.onOptionPress}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -413,7 +450,7 @@ class NamingModal extends Component {
|
||||
token={token}
|
||||
example={example}
|
||||
tokenCase={this.state.case}
|
||||
onInputChange={onInputChange}
|
||||
onPress={this.onOptionPress}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -435,7 +472,7 @@ class NamingModal extends Component {
|
||||
example={example}
|
||||
tokenCase={this.state.case}
|
||||
size={sizes.LARGE}
|
||||
onInputChange={onInputChange}
|
||||
onPress={this.onOptionPress}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -452,6 +489,7 @@ class NamingModal extends Component {
|
||||
name={name}
|
||||
value={value}
|
||||
onChange={onInputChange}
|
||||
onSelectionChange={this.onInputSelectionChange}
|
||||
/>
|
||||
<Button onPress={onModalClose}>
|
||||
Close
|
||||
|
||||
@@ -12,30 +12,21 @@ class NamingOption extends Component {
|
||||
|
||||
onPress = () => {
|
||||
const {
|
||||
name,
|
||||
value,
|
||||
token,
|
||||
tokenCase,
|
||||
isFullFilename,
|
||||
onInputChange
|
||||
onPress
|
||||
} = this.props;
|
||||
|
||||
let newValue = token;
|
||||
let tokenValue = token;
|
||||
|
||||
if (tokenCase === 'lower') {
|
||||
newValue = token.toLowerCase();
|
||||
tokenValue = token.toLowerCase();
|
||||
} else if (tokenCase === 'upper') {
|
||||
newValue = token.toUpperCase();
|
||||
tokenValue = token.toUpperCase();
|
||||
}
|
||||
|
||||
if (isFullFilename) {
|
||||
onInputChange({ name, value: newValue });
|
||||
} else {
|
||||
onInputChange({
|
||||
name,
|
||||
value: `${value}${newValue}`
|
||||
});
|
||||
}
|
||||
onPress({ isFullFilename, tokenValue });
|
||||
}
|
||||
|
||||
//
|
||||
@@ -67,14 +58,12 @@ class NamingOption extends Component {
|
||||
}
|
||||
|
||||
NamingOption.propTypes = {
|
||||
name: PropTypes.string.isRequired,
|
||||
value: PropTypes.string.isRequired,
|
||||
token: PropTypes.string.isRequired,
|
||||
example: PropTypes.string.isRequired,
|
||||
tokenCase: PropTypes.string.isRequired,
|
||||
isFullFilename: PropTypes.bool.isRequired,
|
||||
size: PropTypes.oneOf([sizes.SMALL, sizes.LARGE]),
|
||||
onInputChange: PropTypes.func.isRequired
|
||||
onPress: PropTypes.func.isRequired
|
||||
};
|
||||
|
||||
NamingOption.defaultProps = {
|
||||
|
||||
Reference in New Issue
Block a user