Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
insomnious committed Dec 3, 2024
2 parents 195e469 + 057538f commit dbb43aa
Show file tree
Hide file tree
Showing 9 changed files with 84 additions and 79 deletions.
2 changes: 1 addition & 1 deletion app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"react-redux": "^7.1.3",
"react-resize-detector": "^4.2.1",
"react-select": "^1.2.1",
"react-sortable-tree": "TanninOne/react-sortable-tree",
"react-sortable-tree": "Nexus-Mods/react-sortable-tree",
"recharts": "^1.8.5",
"redux": "^4.0.4",
"redux-act": "^1.7.7",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@
"react-redux": "^7.1.3",
"react-resize-detector": "^4.2.1",
"react-select": "^1.2.1",
"react-sortable-tree": "TanninOne/react-sortable-tree",
"react-sortable-tree": "Nexus-Mods/react-sortable-tree",
"recharts": "^1.8.5",
"redux": "^4.0.4",
"redux-act": "^1.7.7",
Expand Down
2 changes: 0 additions & 2 deletions src/extensions/category_management/views/CategoryDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ class CategoryDialog extends ComponentEx<IProps, {}> {
<Modal.Title>{t('Categories')}</Modal.Title>
</Modal.Header>
<Modal.Body>
<DNDContainer>
<CategoryList />
</DNDContainer>
</Modal.Body>
</Modal>
);
Expand Down
34 changes: 13 additions & 21 deletions src/extensions/category_management/views/CategoryList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import * as SortableTreeT from 'react-sortable-tree';
import * as Redux from 'redux';
import { ThunkDispatch } from 'redux-thunk';

const tree = lazyRequire<typeof SortableTreeT>(() => require('react-sortable-tree'));
import SortableTree, { OnDragPreviousAndNextLocation, OnMovePreviousAndNextLocation, NodeData, FullTree } from 'react-sortable-tree';

const nop = () => undefined;

Expand Down Expand Up @@ -135,7 +135,6 @@ class CategoryList extends ComponentEx<IProps, IComponentState> {
const { expandedTreeData, searchString, searchFocusIndex,
searchFoundCount } = this.state;

const Tree = tree.SortableTreeWithoutDndContext<INodeExtraArgs>;
return (
<div className='categories-dialog'>
<IconBar
Expand Down Expand Up @@ -182,8 +181,7 @@ class CategoryList extends ComponentEx<IProps, IComponentState> {
onClick={this.selectNextMatch}
/>
</div>
{((expandedTreeData || []).length > 0) ? (
<Tree
<SortableTree
treeData={expandedTreeData}
onChange={nop}
onVisibilityToggle={this.toggleVisibility}
Expand All @@ -197,7 +195,6 @@ class CategoryList extends ComponentEx<IProps, IComponentState> {
getNodeKey={this.getNodeKey}
generateNodeProps={this.generateNodeProps}
/>
) : null}
</div>
);
}
Expand Down Expand Up @@ -534,31 +531,26 @@ class CategoryList extends ComponentEx<IProps, IComponentState> {
this.updateExpandedTreeData(this.props.categories);
}

private canDrop = (args: { node: SortableTreeT.TreeItem<INodeExtraArgs>,
nextParent: SortableTreeT.TreeItem,
prevParent: SortableTreeT.TreeItem,
nextPath: Array<number | string>,
prevPath: Array<number | string>,
treeIndex: number }) => {
return !(args.nextPath ?? []).slice(0, -1).includes(args.node.categoryId);
private canDrop = (data: OnDragPreviousAndNextLocation & NodeData) => {
const { nextPath, node } = data;
return !(nextPath ?? []).slice(0, -1).includes(node['categoryId']);
}

private moveNode =
(args: { treeData: SortableTreeT.TreeItem[], node: SortableTreeT.TreeItem<INodeExtraArgs>,
treeIndex: number, path: string[] | number[] | React.ReactText[] }): void => {
private moveNode = (data: NodeData & FullTree & OnMovePreviousAndNextLocation) => {
const { gameMode, onSetCategory, onSetCategoryOrder } = this.props;
if (args.path[args.path.length - 2] !== args.node.parentId) {
onSetCategory(gameMode, args.node.categoryId, {
name: args.node.title as string,
order: args.node.order,
parentCategory: (args.path as string[])[args.path.length - 2],
const { path, node, treeData } = data;
if (path[path.length - 2] !== node['parentId']) {
onSetCategory(gameMode, node['categoryId'], {
name: node.title as string,
order: node['order'],
parentCategory: (path as string[])[path.length - 2],
});
} else {
const newOrder = (base: ICategoriesTree[]): string[] => {
return [].concat(...base.map(node =>
[node.categoryId, ...newOrder(node.children)]));
};
onSetCategoryOrder(gameMode, newOrder(args.treeData as ICategoriesTree[]));
onSetCategoryOrder(gameMode, newOrder(treeData as ICategoriesTree[]));
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/extensions/nexus_integration/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ function retrieveCategories(api: IExtensionApi, isUpdate: boolean) {
'You are not logged in to Nexus Mods!', { allowReport: false });
} else {
let gameId;
currentGame(api.store)
return currentGame(api.store)
.then((game: IGameStored) => {
gameId = game.id;
const nexusId = nexusGameId(game);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function retrieveCategoryList(
});

fixLoops(res);
resolve(res);
return resolve(res);
}
})
.catch((err) => {
Expand Down
3 changes: 2 additions & 1 deletion src/types/IExtensionContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1379,8 +1379,9 @@ export interface IExtensionContext {
* register a dependency on a different extension
* @param {string} extId id of the extension that this one depends on
* @param {string} version a semver version range that the mod is compatible with
* @param {boolean} optional if set to true, the extension will not fail if the dependency is not found
*/
requireExtension: (extId: string, version?: string) => void;
requireExtension: (extId: string, version?: string, optional?: boolean) => void;

/**
* called once after the store has been set up and after all extensions have been initialized
Expand Down
18 changes: 10 additions & 8 deletions src/util/ExtensionManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -486,14 +486,16 @@ class ContextProxyHandler implements ProxyHandler<any> {
|| (ext.name === id));
};

const testValid = (extId: string, requiredId?: string, version?: string) => {
const req = findExt(requiredId);
if (req === undefined) {
setdefault(incompatibleExtensions, extId, []).push(
{ id: 'dependency', args: { dependencyId: requiredId } });
} else if ((version !== undefined) && !semver.satisfies(req.info?.version, version)) {
setdefault(incompatibleExtensions, extId, []).push(
{ id: 'dependency', args: { dependencyId: requiredId, version } });
const testValid = (extId: string, requiredId?: string, version?: string, optional?: boolean) => {
if (!optional) {
const req = findExt(requiredId);
if (req === undefined) {
setdefault(incompatibleExtensions, extId, []).push(
{ id: 'dependency', args: { dependencyId: requiredId } });
} else if ((version !== undefined) && !semver.satisfies(req.info?.version, version)) {
setdefault(incompatibleExtensions, extId, []).push(
{ id: 'dependency', args: { dependencyId: requiredId, version } });
}
}
};

Expand Down
98 changes: 55 additions & 43 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1180,13 +1180,20 @@
dependencies:
regenerator-runtime "^0.13.11"

"@babel/runtime@^7.12.0", "@babel/runtime@^7.14.5", "@babel/runtime@^7.15.4", "@babel/runtime@^7.4.5", "@babel/runtime@^7.6.3", "@babel/runtime@^7.7.2", "@babel/runtime@^7.8.4", "@babel/runtime@^7.8.7", "@babel/runtime@^7.9.2":
"@babel/runtime@^7.12.0", "@babel/runtime@^7.14.5", "@babel/runtime@^7.15.4", "@babel/runtime@^7.4.5", "@babel/runtime@^7.6.3", "@babel/runtime@^7.8.4", "@babel/runtime@^7.9.2":
version "7.20.1"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.20.1.tgz#1148bb33ab252b165a06698fde7576092a78b4a9"
integrity sha512-mrzLkl6U9YLF8qpqI7TB82PESyEGjm/0Ly91jG575eVxMMlb8fYfOXFZIJ8XfLrJZQbm7dlKry2bJmXBUEkdFg==
dependencies:
regenerator-runtime "^0.13.10"

"@babel/runtime@^7.7.2", "@babel/runtime@^7.8.7":
version "7.26.0"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.26.0.tgz#8600c2f595f277c60815256418b85356a65173c1"
integrity sha512-FDSOghenHTiToteC/QRlv2q3DhPZ/oOXTBoirfWNx1Cx3TMVcGWQtMMmQcSvb/JjpNeGzx8Pq/b4fKEJuWm1sw==
dependencies:
regenerator-runtime "^0.14.0"

"@babel/template@^7.16.7", "@babel/template@^7.18.10", "@babel/template@^7.20.7", "@babel/template@^7.3.3":
version "7.20.7"
resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.20.7.tgz#a15090c2839a83b02aa996c0b4994005841fd5a8"
Expand Down Expand Up @@ -2320,14 +2327,22 @@
dependencies:
"@types/unist" "*"

"@types/hoist-non-react-statics@^3.3.0", "@types/hoist-non-react-statics@^3.3.1":
"@types/hoist-non-react-statics@^3.3.0":
version "3.3.1"
resolved "https://registry.yarnpkg.com/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.1.tgz#1124aafe5118cb591977aeb1ceaaed1070eb039f"
integrity sha512-iMIqiko6ooLrTh1joXodJK5X9xeEALT1kM5G3ZLhD3hszxBdIEd5C75U834D9mLcINgD4OyZf5uQXjkuYydWvA==
dependencies:
"@types/react" "*"
hoist-non-react-statics "^3.3.0"

"@types/hoist-non-react-statics@^3.3.1":
version "3.3.5"
resolved "https://registry.yarnpkg.com/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.5.tgz#dab7867ef789d87e2b4b0003c9d65c49cc44a494"
integrity sha512-SbcrWzkKBw2cdwRTwQAswfpB9g9LJWfjtUeW/jvNwbhC8cpmmNYVePa+ncbUe0rGTQ7G3Ff6mYUN2VMfLVr+Sg==
dependencies:
"@types/react" "*"
hoist-non-react-statics "^3.3.0"

"@types/http-cache-semantics@*":
version "4.0.1"
resolved "https://registry.yarnpkg.com/@types/http-cache-semantics/-/http-cache-semantics-4.0.1.tgz#0ea7b61496902b95890dc4c3a116b60cb8dae812"
Expand Down Expand Up @@ -2497,7 +2512,12 @@
resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-2.7.2.tgz#6c2324641cc4ba050a8c710b2b251b377581fbf0"
integrity sha512-KufADq8uQqo1pYKVIYzfKbJfBAc0sOeXqGbFaSpv8MRmC/zXgowNZmFcbngndGk922QDmOASEXUZCaY48gs4cg==

"@types/prop-types@*", "@types/prop-types@^15.7.3":
"@types/prop-types@*":
version "15.7.13"
resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.13.tgz#2af91918ee12d9d32914feb13f5326658461b451"
integrity sha512-hCZTSvwbzWGvhqxp/RqVqwU999pBf2vp7hzIjiYOsl8wqOmUxkQ6ddw1cV3l8811+kdUFus/q4d1Y3E3SyEifA==

"@types/prop-types@^15.7.3":
version "15.7.5"
resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.5.tgz#5f19d2b85a98e9558036f6a3cacc8819420f05cf"
integrity sha512-JCB8C6SnDoQf0cNycqd/35A7MjcnK+ZTqE7judS6o7utxUCg6imJg3QK2qzHKszlTjcj2cn+NwMB2i96ubpj7w==
Expand Down Expand Up @@ -2670,9 +2690,9 @@
"@types/node" "*"

"@types/scheduler@*":
version "0.16.2"
resolved "https://registry.yarnpkg.com/@types/scheduler/-/scheduler-0.16.2.tgz#1a62f89525723dde24ba1b01b092bf5df8ad4d39"
integrity sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew==
version "0.23.0"
resolved "https://registry.yarnpkg.com/@types/scheduler/-/scheduler-0.23.0.tgz#0a6655b3e2708eaabca00b7372fafd7a792a7b09"
integrity sha512-YIoDCTH3Af6XM5VuwGG/QL/CJqga1Zm3NkU3HZ4ZHK2fRMPYP1VczsTUqtsf43PH/iJNVlPHAo2oWX7BSdB2Hw==

"@types/semver@^7.3.12":
version "7.3.13"
Expand Down Expand Up @@ -4527,9 +4547,9 @@ cssstyle@^2.3.0:
cssom "~0.3.6"

csstype@^3.0.2:
version "3.1.1"
resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.1.1.tgz#841b532c45c758ee546a11d5bd7b7b473c8c30b9"
integrity sha512-DJR/VvkAvSZW9bTouZue2sSxDwdTN92uHjqeKVm+0dAqdfNykRzQ95tay8aXMBAAPpUiq4Qcug2L7neoRh2Egw==
version "3.1.3"
resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.1.3.tgz#d80ff294d114fb0e6ac500fbf85b60137d7eff81"
integrity sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==

[email protected]:
version "1.0.3"
Expand Down Expand Up @@ -5082,15 +5102,6 @@ [email protected]:
"@react-dnd/invariant" "^2.0.0"
redux "^4.1.1"

dnd-core@^10.0.2:
version "10.0.2"
resolved "https://registry.yarnpkg.com/dnd-core/-/dnd-core-10.0.2.tgz#051dc119682ea1185622f954667670d3d5f6a574"
integrity sha512-PrxEjxF0+6Y1n1n1Z9hSWZ1tvnDXv9syL+BccV1r1RC08uWNsyetf8AnWmUF3NgYPwy0HKQJwTqGkZK+1NlaFA==
dependencies:
"@react-dnd/asap" "^4.0.0"
"@react-dnd/invariant" "^2.0.0"
redux "^4.0.4"

dnd-core@^11.1.3:
version "11.1.3"
resolved "https://registry.yarnpkg.com/dnd-core/-/dnd-core-11.1.3.tgz#f92099ba7245e49729d2433157031a6267afcc98"
Expand Down Expand Up @@ -7974,6 +7985,13 @@ jsprim@^1.2.2:
array-includes "^3.1.5"
object.assign "^4.1.3"

jsx-runtime@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/jsx-runtime/-/jsx-runtime-1.2.0.tgz#3bae0dad50ec30541bb5b0420b104856694350cb"
integrity sha512-iCxmRTlUAWmXwHZxN0JSx/T7eRi0SkKAskE0lp+j4W1mzdNp49ja/9QI2ZmlggPM95RqnDw5ioYjw0EcvpIClw==
dependencies:
object-assign "^3.0.0"

jszip@^3.1.0:
version "3.10.1"
resolved "https://registry.yarnpkg.com/jszip/-/jszip-3.10.1.tgz#34aee70eb18ea1faec2f589208a157d1feb091c2"
Expand Down Expand Up @@ -8998,6 +9016,11 @@ oauth-sign@~0.9.0:
resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.9.0.tgz#47a7b016baa68b5fa0ecf3dee08a85c679ac6455"
integrity sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==

object-assign@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-3.0.0.tgz#9bedd5ca0897949bca47e7ff408062d549f587f2"
integrity sha512-jHP15vXVGeVh1HuaA2wY6lxk+whK/x4KBG88VXeRma7CCun7iGD5qPc4eYykQ9sdQvg8jkwFKsSxHln2ybW3xQ==

object-assign@^4.1.0, object-assign@^4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863"
Expand Down Expand Up @@ -9722,30 +9745,13 @@ react-display-name@^0.2.0:
resolved "https://registry.yarnpkg.com/react-display-name/-/react-display-name-0.2.5.tgz#304c7cbfb59ee40389d436e1a822c17fe27936c6"
integrity sha512-I+vcaK9t4+kypiSgaiVWAipqHRXYmZIuAiS8vzFvXHHXVigg/sMKwlRgLy6LH2i3rmP+0Vzfl5lFsFRwF1r3pg==

react-dnd-html5-backend@^10.0.2:
version "10.0.2"
resolved "https://registry.yarnpkg.com/react-dnd-html5-backend/-/react-dnd-html5-backend-10.0.2.tgz#15cb9d2b923f43576a136df854e288cb5969784c"
integrity sha512-ny17gUdInZ6PIGXdzfwPhoztRdNVVvjoJMdG80hkDBamJBeUPuNF2Wv4D3uoQJLjXssX1+i9PhBqc7EpogClwQ==
dependencies:
dnd-core "^10.0.2"

react-dnd-html5-backend@^14.0.5:
version "14.1.0"
resolved "https://registry.yarnpkg.com/react-dnd-html5-backend/-/react-dnd-html5-backend-14.1.0.tgz#b35a3a0c16dd3a2bfb5eb7ec62cf0c2cace8b62f"
integrity sha512-6ONeqEC3XKVf4eVmMTe0oPds+c5B9Foyj8p/ZKLb7kL2qh9COYxiBHv3szd6gztqi/efkmriywLUVlPotqoJyw==
dependencies:
dnd-core "14.0.1"

react-dnd@^10.0.2:
version "10.0.2"
resolved "https://registry.yarnpkg.com/react-dnd/-/react-dnd-10.0.2.tgz#a6ad8eb3d9f2c573031f7ce05012e5c767a0b1fc"
integrity sha512-SC2Ymvntynhoqtf5zaFhZscm9xenCoMofilxPdlwUlaelAzmbl9fw82C4ZJ//+lNm3kWAKXjGDZg2/aWjKEAtg==
dependencies:
"@react-dnd/shallowequal" "^2.0.0"
"@types/hoist-non-react-statics" "^3.3.1"
dnd-core "^10.0.2"
hoist-non-react-statics "^3.3.0"

react-dnd@^11.1.3:
version "11.1.3"
resolved "https://registry.yarnpkg.com/react-dnd/-/react-dnd-11.1.3.tgz#f9844f5699ccc55dfc81462c2c19f726e670c1af"
Expand Down Expand Up @@ -9967,15 +9973,16 @@ react-smooth@^1.0.5:
raf "^3.4.0"
react-transition-group "^2.5.0"

react-sortable-tree@TanninOne/react-sortable-tree:
version "2.7.2"
resolved "https://codeload.github.com/TanninOne/react-sortable-tree/tar.gz/1c12ee0d9186a06665b5f6201b863179f74d23b9"
react-sortable-tree@Nexus-Mods/react-sortable-tree:
version "2.8.1"
resolved "https://codeload.github.com/Nexus-Mods/react-sortable-tree/tar.gz/658f6fb4f49f97a600b732cdd72f6e1b867482b7"
dependencies:
frontend-collective-react-dnd-scrollzone "^1.0.2"
jsx-runtime "^1.2.0"
lodash.isequal "^4.5.0"
prop-types "^15.6.1"
react-dnd "^10.0.2"
react-dnd-html5-backend "^10.0.2"
react-dnd "^14.0.5"
react-dnd-html5-backend "^14.0.5"
react-lifecycles-compat "^3.0.4"
react-virtualized "^9.21.2"

Expand All @@ -10000,9 +10007,9 @@ react-transition-group@^2.0.0, react-transition-group@^2.2.1, react-transition-g
react-lifecycles-compat "^3.0.4"

react-virtualized@^9.21.2:
version "9.22.3"
resolved "https://registry.yarnpkg.com/react-virtualized/-/react-virtualized-9.22.3.tgz#f430f16beb0a42db420dbd4d340403c0de334421"
integrity sha512-MKovKMxWTcwPSxE1kK1HcheQTWfuCxAuBoSTf2gwyMM21NdX/PXUhnoP8Uc5dRKd+nKm8v41R36OellhdCpkrw==
version "9.22.5"
resolved "https://registry.yarnpkg.com/react-virtualized/-/react-virtualized-9.22.5.tgz#bfb96fed519de378b50d8c0064b92994b3b91620"
integrity sha512-YqQMRzlVANBv1L/7r63OHa2b0ZsAaDp1UhVNEdUaXI8A5u6hTpA5NYtUueLH2rFuY/27mTGIBl7ZhqFKzw18YQ==
dependencies:
"@babel/runtime" "^7.7.2"
clsx "^1.0.4"
Expand Down Expand Up @@ -10310,6 +10317,11 @@ regenerator-runtime@^0.13.4:
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.10.tgz#ed07b19616bcbec5da6274ebc75ae95634bfc2ee"
integrity sha512-KepLsg4dU12hryUO7bp/axHAKvwGOCV0sGloQtpagJ12ai+ojVDqkeGSiRX1zlq+kjIMZ1t7gpze+26QqtdGqw==

regenerator-runtime@^0.14.0:
version "0.14.1"
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz#356ade10263f685dda125100cd862c1db895327f"
integrity sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==

regenerator-transform@^0.15.0:
version "0.15.0"
resolved "https://registry.yarnpkg.com/regenerator-transform/-/regenerator-transform-0.15.0.tgz#cbd9ead5d77fae1a48d957cf889ad0586adb6537"
Expand Down

0 comments on commit dbb43aa

Please sign in to comment.