Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/github_actions/github-actions-96a…
Browse files Browse the repository at this point in the history
…cbeb950
  • Loading branch information
Razzmatazzz authored Feb 3, 2024
2 parents b0b919d + 053ea65 commit 89f5c65
Show file tree
Hide file tree
Showing 10 changed files with 558 additions and 460 deletions.
562 changes: 283 additions & 279 deletions package-lock.json

Large diffs are not rendered by default.

30 changes: 15 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,28 +24,28 @@
},
"devDependencies": {
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"prettier": "^3.1.1"
"prettier": "^3.2.4"
},
"dependencies": {
"@emotion/styled": "^11.11.0",
"@mdi/js": "^6.9.96",
"@mdi/react": "^1.6.1",
"@mui/lab": "^5.0.0-alpha.160",
"@mui/material": "^5.15.4",
"@reduxjs/toolkit": "^2.0.1",
"@testing-library/jest-dom": "^6.2.0",
"@testing-library/react": "^14.1.2",
"@mui/lab": "^5.0.0-alpha.163",
"@mui/material": "^5.15.7",
"@reduxjs/toolkit": "^2.1.0",
"@testing-library/jest-dom": "^6.4.0",
"@testing-library/react": "^14.2.0",
"@tippyjs/react": "^4.2.6",
"classnames": "^2.5.1",
"critical": "^6.0.5",
"cross-fetch": "^4.0.0",
"dayjs": "^1.11.10",
"fast-deep-equal": "^3.1.3",
"framer-motion": "^10.18.0",
"framer-motion": "^11.0.3",
"fuse.js": "^7.0.0",
"i18next": "^23.7.16",
"i18next": "^23.8.2",
"i18next-browser-languagedetector": "^7.2.0",
"i18next-http-backend": "^2.4.2",
"i18next-http-backend": "^2.4.3",
"intersection-observer": "^0.12.2",
"leaflet": "^1.9.4",
"leaflet-fullscreen": "^1.0.2",
Expand All @@ -59,24 +59,24 @@
"react-error-boundary": "^4.0.12",
"react-helmet": "^6.1.0",
"react-hotkeys-hook": "^4.4.4",
"react-i18next": "^14.0.0",
"react-intersection-observer": "^9.5.3",
"react-i18next": "^14.0.1",
"react-intersection-observer": "^9.5.4",
"react-loader-spinner": "^6.1.6",
"react-query": "^3.39.3",
"react-redux": "^9.0.4",
"react-router-dom": "^6.21.2",
"react-redux": "^9.1.0",
"react-router-dom": "^6.21.3",
"react-router-hash-link": "^2.4.3",
"react-scripts": "^5.0.1",
"react-select": "^5.8.0",
"react-simple-image-viewer": "1.2.2",
"react-switch": "^7.0.0",
"react-syntax-highlighter": "^15.5.0",
"react-table": "^7.8.0",
"react-zoom-pan-pinch": "^3.3.0",
"react-zoom-pan-pinch": "^3.4.0",
"resize-observer-polyfill": "^1.5.1",
"sharp": "^0.33.2",
"source-map-explorer": "^2.5.3",
"victory": "^36.8.1"
"victory": "^36.8.5"
},
"jest": {
"transformIgnorePatterns": []
Expand Down
11 changes: 11 additions & 0 deletions src/components/item-image/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ function ItemImage({
linkToItem = false,
fullNameTooltip = false,
trader,
station,
className,
style,
}) {
Expand Down Expand Up @@ -356,6 +357,16 @@ function ItemImage({
</Link>
</Tippy>
</div>}
{station && <div style={traderElementStyle}>
<Tippy
placement="top"
content={station.name}
>
<Link to={`/hideout-profit/?station=${station.normalizedName}&all=true&search=${item.name}`}>
<img alt={station.name} src={`/images/stations/${station.normalizedName}-icon.png`} style={traderImageStyle}/>
</Link>
</Tippy>
</div>}
{children}
{isViewerOpen && (
<ImageViewer
Expand Down
1 change: 1 addition & 0 deletions src/components/quest-items-cell/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ function QuestItemsCell({ questItems }) {
<div className="amount-wrapper">
{t('Amount')}
<span>:</span> {questItem.count.toLocaleString()}
{questItem.alternates ? ` (${t('has alternates')})` : ''}
</div>
<div className="reward-type-wrapper">
{
Expand Down
12 changes: 8 additions & 4 deletions src/components/quest-table/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import './index.css';

export function getRequiredQuestItems(quest, itemFilter = false) {
const requiredItems = [];
const addItem = (item, count = 1, foundInRaid = false) => {
const addItem = (item, count = 1, foundInRaid = false, alternates = false) => {
if (itemFilter && item.id !== itemFilter) {
return;
}
Expand All @@ -28,15 +28,19 @@ export function getRequiredQuestItems(quest, itemFilter = false) {
req = {
item: item,
count: 0,
foundInRaid: foundInRaid
foundInRaid: foundInRaid,
alternates: alternates
};
requiredItems.push(req);
}
req.count += count;
};
quest.objectives.forEach((objectiveData) => {
if (objectiveData.item?.id && objectiveData.type !== 'findItem') {
addItem(objectiveData.item, objectiveData.count || 1, objectiveData.foundInRaid);
if (objectiveData.items && objectiveData.type !== 'findItem') {
const alternates = objectiveData.items.length > 1;
for (const objItem of objectiveData.items) {
addItem(objItem, objectiveData.count || 1, objectiveData.foundInRaid, alternates);
}
}
if (objectiveData.markerItem?.id) {
addItem(objectiveData.markerItem);
Expand Down
15 changes: 14 additions & 1 deletion src/features/quests/do-fetch-quests.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ class QuestsQuery extends APIQuery {
count
}
...on TaskObjectiveItem {
item {
items {
id
}
count
Expand Down Expand Up @@ -374,6 +374,19 @@ class QuestsQuery extends APIQuery {
id
}
}
craftUnlock {
id
station {
id
}
level
rewardItems {
item {
id
}
count
}
}
skillLevelReward {
name
level
Expand Down
20 changes: 13 additions & 7 deletions src/pages/crafts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,15 @@ function Crafts() {

useEffect(() => {
setNameFilter(searchParams.get('search') || '');
}, [searchParams]);
const station = searchParams.get('station');
if (station) {
setSelectedStation(station);
}
const all = searchParams.get('all');
if (all) {
setShowAll(all === 'true');
}
}, [searchParams, setSelectedStation, setShowAll]);

const { data: crafts } = useCraftsData();

Expand Down Expand Up @@ -82,7 +90,7 @@ function Crafts() {
<ToggleFilter
checked={showAll}
label={t('Ignore settings')}
onChange={(e) => setShowAll(!showAll)}
onChange={(e) => setSearchParams({'all': `${!showAll}`})}
tooltipContent={
<>
{t('Shows all crafts regardless of your settings')}
Expand Down Expand Up @@ -117,9 +125,7 @@ function Crafts() {
src={`${process.env.PUBLIC_URL}/images/stations/${station.normalizedName}-icon.png`}
/>
}
onClick={setSelectedStation.bind(
undefined,
station.normalizedName)}
onClick={() => {setSearchParams({'station': station.normalizedName})}}
/>
);
})}
Expand All @@ -131,7 +137,7 @@ function Crafts() {
}
selected={selectedStation === 'top'}
content={t('Best')}
onClick={setSelectedStation.bind(undefined, 'top')}
onClick={() => {setSearchParams({'station': 'top'})}}
/>
<ButtonGroupFilterButton
tooltipContent={
Expand All @@ -141,7 +147,7 @@ function Crafts() {
}
selected={selectedStation === 'banned'}
content={<Icon path={mdiCancel} size={1} className="icon-with-text"/>}
onClick={setSelectedStation.bind(undefined, 'banned')}
onClick={() => {setSearchParams({'station': 'banned'})}}
/>
</ButtonGroupFilter>
<ButtonGroupFilter>
Expand Down
95 changes: 76 additions & 19 deletions src/pages/quest/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import useQuestsData from '../../features/quests/index.js';
import useTradersData from '../../features/traders/index.js';
import useItemsData from '../../features/items/index.js';
import useMapsData from '../../features/maps/index.js';
import useHideoutData from '../../features/hideout/index.js';

import './index.css';

Expand Down Expand Up @@ -56,6 +57,8 @@ function Quest() {

const { data: quests, status: questsStatus } = useQuestsData();

const { data: stations } = useHideoutData();

let currentQuest = useMemo(() => {
return quests.find((quest) => {
if (quest.id === taskIdentifier) {
Expand Down Expand Up @@ -428,17 +431,37 @@ function Quest() {
);
}
if (objective.type === 'giveItem' || objective.type === 'findItem') {
let item = items.find((i) => i.id === objective.item.id);
if (!item)
let itemElements = [];
let countElement = '';
for (const objItem of objective.items) {
let item = items.find((i) => i.id === objItem.id);
if (!item)
continue;
if (item.properties?.defaultPreset) {
const preset = items.find(i => i.id === item.properties.defaultPreset.id);
item = {
...item,
baseImageLink: preset.baseImageLink,
width: preset.width,
height: preset.height,
};
}
itemElements.push(
<ItemImage
key={item.id}
item={item}
imageField="baseImageLink"
linkToItem={true}
count={objective.count > 1 && objective.items.length === 1 ? objective.count : false}
isFIR={objective.foundInRaid}
/>
);
}
if (itemElements.length < 1) {
return null;
if (item.properties?.defaultPreset) {
const preset = items.find(i => i.id === item.properties.defaultPreset.id);
item = {
...item,
baseImageLink: preset.baseImageLink,
width: preset.width,
height: preset.height,
};
}
if (itemElements.length > 1 && objective.count > 1) {
countElement = <div>{t('{{itemCount}}x any of', {itemCount: objective.count})}:</div>;
}
const attributes = [];
if (objective.dogTagLevel) {
Expand All @@ -462,13 +485,17 @@ function Quest() {
taskDetails = (
<>
<>
<ItemImage
item={item}
imageField="baseImageLink"
linkToItem={true}
count={objective.count > 1 ? objective.count : false}
isFIR={objective.foundInRaid}
/>
{countElement}
<ul className="quest-item-list">
{itemElements.map((el, i) =>
<li
key={`objective-item-${i}`}
className={'quest-list-item'}
>
{el}
</li>
)}
</ul>
</>
{attributes.length > 0 && (
<ul>
Expand Down Expand Up @@ -502,7 +529,7 @@ function Quest() {
);
}
if (objective.type === 'plantItem') {
let item = items.find((i) => i.id === objective.item.id);
let item = items.find((i) => i.id === objective.items[0].id);
if (!item)
return null;
if (item.properties?.defaultPreset) {
Expand Down Expand Up @@ -802,6 +829,11 @@ function Quest() {
</div>
);
}
if (objective.type === 'playerLevel') {
taskDetails = <div>
{t('Reach level {{playerLevel}}', {playerLevel: objective.playerLevel})}
</div>
}
let objectiveDescription = null;
if (objective.description) {
objectiveDescription = <h3>{`✔️ ${objective.description} ${objective.optional ? `(${t('optional')})` : ''}`}</h3>;
Expand Down Expand Up @@ -942,7 +974,32 @@ function Quest() {
})}
</ul>
</div>
)];
),
rewards.craftUnlock?.length > 0 && (
<div key="reward-craft">
<h3>{t('Craft Unlock')}</h3>
<ul className="quest-item-list">
{rewards.craftUnlock.map((unlock, index) => {
const station = stations.find((s) => s.id === unlock.station.id);
const item = items.find((i) => i.id === unlock.rewardItems[0].item.id);
if (!item)
return null;
return (
<li className="quest-list-item" key={`${unlock.rewardItems[0].item.id}-${index}`}>
<ItemImage
key={`reward-index-${item.id}-${index}`}
item={item}
imageField="baseImageLink"
linkToItem={true}
station={station}
count={unlock.level}
/>
</li>
);
})}
</ul>
</div>
),];
};

return [
Expand Down
4 changes: 3 additions & 1 deletion src/translations/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -577,5 +577,7 @@
"achievements-page-description": "This page includes information on the achievements that can be earned.",
"Description": "Description",
"Hidden": "Hidden",
"Player %": "Player %"
"Player %": "Player %",
"has alternates": "has alternates",
"{{itemCount}}x any of": "{{itemCount}}x any of"
}
Loading

0 comments on commit 89f5c65

Please sign in to comment.