Skip to content

Commit 2aa1344

Browse files
committed
Merge branch 'beta' into stable
2 parents 653b6a8 + ba57c84 commit 2aa1344

File tree

8 files changed

+92
-89
lines changed

8 files changed

+92
-89
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
"react-datepicker": "^4.7.0",
7171
"react-dom": "^16.13.1",
7272
"react-hot-loader": "^4.13.0",
73-
"react-redux": "^8.1.3",
73+
"react-redux": "^7.2.9",
7474
"react-select": "^4.3.1",
7575
"react-select-fast-filter-options": "^0.2.3",
7676
"react-simple-star-rating": "^4.0.5",

src/client/components/forms/parts/achievement.js renamed to src/client/components/forms/parts/achievement.tsx

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/*
22
* Copyright (C) 2016 Max Prettyjohns
3+
* 2023 Meziyum
34
*
45
* This program is free software; you can redistribute it and/or modify
56
* it under the terms of the GNU General Public License as published by
@@ -17,12 +18,13 @@
1718
*/
1819

1920
import * as bootstrap from 'react-bootstrap';
21+
import type {Achievement} from '../../input/drag-and-drop';
2022
import DragAndDropImage from '../../input/drag-and-drop-image';
21-
import PropTypes from 'prop-types';
2223
import React from 'react';
2324

2425

