mirror of
https://github.com/Radarr/Radarr
synced 2025-02-23 23:01:10 +00:00
New: Natural Sorting Manual Import Relative Paths
(cherry picked from commit bdd5865876796bc203c8117418a5389afc8b5f11)
This commit is contained in:
parent
8fe81b428a
commit
5316382113
3 changed files with 16 additions and 2 deletions
|
@ -4,6 +4,7 @@ import { batchActions } from 'redux-batched-actions';
|
|||
import { sortDirections } from 'Helpers/Props';
|
||||
import { createThunk, handleThunks } from 'Store/thunks';
|
||||
import createAjaxRequest from 'Utilities/createAjaxRequest';
|
||||
import naturalExpansion from 'Utilities/String/naturalExpansion';
|
||||
import { set, update, updateItem } from './baseActions';
|
||||
import createHandleActions from './Creators/createHandleActions';
|
||||
import createSetClientSideCollectionSortReducer from './Creators/Reducers/createSetClientSideCollectionSortReducer';
|
||||
|
@ -35,7 +36,7 @@ export const defaultState = {
|
|||
relativePath: function(item, direction) {
|
||||
const relativePath = item.relativePath;
|
||||
|
||||
return relativePath.toLowerCase();
|
||||
return naturalExpansion(relativePath.toLowerCase());
|
||||
},
|
||||
|
||||
movie: function(item, direction) {
|
||||
|
|
11
frontend/src/Utilities/String/naturalExpansion.js
Normal file
11
frontend/src/Utilities/String/naturalExpansion.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
const regex = /\d+/g;
|
||||
|
||||
function naturalExpansion(input) {
|
||||
if (!input) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return input.replace(regex, (n) => n.padStart(8, '0'));
|
||||
}
|
||||
|
||||
export default naturalExpansion;
|
|
@ -1,9 +1,11 @@
|
|||
const regex = /\b\w+/g;
|
||||
|
||||
function titleCase(input) {
|
||||
if (!input) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return input.replace(/\b\w+/g, (match) => {
|
||||
return input.replace(regex, (match) => {
|
||||
return match.charAt(0).toUpperCase() + match.substr(1).toLowerCase();
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue