"use strict";
require("core-js/modules/es.array.iterator.js");
require("core-js/modules/es.object.to-string.js");
require("core-js/modules/es.string.iterator.js");
require("core-js/modules/es.weak-map.js");
require("core-js/modules/web.dom-collections.iterator.js");
require("core-js/modules/es.object.get-own-property-descriptor.js");
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
var _typeof = require("@babel/runtime/helpers/typeof");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
require("core-js/modules/es.function.name.js");
require("core-js/modules/es.symbol.js");
require("core-js/modules/es.symbol.description.js");
var bootstrap = _interopRequireWildcard(require("react-bootstrap"));
var _dragAndDropImage = _interopRequireDefault(require("../../input/drag-and-drop-image"));
var _react = _interopRequireDefault(require("react"));
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
/*
* Copyright (C) 2016 Max Prettyjohns
* 2023 Meziyum
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
var Card = bootstrap.Card,
Col = bootstrap.Col,
Container = bootstrap.Container,
Row = bootstrap.Row;
/* eslint-disable sort-keys */
var maxAchievementProgress = {
1: 1,
2: 50,
3: 250,
4: 1,
5: 10,
6: 100,
7: 1,
8: 10,
9: 100,
10: 10,
11: 7,
12: 30,
13: 1,
14: 1,
15: 1,
16: 10,
17: 100,
18: 1,
19: 10,
20: 100,
21: 1,
22: 10,
23: 100,
24: 10,
25: 100,
26: 1000,
27: 1,
28: 1,
29: 10,
30: 100
};
/* eslint-enable sort-keys */
/**
* Achievement Component
*
* A React component that displays an achievement card with its details, including name,
* description, badge image, and progress if the achievement is locked.
*
* @component
*
* @param {Object} props - The props for the Achievement component.
* @param {Achievement} props.achievement - The achievement object containing details.
* @param {number} props.counter - The current progress or counter for the achievement.
* @param {boolean} props.unlocked - A boolean indicating whether the achievement is unlocked.
*
* @returns {JSX.Element} The rendered Achievement card component.
*/
function AchievementComponent(_ref) {
var _maxAchievementProgre;
var achievement = _ref.achievement;
var id = achievement.id,
name = achievement.name,
description = achievement.description,
badgeUrl = achievement.badgeUrl,
counter = achievement.counter,
unlocked = achievement.unlocked;
var imgElement = unlocked ? /*#__PURE__*/_react.default.createElement(_dragAndDropImage.default, {
achievementId: id,
achievementName: name,
height: "100px",
src: badgeUrl
}) : /*#__PURE__*/_react.default.createElement("img", {
alt: name,
height: "100px",
src: badgeUrl
});
return /*#__PURE__*/_react.default.createElement(Card, {
bg: "light"
}, /*#__PURE__*/_react.default.createElement(Container, {
fluid: true
}, /*#__PURE__*/_react.default.createElement(Row, null, /*#__PURE__*/_react.default.createElement(Col, {
md: 2
}, imgElement), /*#__PURE__*/_react.default.createElement(Col, {
md: 8
}, /*#__PURE__*/_react.default.createElement("div", {
className: "h2"
}, name), /*#__PURE__*/_react.default.createElement("p", null, description)), !unlocked && /*#__PURE__*/_react.default.createElement(Col, null, /*#__PURE__*/_react.default.createElement("div", {
className: "h3"
}, counter, "/", (_maxAchievementProgre = maxAchievementProgress[achievement.id]) !== null && _maxAchievementProgre !== void 0 ? _maxAchievementProgre : 0)))));
}
AchievementComponent.displayName = 'achievement';
var _default = AchievementComponent;
exports.default = _default;
//# sourceMappingURL=achievement.js.map