2526
const {Card, Col, Container, Row} = bootstrap;
27+
/* eslint-disable sort-keys */
2628
const maxAchievementProgress = {
2729
1: 1,
2830
2: 50,
@@ -33,7 +35,6 @@ const maxAchievementProgress = {
3335
7: 1,
3436
8: 10,
3537
9: 100,
36-
// eslint-disable-next-line sort-keys
3738
10: 10,
3839
11: 7,
3940
12: 30,
@@ -56,28 +57,41 @@ const maxAchievementProgress = {
5657
29: 10,
5758
30: 100
5859
};
60+
/* eslint-enable sort-keys */
5961

60-
function Achievement(props) {
61-
const {achievement, counter, unlocked} = props;
62-
const {id, name, description, badgeUrl} = achievement;
62+
interface AchievementComponentProps {
63+
achievement: Achievement
64+
}
65+
66+
/**
67+
* Achievement Component
68+
*
69+
* A React component that displays an achievement card with its details, including name,
70+
* description, badge image, and progress if the achievement is locked.
71+
*
72+
* @component
73+
*
74+
* @param {Object} props - The props for the Achievement component.
75+
* @param {Achievement} props.achievement - The achievement object containing details.
76+
* @param {number} props.counter - The current progress or counter for the achievement.
77+
* @param {boolean} props.unlocked - A boolean indicating whether the achievement is unlocked.
78+
*
79+
* @returns {JSX.Element} The rendered Achievement card component.
80+
*/
81+
function AchievementComponent({achievement}: AchievementComponentProps): JSX.Element {
82+
const {id, name, description, badgeUrl, counter, unlocked} = achievement;
6383
const imgElement = unlocked ? (
6484
<DragAndDropImage
6585
achievementId={id}
6686
achievementName={name}
6787
height="100px"
6888
src={badgeUrl}
69-
style={{
70-
zIndex: 2
71-
}}
7289
/>
7390
) : (
7491
<img
7592
alt={name}
7693
height="100px"
7794
src={badgeUrl}
78-
style={{
79-
zIndex: 2
80-
}}
8195
/>
8296
);
8397

@@ -107,21 +121,6 @@ function Achievement(props) {
107121
);
108122
}
109123

110-
Achievement.displayName = 'achievement';
111-
112-
Achievement.propTypes = {
113-
achievement: PropTypes.shape({
114-
badgeUrl: PropTypes.string,
115-
description: PropTypes.string,
116-
id: PropTypes.number,
117-
name: PropTypes.string
118-
}).isRequired,
119-
counter: PropTypes.number,
120-
unlocked: PropTypes.bool
121-
};
122-
Achievement.defaultProps = {
123-
counter: 0,
124-
unlocked: false
125-
};
124+
AchievementComponent.displayName = 'achievement';
126125

127-
export default Achievement;
126+
export default AchievementComponent;

src/client/components/input/drag-and-drop-image.tsx

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
1717
*/
1818

19-
import PropTypes from 'prop-types';
2019
import React from 'react';
2120

2221

@@ -71,11 +70,5 @@ function DragAndDropImage({achievementId, achievementName, height, src}: Props):
7170
}
7271

7372
DragAndDropImage.displayName = 'DragAndDropImage';
74-
DragAndDropImage.propTypes = {
75-
achievementId: PropTypes.number.isRequired,
76-
achievementName: PropTypes.string.isRequired,
77-
height: PropTypes.string.isRequired,
78-
src: PropTypes.string.isRequired
79-
};
8073

8174
export default DragAndDropImage;

src/client/components/input/drag-and-drop.tsx

Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
*/
1818

1919
import * as bootstrap from 'react-bootstrap';
20-
import PropTypes from 'prop-types';
2120
import React from 'react';
2221

2322

@@ -31,10 +30,20 @@ const {useState, useCallback} = React;
3130
* @property {string} badgeUrl - The source URL of the achievement's badge image.
3231
* @property {number} id - The ID of the achievement.
3332
*/
34-
type Achievement = {
35-
name: string;
33+
export type Achievement = {
3634
badgeUrl: string | null;
35+
counter:number;
36+
description: string;
3737
id: number;
38+
name: string;
39+
unlocked: boolean;
40+
};
41+
type AchievementForDisplay = Pick<Achievement, 'badgeUrl' | 'id' | 'name'>;
42+
43+
const blankBadge:AchievementForDisplay = {
44+
badgeUrl: '/images/blankbadge.svg',
45+
id: null,
46+
name: 'drag badge to set'
3847
};
3948

4049
/**
@@ -56,18 +65,14 @@ type Props = {
5665
* @returns {JSX.Element} A React component that displays a drag-and-drop card for an achievement.
5766
*/
5867
function DragAndDrop({name, initialAchievement}: Props): JSX.Element {
59-
const [achievement, setAchievement] = useState<Achievement>(initialAchievement);
68+
const [achievement, setAchievement] = useState<AchievementForDisplay>(initialAchievement);
6069
const handleClick = useCallback((event: React.MouseEvent<HTMLDivElement>) => {
6170
event.preventDefault();
62-
setAchievement({
63-
badgeUrl: '/images/blankbadge.svg',
64-
id: null,
65-
name: 'drag badge to set'
66-
});
67-
});
71+
setAchievement(blankBadge);
72+
}, []);
6873
const handleDragOver = useCallback((event: React.DragEvent<HTMLDivElement>) => {
6974
event.preventDefault();
70-
});
75+
}, []);
7176
const handleDrop = useCallback((event: React.DragEvent<HTMLDivElement>) => {
7277
event.preventDefault();
7378
let data;
@@ -83,7 +88,7 @@ function DragAndDrop({name, initialAchievement}: Props): JSX.Element {
8388
id: data.id,
8489
name: data.name
8590
});
86-
});
91+
}, [setAchievement]);
8792
return (
8893
<Card
8994
bg="light"
@@ -114,20 +119,9 @@ function DragAndDrop({name, initialAchievement}: Props): JSX.Element {
114119
}
115120

116121
DragAndDrop.displayName = 'DragAndDrop';
117-
DragAndDrop.propTypes = {
118-
initialAchievement: PropTypes.shape({
119-
badgeUrl: PropTypes.string,
120-
id: PropTypes.number,
121-
name: PropTypes.string.isRequired
122-
}),
123-
name: PropTypes.string.isRequired
124-
};
122+
125123
DragAndDrop.defaultProps = {
126-
initialAchievement: {
127-
badgeUrl: '/images/blankbadge.svg',
128-
id: null,
129-
name: 'drag badge to set'
130-
}
124+
initialAchievement: blankBadge
131125
};
132126

133127
export default DragAndDrop;

src/client/components/pages/parts/editor-achievements.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,7 @@ class EditorAchievementTab extends React.Component {
5959
const achievementHTML = (
6060
<Achievement
6161
achievement={achievement}
62-
counter={achievement.counter}
6362
key={`${this.state.editor.id}${achievement.id}`}
64-
unlocked={achievement.unlocked}
6563
/>
6664
);
6765
if (achievement.unlocked) {

src/client/entity-editor/alias-editor/reducer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ function reducer(
5050
return state.delete(payload);
5151
case REMOVE_EMPTY_ALIASES:
5252
return state.filterNot(alias =>
53-
alias.get('name') === '' && alias.get('language') === null && alias.get('sortName') === '');
53+
alias.get('name') === '');
5454
// no default
5555
}
5656
return state;

src/client/entity-editor/identifier-editor/reducer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ function reducer(
5858
return state.delete(payload);
5959
case REMOVE_EMPTY_IDENTIFIERS:
6060
return state.filterNot(identifier =>
61-
identifier.get('value') === '' && identifier.get('type') === null);
61+
identifier.get('value') === '');
6262
case ADD_OTHER_ISBN: {
6363
const {rowId, value, type: typeId} = payload;
6464
// search if given identifier already exists

yarn.lock

Lines changed: 43 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1210,13 +1210,20 @@
12101210
pirates "^4.0.6"
12111211
source-map-support "^0.5.16"
12121212

1213-
"@babel/runtime@^7.12.0", "@babel/runtime@^7.12.1", "@babel/runtime@^7.13.10", "@babel/runtime@^7.13.8", "@babel/runtime@^7.14.0", "@babel/runtime@^7.17.7", "@babel/runtime@^7.2.0", "@babel/runtime@^7.5.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":
1213+
"@babel/runtime@^7.12.0", "@babel/runtime@^7.13.10", "@babel/runtime@^7.13.8", "@babel/runtime@^7.14.0", "@babel/runtime@^7.17.7", "@babel/runtime@^7.2.0", "@babel/runtime@^7.5.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":
12141214
version "7.23.2"
12151215
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.23.2.tgz#062b0ac103261d68a966c4c7baf2ae3e62ec3885"
12161216
integrity sha512-mM8eg4yl5D6i3lu2QKPuPH4FArvJ8KhTofbE7jwMUv9KX5mBvwPAqnV3MlyBNqdp9RyRKP6Yck8TrfYrPvX3bg==
12171217
dependencies:
12181218
regenerator-runtime "^0.14.0"
12191219

1220+
"@babel/runtime@^7.15.4":
1221+
version "7.23.9"
1222+
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.23.9.tgz#47791a15e4603bb5f905bc0753801cf21d6345f7"
1223+
integrity sha512-0CX6F+BI2s9dkUqr08KFrAIZgNFj75rdBU/DjCyYLIaV/quFjkk6T+EJ2LkZHyZTbEV4L5p97mNkUsHl2wLFAw==
1224+
dependencies:
1225+
regenerator-runtime "^0.14.0"
1226+
12201227
"@babel/template@^7.16.0", "@babel/template@^7.16.7", "@babel/template@^7.20.7":
12211228
version "7.20.7"
12221229
resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.20.7.tgz#a15090c2839a83b02aa996c0b4994005841fd5a8"
@@ -1901,10 +1908,10 @@
19011908
dependencies:
19021909
"@types/node" "*"
19031910

1904-
"@types/hoist-non-react-statics@^3.3.1":
1905-
version "3.3.3"
1906-
resolved "https://registry.yarnpkg.com/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.3.tgz#8bb41d9a88164f82dd2745ff05e637e655f34d19"
1907-
integrity sha512-Wny3a2UXn5FEA1l7gc6BbpoV5mD1XijZqgkp4TRgDCDL5r3B5ieOFGUX5h3n78Tr1MEG7BfvoM8qeztdvNU0fw==
1911+
"@types/hoist-non-react-statics@^3.3.0":
1912+
version "3.3.5"
1913+
resolved "https://registry.yarnpkg.com/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.5.tgz#dab7867ef789d87e2b4b0003c9d65c49cc44a494"
1914+
integrity sha512-SbcrWzkKBw2cdwRTwQAswfpB9g9LJWfjtUeW/jvNwbhC8cpmmNYVePa+ncbUe0rGTQ7G3Ff6mYUN2VMfLVr+Sg==
19081915
dependencies:
19091916
"@types/react" "*"
19101917
hoist-non-react-statics "^3.3.0"
@@ -1995,6 +2002,16 @@
19952002
dependencies:
19962003
"@types/react" "*"
19972004

2005+
"@types/react-redux@^7.1.20":
2006+
version "7.1.33"
2007+
resolved "https://registry.yarnpkg.com/@types/react-redux/-/react-redux-7.1.33.tgz#53c5564f03f1ded90904e3c90f77e4bd4dc20b15"
2008+
integrity sha512-NF8m5AjWCkert+fosDsN3hAlHzpjSiXlVy9EgQEmLoBhaNXbmyeGs/aj5dQzKuF+/q+S7JQagorGDW8pJ28Hmg==
2009+
dependencies:
2010+
"@types/hoist-non-react-statics" "^3.3.0"
2011+
"@types/react" "*"
2012+
hoist-non-react-statics "^3.3.0"
2013+
redux "^4.0.0"
2014+
19982015
"@types/react-select@^4.0.18":
19992016
version "4.0.18"
20002017
resolved "https://registry.yarnpkg.com/@types/react-select/-/react-select-4.0.18.tgz#f907f406411afa862217a9d86c54a301367a35c1"
@@ -2061,11 +2078,6 @@
20612078
resolved "https://registry.yarnpkg.com/@types/trusted-types/-/trusted-types-2.0.2.tgz#fc25ad9943bcac11cceb8168db4f275e0e72e756"
20622079
integrity sha512-F5DIZ36YVLE+PN+Zwws4kJogq47hNgX3Nx6WyDJ3kcplxyke3XIzB8uK5n/Lpm1HBsbGzd6nmGehL8cPekP+Tg==
20632080

2064-
"@types/use-sync-external-store@^0.0.3":
2065-
version "0.0.3"
2066-
resolved "https://registry.yarnpkg.com/@types/use-sync-external-store/-/use-sync-external-store-0.0.3.tgz#b6725d5f4af24ace33b36fafd295136e75509f43"
2067-
integrity sha512-EwmlvuaxPNej9+T4v5AuBPJa2x2UOJVdjCtDHgcDqitUeOtjnJKJ+apYjVcAoBEMjKW1VVFGZLUb5+qqa09XFA==
2068-
20692081
"@types/warning@^3.0.0":
20702082
version "3.0.0"
20712083
resolved "https://registry.yarnpkg.com/@types/warning/-/warning-3.0.0.tgz#0d2501268ad8f9962b740d387c4654f5f8e23e52"
@@ -7240,6 +7252,11 @@ react-is@^16.13.1, react-is@^16.3.2, react-is@^16.7.0, react-is@^16.8.6:
72407252
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4"
72417253
integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==
72427254

7255+
react-is@^17.0.2:
7256+
version "17.0.2"
7257+
resolved "https://registry.yarnpkg.com/react-is/-/react-is-17.0.2.tgz#e691d4a8e9c789365655539ab372762b0efb54f0"
7258+
integrity sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==
7259+
72437260
react-is@^18.0.0:
72447261
version "18.2.0"
72457262
resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.2.0.tgz#199431eeaaa2e09f86427efbb4f1473edb47609b"
@@ -7277,17 +7294,17 @@ react-popper@^2.2.5:
72777294
react-fast-compare "^3.0.1"
72787295
warning "^4.0.2"
72797296

7280-
react-redux@^8.1.3:
7281-
version "8.1.3"
7282-
resolved "https://registry.yarnpkg.com/react-redux/-/react-redux-8.1.3.tgz#4fdc0462d0acb59af29a13c27ffef6f49ab4df46"
7283-
integrity sha512-n0ZrutD7DaX/j9VscF+uTALI3oUPa/pO4Z3soOBIjuRn/FzVu6aehhysxZCLi6y7duMf52WNZGMl7CtuK5EnRw==
7297+
react-redux@^7.2.9:
7298+
version "7.2.9"
7299+
resolved "https://registry.yarnpkg.com/react-redux/-/react-redux-7.2.9.tgz#09488fbb9416a4efe3735b7235055442b042481d"
7300+
integrity sha512-Gx4L3uM182jEEayZfRbI/G11ZpYdNAnBs70lFVMNdHJI76XYtR+7m0MN+eAs7UHBPhWXcnFPaS+9owSCJQHNpQ==
72847301
dependencies:
7285-
"@babel/runtime" "^7.12.1"
7286-
"@types/hoist-non-react-statics" "^3.3.1"
7287-
"@types/use-sync-external-store" "^0.0.3"
7302+
"@babel/runtime" "^7.15.4"
7303+
"@types/react-redux" "^7.1.20"
72887304
hoist-non-react-statics "^3.3.2"
7289-
react-is "^18.0.0"
7290-
use-sync-external-store "^1.0.0"
7305+
loose-envify "^1.4.0"
7306+
prop-types "^15.7.2"
7307+
react-is "^17.0.2"
72917308

72927309
react-select-fast-filter-options@^0.2.3:
72937310
version "0.2.3"
@@ -7449,6 +7466,13 @@ redux-thunk@^2.2.0:
74497466
resolved "https://registry.yarnpkg.com/redux-thunk/-/redux-thunk-2.4.1.tgz#0dd8042cf47868f4b29699941de03c9301a75714"
74507467
integrity sha512-OOYGNY5Jy2TWvTL1KgAlVy6dcx3siPJ1wTq741EPyUKfn6W6nChdICjZwCd0p8AZBs5kWpZlbkXW2nE/zjUa+Q==
74517468

7469+
redux@^4.0.0:
7470+
version "4.2.1"
7471+
resolved "https://registry.yarnpkg.com/redux/-/redux-4.2.1.tgz#c08f4306826c49b5e9dc901dee0452ea8fce6197"
7472+
integrity sha512-LAUYz4lc+Do8/g7aeRa8JkyDErK6ekstQaqWQrNRW//MY1TvCEpMtpTWvlQ+FPbWCx+Xixu/6SHt5N0HR+SB4w==
7473+
dependencies:
7474+
"@babel/runtime" "^7.9.2"
7475+
74527476
redux@^4.2.0:
74537477
version "4.2.0"
74547478
resolved "https://registry.yarnpkg.com/redux/-/redux-4.2.0.tgz#46f10d6e29b6666df758780437651eeb2b969f13"
@@ -8553,11 +8577,6 @@ url-parse@^1.5.3:
85538577
querystringify "^2.1.1"
85548578
requires-port "^1.0.0"
85558579

8556-
use-sync-external-store@^1.0.0:
8557-
version "1.2.0"
8558-
resolved "https://registry.yarnpkg.com/use-sync-external-store/-/use-sync-external-store-1.2.0.tgz#7dbefd6ef3fe4e767a0cf5d7287aacfb5846928a"
8559-
integrity sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA==
8560-
85618580
util-deprecate@^1.0.1, util-deprecate@^1.0.2, util-deprecate@~1.0.1:
85628581
version "1.0.2"
85638582
resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"

0 commit comments

Comments
 (0)