Skip to content

Commit

Permalink
Merge pull request #9986 from DestinyItemManager/unused
Browse files Browse the repository at this point in the history
  • Loading branch information
bhollis authored Oct 21, 2023
2 parents 032c7cb + e08c494 commit 3690c11
Show file tree
Hide file tree
Showing 24 changed files with 20 additions and 92 deletions.
1 change: 0 additions & 1 deletion config/i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,6 @@
"CreateTitle": "Create In-Game Loadout From Current Equipment",
"CurrentlyEquipped": "Currently Equipped",
"PrepareEquip": "Prepare Equip",
"Applying": "Equipping loadout...",
"EditIdentifiers": "Edit Identifiers",
"EditTitle": "Edit Loadout Name and Icon",
"EditFailed": "Failed to update loadout",
Expand Down
29 changes: 0 additions & 29 deletions src/app/bungie-api/http-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,35 +94,6 @@ function throwBungieError<T>(serverResponse: T | undefined, request: Request) {
// FETCH UTILS
//

/**
* returns a fetch-like that will abort the request after some time
*
* @param fetchFunction use this function to make the request
* @param timeout abort request after this many milliseconds
*/
export function createFetchWithTimeout(fetchFunction: typeof fetch, timeout: number): typeof fetch {
return async (...[input, init]: Parameters<typeof fetch>) => {
const controller = typeof AbortController === 'function' ? new AbortController() : null;
const signal = controller?.signal;
let timer: NodeJS.Timeout | undefined = undefined;

if (controller) {
timer = setTimeout(() => controller.abort(), timeout);
if (typeof input === 'string') {
input = new Request(input);
}
init = { ...init, signal };
}
try {
return await fetchFunction(input, init);
} finally {
if (timer !== undefined) {
clearTimeout(timer);
}
}
};
}

/**
* returns a fetch-like that will run a function if the request is taking a long time,
* e.g. generate a "still waiting!" notification
Expand Down
2 changes: 1 addition & 1 deletion src/app/css-variables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export default function updateCSSVariables() {
/**
* Read the --theme-pwa-background CSS variable and use it to set the meta theme-color element.
*/
export function syncThemeColor(isPhonePortrait: boolean) {
function syncThemeColor(isPhonePortrait: boolean) {
let background = getComputedStyle(document.body).getPropertyValue('--theme-pwa-background');

// Extract tint from mobile header on mobile devices to match notch/dynamic island fill
Expand Down
3 changes: 0 additions & 3 deletions src/app/dim-api/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ export const collapsedSelector =
(state: RootState): boolean | undefined =>
settingsSelector(state).collapsedSections[sectionId];

export const oldCustomTotalSelector = (state: RootState) =>
settingsSelector(state).customTotalStatsByClass;

export const customStatsSelector = (state: RootState) => settingsSelector(state).customStats;

export const apiPermissionGrantedSelector = (state: RootState) =>
Expand Down
18 changes: 0 additions & 18 deletions src/app/inventory/MoveNotifications.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -298,21 +298,3 @@ function MoveItemNotificationIcon({ completion }: { completion: Promise<unknown>
</div>
);
}

/**
* Generate JSX for applying an ingame loadout. This isn't a component.
*/
// TODO: build something more like DIM's loadout notification?
export function inGameLoadoutNotification(
loadout: InGameLoadout,
applyPromise: Promise<any>
): NotifyInput {
return {
promise: applyPromise,
duration: lingerMs,
title: loadout.name,
icon: <InGameLoadoutIcon loadout={loadout} />,
trailer: <MoveItemNotificationIcon completion={applyPromise} />,
body: t('InGameLoadout.Applying'),
};
}
4 changes: 2 additions & 2 deletions src/app/inventory/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export const profileResponseSelector = (state: RootState) =>
state.inventory.mockProfileData ?? state.inventory.profileResponse;

/** Whether or not the user is currently playing Destiny 2 */
export const userIsPlayingSelector = (state: RootState) =>
const userIsPlayingSelector = (state: RootState) =>
Boolean(state.inventory.profileResponse?.profileTransitoryData?.data);

/** The time when the currently displayed profile was last refreshed from live game data */
Expand Down Expand Up @@ -378,7 +378,7 @@ export const itemInfosSelector = (state: RootState): ItemInfos =>
/**
* DIM tags which should be applied to matching item hashes (instead of per-instance)
*/
export const itemHashTagsSelector = (state: RootState): { [itemHash: string]: ItemHashTag } =>
const itemHashTagsSelector = (state: RootState): { [itemHash: string]: ItemHashTag } =>
state.dimApi.itemHashTags;

/* Returns a function that can be used to get the tag for a particular item. */
Expand Down
4 changes: 2 additions & 2 deletions src/app/inventory/store/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const pinnacleCap = powerLevelByKeyword.pinnaclecap;
*
* This relies on a precalculated set generated from allItems, using getBucketsWithClassifiedItems.
*/
export function hasAffectingClassified(
function hasAffectingClassified(
unrestrictedMaxLightGear: DimItem[],
bucketsWithClassifieds: Set<number>
) {
Expand All @@ -32,7 +32,7 @@ export function hasAffectingClassified(
}

/** figures out which buckets contain classified items */
export function getBucketsWithClassifiedItems(allItems: DimItem[]) {
function getBucketsWithClassifiedItems(allItems: DimItem[]) {
const bucketsWithClassifieds = new Set<number>();
for (const i of allItems) {
if (i.classified && !i.power && (i.location.inWeapons || i.location.inArmor)) {
Expand Down
2 changes: 1 addition & 1 deletion src/app/item-popup/PlugTooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ export function PlugStats({ stats }: { stats: { statHash: number; value: number
);
}

export function StatValue({ value, statHash }: { value: number; statHash: number }) {
function StatValue({ value, statHash }: { value: number; statHash: number }) {
const defs = useD2Definitions()!;
const statDef = defs.Stat.get(statHash);
if (!statDef?.displayProperties.name) {
Expand Down
2 changes: 1 addition & 1 deletion src/app/item-popup/WeaponCraftedInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export function WeaponCraftedInfo({ item, className }: { item: DimItem; classNam
);
}

export function CraftedDataMedallion({ item }: { item: DimItem }) {
function CraftedDataMedallion({ item }: { item: DimItem }) {
const killTrackers = filterMap(
item.sockets?.allSockets.find((s) => isKillTrackerSocket(s))?.plugOptions ?? [],
(p) => plugToKillTracker(p)
Expand Down
3 changes: 0 additions & 3 deletions src/app/loadout-drawer/actions.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { createAction } from 'typesafe-actions';
import { Loadout } from './loadout-types';

/** Bulk update loadouts after they've been loaded. */
export const loaded = createAction('loadouts/LOADED')<Loadout[]>();

/** Delete a loadout by ID */
export const deleteLoadout = createAction('loadouts/DELETE')<string>();

Expand Down
6 changes: 3 additions & 3 deletions src/app/loadout-drawer/loadout-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export const fromEquippedTypes: (BucketHashes | D1BucketHashes)[] = [
];

// Bucket hashes, in order, that are contained within ingame loadouts
export const inGameLoadoutBuckets: BucketHashes[] = [
const inGameLoadoutBuckets: BucketHashes[] = [
BucketHashes.Subclass,
BucketHashes.KineticWeapons,
BucketHashes.EnergyWeapons,
Expand Down Expand Up @@ -600,7 +600,7 @@ export const potentialLoadoutItemsByItemId = weakMemoize((allItems: DimItem[]) =
* Get a mapping from crafted date to item, for items that could be in loadouts. Used for
* looking up items from loadouts.
*/
export const potentialLoadoutItemsByCraftedDate = weakMemoize((allItems: DimItem[]) =>
const potentialLoadoutItemsByCraftedDate = weakMemoize((allItems: DimItem[]) =>
_.keyBy(
allItems.filter((i) => i.id !== '0' && i.craftedInfo?.craftedDate && itemCanBeInLoadout(i)),
(i) => i.craftedInfo!.craftedDate
Expand All @@ -623,7 +623,7 @@ export function getInstancedLoadoutItem(allItems: DimItem[], loadoutItem: Loadou
* Get a mapping from item hash to item, for ininstanced items that could be in loadouts. Used for
* looking up items from loadouts.
*/
export const potentialUninstancedLoadoutItemsByHash = weakMemoize((allItems: DimItem[]) =>
const potentialUninstancedLoadoutItemsByHash = weakMemoize((allItems: DimItem[]) =>
_.groupBy(
allItems.filter((i) => itemCanBeInLoadout(i)),
(i) => i.hash
Expand Down
2 changes: 1 addition & 1 deletion src/app/loadout/ingame/ingame-loadout-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,6 @@ export function itemCouldBeEquipped(store: DimStore, item: DimItem, _stores: Dim
);
}

export function isValidGameLoadoutPlug(hash: number) {
function isValidGameLoadoutPlug(hash: number) {
return hash && hash !== UNSET_PLUG_HASH;
}
2 changes: 1 addition & 1 deletion src/app/loadout/ingame/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export interface FullyResolvedLoadout {
}

/** All loadouts relevant to a specific storeId, resolved to actual mods, and actual items */
export const fullyResolvedLoadoutsSelector = createSelector(
const fullyResolvedLoadoutsSelector = createSelector(
(_state: RootState, storeId: string) => storeId,
(state: RootState, storeId: string) => {
const stores = storesSelector(state);
Expand Down
2 changes: 1 addition & 1 deletion src/app/manifest/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const destiny2CoreSettingsSelector = (state: RootState) =>
export const rankProgressionHashesSelector = (state: RootState) =>
state.manifest.destiny2CoreSettings?.currentRankProgressionHashes ?? emptyArray<number>();

export const d1ManifestSelector = (state: RootState) => state.manifest.d1Manifest;
const d1ManifestSelector = (state: RootState) => state.manifest.d1Manifest;
export const d2ManifestSelector = (state: RootState) => state.manifest.d2Manifest;

export const manifestSelector = (state: RootState) =>
Expand Down
10 changes: 2 additions & 8 deletions src/app/records/PresentationNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,7 @@ function useScrollNodeIntoView(path: number[], presentationNodeHash: number) {
/**
* The little progress bar in the header of a presentation node that shows how much has been unlocked.
*/
export function PresentationNodeProgress({
acquired,
visible,
}: {
acquired: number;
visible: number;
}) {
function PresentationNodeProgress({ acquired, visible }: { acquired: number; visible: number }) {
return (
<div className={styles.nodeProgress}>
<div className={styles.nodeProgressCount}>
Expand All @@ -190,7 +184,7 @@ export function PresentationNodeProgress({
);
}

export function PresentationNodeTitle({
function PresentationNodeTitle({
displayProperties,
overrideName,
}: {
Expand Down
2 changes: 1 addition & 1 deletion src/app/records/Record.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ interface RecordInterval {

const catalystIconsTable = catalystIcons as HashLookup<string>;

export default function Record({
function Record({
record,
redactedRecordsRevealed,
}: {
Expand Down
2 changes: 1 addition & 1 deletion src/app/search/search-filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import { parseAndValidateQuery, rangeStringToComparator } from './search-utils';
* depend on every bit of data a filter might need to run, so that we regenerate the filter
* functions whenever any of them changes.
*/
export const filterContextSelector = createSelector(
const filterContextSelector = createSelector(
sortedStoresSelector,
allItemsSelector,
currentStoreSelector,
Expand Down
2 changes: 1 addition & 1 deletion src/app/search/specialty-modslots.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export interface ModSocketMetadata {
const legacyCompatibleTags = ['nightmare', 'gardenofsalvation', 'lastwish'];

/** The plug categories that will fit in "legacy" sockets */
export const legacyCompatiblePlugCategoryHashes = [
const legacyCompatiblePlugCategoryHashes = [
PlugCategoryHashes.EnhancementsSeasonMaverick, // nightmare
PlugCategoryHashes.EnhancementsSeasonOutlaw, // taken/lw
PlugCategoryHashes.EnhancementsRaidGarden,
Expand Down
4 changes: 0 additions & 4 deletions src/app/settings/CustomStatsSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -425,10 +425,6 @@ function createNewStatHash(existingCustomStats: CustomStatDef[]) {
return statHash;
}

export function normalizeStatLabel(s: string) {
return s.trim().slice(0, 30);
}

function warnInvalidCustomStat(errorMsg: string) {
showNotification({
type: 'warning',
Expand Down
3 changes: 0 additions & 3 deletions src/app/settings/actions.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { createAction, PayloadAction } from 'typesafe-actions';
import type { Settings } from './initial-settings';

/** Bulk update settings after they've been loaded. */
export const loaded = createAction('settings/LOADED')<Partial<Settings>>();

/** This one seems a bit like cheating, but it lets us set a specific property. */
export const setSettingAction = createAction(
'settings/SET',
Expand Down
2 changes: 1 addition & 1 deletion src/app/utils/intl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { LookupTable } from './util-types';
const dimLangToBrowserLang: LookupTable<DimLanguage, string> = _.invert(browserLangToDimLang);

/** Map DIM's locale values to a [BCP 47 language tag](http://tools.ietf.org/html/rfc5646) */
export function mapLocale(language: DimLanguage): Intl.BCP47LanguageTag {
function mapLocale(language: DimLanguage): Intl.BCP47LanguageTag {
return dimLangToBrowserLang[language] ?? language;
}

Expand Down
4 changes: 0 additions & 4 deletions src/app/utils/item-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,6 @@ const specialtyModPlugCategoryHashes = modSocketMetadata.flatMap(
(modMetadata) => modMetadata.compatiblePlugCategoryHashes
);

export const emptySpecialtySocketHashes = modSocketMetadata.map(
(modMetadata) => modMetadata.emptyModSocketHash
);

/** verifies an item is d2 armor and has one or more specialty mod sockets, which are returned */
const getSpecialtySockets = (item?: DimItem): DimSocket[] | undefined => {
if (item?.bucket.inArmor) {
Expand Down
2 changes: 1 addition & 1 deletion src/app/vendors/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export const vendorGroupsForCharacterSelector = currySelector(
)
);

export const subVendorsForCharacterSelector = currySelector(
const subVendorsForCharacterSelector = currySelector(
createSelector(
createItemContextSelector,
vendorsByCharacterSelector,
Expand Down
1 change: 0 additions & 1 deletion src/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,6 @@
"Vault": "Send item to vault"
},
"InGameLoadout": {
"Applying": "Equipping loadout...",
"ClearSlot": "Clear Slot {{index}}",
"Create": "Create Loadout",
"CreateTitle": "Create In-Game Loadout From Current Equipment",
Expand Down

0 comments on commit 3690c11

Please sign in to comment.