Skip to content

Commit

Permalink
Merge pull request #1428 from ThingEngineering/main
Browse files Browse the repository at this point in the history
Deploy
  • Loading branch information
madcowfred authored Jan 22, 2025
2 parents 44cbd7c + da6255e commit a8f0ade
Show file tree
Hide file tree
Showing 17 changed files with 713 additions and 295 deletions.
4 changes: 1 addition & 3 deletions apps/frontend/components/achievements/CriteriaTree.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@
import { forceShowCriteriaTree } from '@/data/achievements';
import { CriteriaTreeOperator } from '@/enums/criteria-tree-operator'
import { CriteriaType } from '@/enums/criteria-type'
import { Faction } from '@/enums/faction';
import { staticStore } from '@/shared/stores/static'
import { achievementStore, userAchievementStore } from '@/stores'
import type { AchievementDataAchievement, AchievementDataCriteria, AchievementDataCriteriaTree } from '@/types'
import FactionIcon from '@/shared/components/images/FactionIcon.svelte';
import ParsedText from '@/shared/components/parsed-text/ParsedText.svelte';
import ProgressBar from '@/components/common/ProgressBar.svelte'
import WowheadLink from '@/shared/components/links/WowheadLink.svelte'
import YesNoIcon from '@/shared/components/icons/YesNoIcon.svelte'
import ParsedText from '@/shared/components/parsed-text/ParsedText.svelte';
export let accountWide = false
export let achievement: AchievementDataAchievement
Expand Down
3 changes: 1 addition & 2 deletions apps/frontend/components/achievements/ScoreSummary.svelte
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
<script lang="ts">
import { achievementStore, userAchievementStore } from '@/stores'
import getPercentClass from '@/utils/get-percent-class';
import type { AchievementDataCategory } from '@/types'
import AchievementsAchievement from './Achievement.svelte'
import ProgressBar from '@/components/common/ProgressBar.svelte'
import { StaticDataEnchantment } from '@/shared/stores/static/types/enchantment';
import getPercentClass from '@/utils/get-percent-class';
let categories: AchievementDataCategory[]
$: {
Expand Down
2 changes: 1 addition & 1 deletion apps/frontend/components/achievements/get-account-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export function getAccountData(
(achievement.faction === 1 && char.faction === 0) ||
achievement.faction === -1,
);
const characterIds = characters.map((char) => char.id);
// const characterIds = characters.map((char) => char.id);

const rootCriteriaTree = achievementData.criteriaTree[achievement.criteriaTreeId];
const forcedId = forceAddonCriteria[achievement.id];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts">
import { abominations, CovenantAbomination } from '@/data/covenant'
import { itemStore, userAchievementStore, userQuestStore } from '@/stores'
import { itemStore, userQuestStore } from '@/stores'
import { basicTooltip } from '@/shared/utils/tooltips'
import type { Character, CharacterShadowlandsCovenantFeature } from '@/types'
Expand Down
6 changes: 5 additions & 1 deletion apps/frontend/components/journal/JournalItem.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,11 @@
{@const ability = $staticStore.professionAbilityByItemId[item.id]}
{#if ability}
<div class="player-class">
<ProfessionIcon id={ability.professionId} />
<ProfessionIcon
border={2}
size={20}
id={ability.professionId}
/>
</div>
{/if}
{/if}
Expand Down
17 changes: 17 additions & 0 deletions apps/frontend/components/journal/JournalOptions.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
}
let byMisc = [
state.showMounts ? 'M' : '-',
state.showPets ? 'P' : '-',
state.showRecipes ? 'R' : '-',
state.showTrash ? 'T' : '-',
]
Expand Down Expand Up @@ -172,12 +174,27 @@
class="options-container filters-container"
style:display={$journalState.filtersExpanded ? null : 'none'}
>
<button>
<CheckboxInput
name="show_mounts"
bind:value={$journalState.showMounts}
>Mounts</CheckboxInput>
</button>

<button>
<CheckboxInput
name="show_pets"
bind:value={$journalState.showPets}
>Pets</CheckboxInput>
</button>

<button>
<CheckboxInput
name="show_recipes"
bind:value={$journalState.showRecipes}
>Recipes</CheckboxInput>
</button>

<button>
<CheckboxInput
name="show_trash"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
import { BindType } from '@/enums/bind-type'
import { SkillSourceType } from '@/enums/skill-source-type'
import { iconLibrary } from '@/shared/icons'
import { itemStore, userStore } from '@/stores'
import { settingsStore } from '@/shared/stores/settings';
import { staticStore } from '@/shared/stores/static'
import { professionsRecipesState } from '@/stores/local-storage'
import { itemStore, lazyStore, userQuestStore, userStore } from '@/stores'
import { newNavState, professionsRecipesState } from '@/stores/local-storage'
import { basicTooltip } from '@/shared/utils/tooltips'
import { useCharacterFilter } from '@/utils/characters';
import type { Character, Expansion } from '@/types'
import type {
StaticDataProfession,
Expand Down Expand Up @@ -37,13 +39,31 @@
.filter((cat) => cat.abilities.length > 0)
subProfession = profession.expansionSubProfession[expansion.id]
characters = $userStore.characters.filter((char) =>
char.professions?.[profession.id]?.[subProfession.id]
)
characters.sort((a, b) => {
if (a.level !== b.level) { return b.level - a.level }
return a.name.localeCompare(b.name)
})
characters = [];
const collectorId = $settingsStore.professions.collectingCharacters?.[profession.id];
if (collectorId) {
characters.push(null);
characters.push($userStore.characterMap[collectorId]);
}
const professionCharacters = $userStore.characters.filter((char) => useCharacterFilter(
$lazyStore,
$settingsStore,
$userQuestStore,
(c) => c.id !== collectorId &&
!!c.professions?.[profession.id]?.[subProfession.id],
char,
$newNavState.characterFilter
))
if (professionCharacters.length > 0) {
characters.push(null);
professionCharacters.sort((a, b) => {
if (a.level !== b.level) { return b.level - a.level }
return a.name.localeCompare(b.name)
});
characters.push(...professionCharacters);
}
colspan = 3 + characters.length
}
Expand Down Expand Up @@ -144,14 +164,16 @@
</th>
{#each characters as character}
<th class="character-icon">
<div>
<ClassIcon
{character}
border={2}
size={40}
/>
<span class="pill abs-center">{character.name.slice(0, 5)}</span>
</div>
{#if character !== null}
<div>
<ClassIcon
{character}
border={2}
size={40}
/>
<span class="pill abs-center">{character.name.slice(0, 5)}</span>
</div>
{/if}
</th>
{/each}
</tr>
Expand Down Expand Up @@ -218,15 +240,19 @@
</td>

{#each characters as character}
{@const charProf = character.professions[profession.id][subProfession.id]}
{@const charHas = charProf.knownRecipes?.indexOf(ability.id) >= 0}
<td
class="status"
class:status-success={charHas}
class:status-fail={!charHas}
>
<YesNoIcon state={charHas} />
</td>
{#if character === null}
<td class="spacer"></td>
{:else}
{@const charProf = character.professions[profession.id][subProfession.id]}
{@const charHas = charProf.knownRecipes?.indexOf(ability.id) >= 0}
<td
class="status"
class:status-success={charHas}
class:status-fail={!charHas}
>
<YesNoIcon state={charHas} />
</td>
{/if}
{/each}
</tr>
{/each}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { componentTooltip } from '@/shared/utils/tooltips'
import { userQuestStore } from '@/stores'
import type { Character } from '@/types'
import type { UserQuestData, UserQuestDataCharacterProgress } from '@/types/data'
import type { UserQuestDataCharacterProgress } from '@/types/data'
import type { ManualDataProgressGroup } from '@/types/data/manual'
import IconifyIcon from '@/shared/components/images/IconifyIcon.svelte'
Expand Down
2 changes: 1 addition & 1 deletion apps/frontend/shared/stores/db/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class DbDataStore extends WritableFancyStore<DbData> {
for (const tagName of query.tags || []) {
const tagId = this.value.tagsByName[tagName];
if (!tagId) {
console.warn('Invalid db tag:', tagName);
// console.warn('Invalid db tag:', tagName);
continue;
}

Expand Down
1 change: 1 addition & 0 deletions apps/frontend/shared/stores/settings/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ function createSettingsStore() {
store.set(settings);
} else {
merge(currentSettings, settings);
store.set(currentSettings);
}
},
subscribe: store.subscribe,
Expand Down
1 change: 0 additions & 1 deletion apps/frontend/stores/lazy/vendors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ export function doVendors(stores: LazyStores): LazyVendors {

for (const entry of dbStore.search({ tags: [tagName] })) {
dbMap[entry.id] = entry.asVendor();
console.log(dbMap[entry.id]);
vendorIds.push(entry.id);
}
}
Expand Down
2 changes: 2 additions & 0 deletions apps/frontend/stores/local-storage/journal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ export class JournalState {
public showCloaks = true;
public showWeapons = true;

public showMounts = true;
public showPets = true;
public showRecipes = true;
public showTrash = true;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
export let view: SettingsView
const sortByChoices: SettingsChoice[] = [
const initialChoices: SettingsChoice[] = [
{id: 'account', name: 'Account'},
{id: 'enabled', name: 'Account status'},
{id: 'armor', name: 'Armor: Cloth > Plate'},
Expand All @@ -24,12 +24,16 @@
{id: 'itemlevel', name: 'Item level'},
{id: 'level', name: 'Level'},
]
let sortByChoices: SettingsChoice[]
$: {
sortByChoices.push(...orderBy(
$settingsStore.tags,
(tag) => tag.name,
).map((tag) => ({ id: `tag:${tag.id}`, name: `Tag: ${tag.name}` })));
sortByChoices = [
...initialChoices,
...orderBy(
$settingsStore.tags,
(tag) => tag.name,
).map((tag) => ({ id: `tag:${tag.id}`, name: `Tag: ${tag.name}` }))
];
}
</script>

Expand Down
6 changes: 3 additions & 3 deletions apps/frontend/utils/get-active-holidays.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export function getActiveHolidays(
for (const startDate of holiday.startDates) {
// Repeats, duration0 is duration and duration1 is time between
if (holiday.looping === 1) {
let actualStartDate = addOffset(startDate, holiday.regionMask);
let actualStartDate = addOffset(startDate/*, holiday.regionMask*/);
while (actualStartDate < currentTime) {
const endDate = actualStartDate.plus({ hours: holiday.durations[0] });
if (endDate > currentTime) {
Expand All @@ -61,7 +61,7 @@ export function getActiveHolidays(
holiday.durations.length > 1
? startDate.plus({ hours: holiday.durations[0] })
: startDate,
holiday.regionMask,
//holiday.regionMask,
);
const endDate = actualStartDate.plus({
hours: holiday.durations[holiday.durations.length - 1],
Expand All @@ -83,7 +83,7 @@ export function getActiveHolidays(
return activeHolidays;
}

function addOffset(dateTime: DateTime, regionMask: number): DateTime {
function addOffset(dateTime: DateTime/*, regionMask: number*/): DateTime {
// US
// if (regionMask === 1) {
// return dateTime.plus({ hours: -7 });
Expand Down
6 changes: 6 additions & 0 deletions apps/frontend/utils/journal/get-filtered-items.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ export default function getFilteredItems(
else if (keep && weaponGroups[group.name] === true) {
keep = journalState.showWeapons
}
else if (keep && group.name === 'Mount') {
keep = journalState.showMounts;
}
else if (keep && group.name === 'Pet') {
keep = journalState.showPets;
}
else if (keep && group.name === 'Recipe') {
keep = journalState.showRecipes;
}
Expand Down
Loading

0 comments on commit a8f0ade

Please sign in to comment.