Skip to content

Commit

Permalink
Chore: Improve fast refresh in dev
Browse files Browse the repository at this point in the history
  • Loading branch information
marcustyphoon committed Sep 9, 2024
1 parent e1ca00d commit fc6546b
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 33 deletions.
4 changes: 2 additions & 2 deletions src/components/sections/affixes/CustomAffix.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
getCustomAffixText,
} from '../../../state/slices/priorities';

export const exampleAffix = `type: quadruple
const exampleAffix = `type: quadruple
bonuses:
major:
- Power
Expand All @@ -28,7 +28,7 @@ bonuses:
- Precision
- Vitality`;

export const exampleAffixJson = `{
const exampleAffixJson = `{
"type": "quadruple",
"bonuses": {
"major": ["Power", "Ferocity"],
Expand Down
2 changes: 1 addition & 1 deletion src/components/sections/extras/ExtraSelection.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import {
import { chunkArray } from '../../../utils/usefulFunctions';
import AmountInput from '../../baseComponents/AmountInput';
import Label from '../../baseComponents/Label';
import ModalContent, { formatApiText, joinWith } from './ModalContent';
import ModalContent, { formatApiText, joinWith } from './helpers';

// const roundPrice = (num) => Math.round(num / 100) * 100;
const roundPrice = (num) => Math.round(num / 10) * 10;
Expand Down
31 changes: 1 addition & 30 deletions src/components/sections/extras/ModalContent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { makeStyles } from 'tss-react/mui';
import { placeholderItem } from '../../../assets/modifierdata';
import { changeExtraIds, getExtrasIds } from '../../../state/slices/extras';
import Label from '../../baseComponents/Label';
import { formatApiText, joinWith } from './helpers';

const useStyles = makeStyles()((theme) => ({
root: {
Expand All @@ -44,36 +45,6 @@ function groupBy(xs, key) {
}, {});
}

const firstUppercase = (str) => str.charAt(0).toUpperCase() + str.slice(1);

export const formatApiText = (apiText) =>
firstUppercase(
apiText
.replace(/^Superior Sigil /, 'Sigil ')
.replace(/^Überlegenes Sigill /, 'Sigill ')
.replace(/^Sello superior /, 'Sello ')

.replace(/^Superior Rune /, 'Rune ')
.replace(/^Überlegene Rune /, 'Rune ')
.replace(/^Runa superior /, 'Runa ')

.replaceAll('"', '')
.replace(/^Plate of /, '')
.replace(/^Bowl of /, '')
.replace(/^Slice of /, '')
.replace(/^Scoop of /, '')
.replace(/ Squash Soup$/, '')

// .replace(/^Schüssel mit /, '')
// .replace(/^Teller mit /, '')

.replace(/^Plato de /, '')
.replace(/^Cuenco de /, ''),
);

export const joinWith = (array, separator) =>
array.flatMap((element) => [element, separator]).slice(0, -1);

function ModalContent(props) {
const { type, modifierData, modifierDataById: data, priceData, showAttributes } = props;

Expand Down
29 changes: 29 additions & 0 deletions src/components/sections/extras/helpers.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
const firstUppercase = (str: string) => str.charAt(0).toUpperCase() + str.slice(1);

export const formatApiText = (apiText: string) =>
firstUppercase(
apiText
.replace(/^Superior Sigil /, 'Sigil ')
.replace(/^Überlegenes Sigill /, 'Sigill ')
.replace(/^Sello superior /, 'Sello ')

.replace(/^Superior Rune /, 'Rune ')
.replace(/^Überlegene Rune /, 'Rune ')
.replace(/^Runa superior /, 'Runa ')

.replaceAll('"', '')
.replace(/^Plate of /, '')
.replace(/^Bowl of /, '')
.replace(/^Slice of /, '')
.replace(/^Scoop of /, '')
.replace(/ Squash Soup$/, '')

// .replace(/^Schüssel mit /, '')
// .replace(/^Teller mit /, '')

.replace(/^Plato de /, '')
.replace(/^Cuenco de /, ''),
);

export const joinWith = (array: any[], separator: any) =>
array.flatMap((element) => [element, separator]).slice(0, -1);

0 comments on commit fc6546b

Please sign in to comment.