Skip to content

Commit

Permalink
Merge pull request #830 from the-hideout/map-labels
Browse files Browse the repository at this point in the history
Add capability to add labels to maps
  • Loading branch information
Shebuka authored Jan 26, 2024
2 parents 9af2cab + d5484d0 commit a722f12
Show file tree
Hide file tree
Showing 20 changed files with 358 additions and 322 deletions.
2 changes: 1 addition & 1 deletion src/components/data-table/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ function DataTable({
{headerGroups.map((headerGroup) => (
<tr {...headerGroup.getHeaderGroupProps()}>
{headerGroup.headers.map((column) => (
<th {...column.getHeaderProps(column.getSortByToggleProps())}>
<th {...column.getHeaderProps(column.getSortByToggleProps({ title: undefined }))}>
<span>
{column.render('Header')}
</span>
Expand Down
35 changes: 15 additions & 20 deletions src/components/quest-table/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,27 +246,14 @@ function QuestTable({

let completedPassed = true;
if (hideCompleted) {
completedPassed = !settings.completedQuests.some(taskId => taskId === quest.id);
completedPassed = !settings.completedQuests.includes(quest.id) && !settings.failedQuests.includes(quest.id);
}

let lockedPassed = true;
if (hideLocked) {
for (const req of quest.traderRequirements.filter(req => req.requirementType === 'level')) {
const trader = traders.find(t => t.id === req.trader.id);
if (settings[trader.normalizedName] < req.value) {
lockedPassed = false;
break;
}
}
for (const req of quest.taskRequirements) {
const questReq = allQuestData.find(q => q.id === req.task.id);
if (req.status.includes('complete')) {
const isComplete = settings.completedQuests.some(taskId => taskId === questReq.id);
if (!isComplete) {
lockedPassed = false;
break;
}
}
lockedPassed = quest.active;
if (!hideCompleted && !quest.active) {
lockedPassed = settings.completedQuests.includes(quest.id) || settings.failedQuests.includes(quest.id);
}
}

Expand All @@ -275,7 +262,6 @@ function QuestTable({
}, [
settings,
allQuestData,
traders,
hideCompleted,
hideLocked,
]);
Expand Down Expand Up @@ -368,7 +354,16 @@ function QuestTable({
if (!reqQuest)
return null;
let completedIcon = '';
if (req.status.includes('complete') && settings.completedQuests.includes(questData.id)) {
if (req.status.includes('complete') && settings.completedQuests.includes(req.task.id)) {
completedIcon = (
<Icon
path={mdiClipboardCheck}
size={0.75}
className="icon-with-text"
/>
);
}
if (completedIcon === '' && req.status.includes('failed') && settings.failedQuests.includes(req.task.id)) {
completedIcon = (
<Icon
path={mdiClipboardCheck}
Expand All @@ -377,7 +372,7 @@ function QuestTable({
/>
);
}
if (req.status.length === 1 && req.status[0] === 'active' && settings.completedQuests.includes(questData.id)) {
if (completedIcon === '' && req.status.length === 1 && req.status[0] === 'active' && (settings.completedQuests.includes(req.task.id) || settings.failedQuests.includes(req.task.id))) {
completedIcon = (
<Icon
path={mdiClipboardRemove}
Expand Down
22 changes: 20 additions & 2 deletions src/data/maps.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@
"maxZoom": 5,
"transform": [0.38, 0, 0.38, 0],
"coordinateRotation": 180,
"bounds": [[324, -215], [-279, 548]],
"bounds": [[324, -285], [-279, 548]],
"heightRange": [-6, 10],
"author": "Shebuka",
"authorLink": "https://github.com/TarkovTracker/tarkovdata/",
"svgPath": "https://assets.tarkov.dev/maps/svg/StreetsOfTarkov-Ground_Level.svg",
"svgBounds": [[324, -215], [-279, 548]],
"layers": [
{
"name": "Underground",
Expand Down Expand Up @@ -233,7 +234,7 @@
"height": [5.7, 1000],
"bounds": [
[[580, -104], [532, -134], "dead scav warehouse"],
[[-199, -90], [-210, -114], "big red 2nd"],
[[-199, -90], [-223, -131], "big red 2nd"],
[[239, 3], [169, -160], "skeleton"],
[[336, -56], [316, -95], "switch snipe"],
[[584, -46], [556, -92], "USEC 2nd"],
Expand Down Expand Up @@ -262,6 +263,16 @@
}
]
}
],
"_labels": [
{
"position": [-212, -123],
"text": "Big Red"
},
{
"position": [202, 149],
"text": "Dorms"
}
]
},
{
Expand Down Expand Up @@ -331,6 +342,13 @@
}
]
}
],
"_labels": [
{
"position": [19, 41],
"text": "Office",
"bottom": 0
}
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion src/features/barters/do-fetch-barters.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class BartersQuery extends APIQuery {
}

async query(language, prebuild = false) {
const query = `{
const query = `query TarkovDevBarters {
barters(lang: ${language}) {
rewardItems {
item {
Expand Down
2 changes: 1 addition & 1 deletion src/features/bosses/do-fetch-bosses.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class BossesQuery extends APIQuery {
}

async query(language, prebuild = false) {
const query = `{
const query = `query TarkovDevBosses {
bosses(lang: ${language}) {
name
normalizedName
Expand Down
2 changes: 1 addition & 1 deletion src/features/crafts/do-fetch-crafts.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class CraftsQuery extends APIQuery {
}

async query(language, prebuild = false) {
const query = `{
const query = `query TarkovDevCrafts {
crafts(lang: ${language}) {
station {
id
Expand Down
2 changes: 1 addition & 1 deletion src/features/hideout/do-fetch-hideout.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import graphqlRequest from '../../modules/graphql-request.mjs';

const doFetchHideout = async (language, prebuild = false) => {
const query = `{
const query = `query TarkovDevHideout {
hideoutStations(lang: ${language}) {
id
name
Expand Down
Loading

0 comments on commit a722f12

Please sign in to comment.