Skip to content

Commit

Permalink
fix: migrate from selectors in database slide to basic capability sel…
Browse files Browse the repository at this point in the history
…ectors
  • Loading branch information
elyukai committed Jan 10, 2024
1 parent 32d71c8 commit 9474357
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import { SpellsSortOrder } from "../../../../../shared/domain/sortOrders.ts"
import { useTranslate } from "../../../../../shared/hooks/translate.ts"
import { useTranslateMap } from "../../../../../shared/hooks/translateMap.ts"
import { useAppDispatch, useAppSelector } from "../../../../hooks/redux.ts"
import { SelectGetById } from "../../../../selectors/basicCapabilitySelectors.ts"
import { selectCanRemove } from "../../../../selectors/characterSelectors.ts"
import { selectGetProperty } from "../../../../slices/databaseSlice.ts"
import {
changeInlineLibraryEntry,
selectInlineLibraryEntryId,
Expand Down Expand Up @@ -41,7 +41,7 @@ const ActiveCantripsListItem: FC<Props> = props => {
const dispatch = useAppDispatch()
const inlineLibraryEntryId = useAppSelector(selectInlineLibraryEntryId)
const canRemove = useAppSelector(selectCanRemove)
const getProperty = useAppSelector(selectGetProperty)
const getProperty = useAppSelector(SelectGetById.Static.Property)

const { name = "" } = translateMap(translations) ?? {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import { SpellsSortOrder } from "../../../../../shared/domain/sortOrders.ts"
import { useTranslateMap } from "../../../../../shared/hooks/translateMap.ts"
import { deepEqual } from "../../../../../shared/utils/compare.ts"
import { useAppDispatch, useAppSelector } from "../../../../hooks/redux.ts"
import { SelectGetById } from "../../../../selectors/basicCapabilitySelectors.ts"
import { selectCanRemove } from "../../../../selectors/characterSelectors.ts"
import { selectGetProperty } from "../../../../slices/databaseSlice.ts"
import {
changeInlineLibraryEntry,
selectInlineLibraryEntryId,
Expand Down Expand Up @@ -78,7 +78,7 @@ export const ActiveMagicalActionsListItem = <T extends DisplayedActiveMagicalAct
const dispatch = useAppDispatch()
const inlineLibraryEntryId = useAppSelector(selectInlineLibraryEntryId)
const canRemove = useAppSelector(selectCanRemove)
const getProperty = useAppSelector(selectGetProperty)
const getProperty = useAppSelector(SelectGetById.Static.Property)

const { name = "" } = translateMap(translations) ?? {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import { SpellsSortOrder } from "../../../../../shared/domain/sortOrders.ts"
import { useTranslate } from "../../../../../shared/hooks/translate.ts"
import { useTranslateMap } from "../../../../../shared/hooks/translateMap.ts"
import { useAppDispatch, useAppSelector } from "../../../../hooks/redux.ts"
import { SelectGetById } from "../../../../selectors/basicCapabilitySelectors.ts"
import { selectCanRemove } from "../../../../selectors/characterSelectors.ts"
import { selectGetProperty } from "../../../../slices/databaseSlice.ts"
import {
changeInlineLibraryEntry,
selectInlineLibraryEntryId,
Expand Down Expand Up @@ -52,7 +52,7 @@ const ActiveRitualsListItem: FC<Props> = props => {
const dispatch = useAppDispatch()
const inlineLibraryEntryId = useAppSelector(selectInlineLibraryEntryId)
const canRemove = useAppSelector(selectCanRemove)
const getProperty = useAppSelector(selectGetProperty)
const getProperty = useAppSelector(SelectGetById.Static.Property)

const { name = "" } = translateMap(translations) ?? {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import { SpellsSortOrder } from "../../../../../shared/domain/sortOrders.ts"
import { useTranslate } from "../../../../../shared/hooks/translate.ts"
import { useTranslateMap } from "../../../../../shared/hooks/translateMap.ts"
import { useAppDispatch, useAppSelector } from "../../../../hooks/redux.ts"
import { SelectGetById } from "../../../../selectors/basicCapabilitySelectors.ts"
import { selectCanRemove } from "../../../../selectors/characterSelectors.ts"
import { selectGetProperty } from "../../../../slices/databaseSlice.ts"
import {
changeInlineLibraryEntry,
selectInlineLibraryEntryId,
Expand Down Expand Up @@ -52,7 +52,7 @@ const ActiveSpellsListItem: FC<Props> = props => {
const dispatch = useAppDispatch()
const inlineLibraryEntryId = useAppSelector(selectInlineLibraryEntryId)
const canRemove = useAppSelector(selectCanRemove)
const getProperty = useAppSelector(selectGetProperty)
const getProperty = useAppSelector(SelectGetById.Static.Property)

const { name = "" } = translateMap(translations) ?? {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { SpellsSortOrder } from "../../../../../shared/domain/sortOrders.ts"
import { useTranslate } from "../../../../../shared/hooks/translate.ts"
import { useTranslateMap } from "../../../../../shared/hooks/translateMap.ts"
import { useAppDispatch, useAppSelector } from "../../../../hooks/redux.ts"
import { selectGetProperty } from "../../../../slices/databaseSlice.ts"
import { SelectGetById } from "../../../../selectors/basicCapabilitySelectors.ts"
import {
changeInlineLibraryEntry,
selectInlineLibraryEntryId,
Expand Down Expand Up @@ -39,7 +39,7 @@ const InactiveCantripsListItem: FC<Props> = props => {
const translateMap = useTranslateMap()
const dispatch = useAppDispatch()
const inlineLibraryEntryId = useAppSelector(selectInlineLibraryEntryId)
const getProperty = useAppSelector(selectGetProperty)
const getProperty = useAppSelector(SelectGetById.Static.Property)

const { name = "" } = translateMap(translations) ?? {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { SpellsSortOrder } from "../../../../../shared/domain/sortOrders.ts"
import { useTranslateMap } from "../../../../../shared/hooks/translateMap.ts"
import { deepEqual } from "../../../../../shared/utils/compare.ts"
import { useAppDispatch, useAppSelector } from "../../../../hooks/redux.ts"
import { selectGetProperty } from "../../../../slices/databaseSlice.ts"
import { SelectGetById } from "../../../../selectors/basicCapabilitySelectors.ts"
import {
changeInlineLibraryEntry,
selectInlineLibraryEntryId,
Expand Down Expand Up @@ -69,7 +69,7 @@ export const InactiveMagicalActionsListItem = <T extends DisplayedInactiveMagica
const translateMap = useTranslateMap()
const dispatch = useAppDispatch()
const inlineLibraryEntryId = useAppSelector(selectInlineLibraryEntryId)
const getProperty = useAppSelector(selectGetProperty)
const getProperty = useAppSelector(SelectGetById.Static.Property)

const { name = "" } = translateMap(translations) ?? {}
const identifierObject = useMemo(() => createIdentifierObject(kind, id), [kind, id])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { SpellsSortOrder } from "../../../../../shared/domain/sortOrders.ts"
import { useTranslate } from "../../../../../shared/hooks/translate.ts"
import { useTranslateMap } from "../../../../../shared/hooks/translateMap.ts"
import { useAppDispatch, useAppSelector } from "../../../../hooks/redux.ts"
import { selectGetProperty } from "../../../../slices/databaseSlice.ts"
import { SelectGetById } from "../../../../selectors/basicCapabilitySelectors.ts"
import {
changeInlineLibraryEntry,
selectInlineLibraryEntryId,
Expand Down Expand Up @@ -43,7 +43,7 @@ const InactiveRitualsListItem: FC<Props> = props => {
const translateMap = useTranslateMap()
const dispatch = useAppDispatch()
const inlineLibraryEntryId = useAppSelector(selectInlineLibraryEntryId)
const getProperty = useAppSelector(selectGetProperty)
const getProperty = useAppSelector(SelectGetById.Static.Property)

const { name = "" } = translateMap(translations) ?? {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { SpellsSortOrder } from "../../../../../shared/domain/sortOrders.ts"
import { useTranslate } from "../../../../../shared/hooks/translate.ts"
import { useTranslateMap } from "../../../../../shared/hooks/translateMap.ts"
import { useAppDispatch, useAppSelector } from "../../../../hooks/redux.ts"
import { selectGetProperty } from "../../../../slices/databaseSlice.ts"
import { SelectGetById } from "../../../../selectors/basicCapabilitySelectors.ts"
import {
changeInlineLibraryEntry,
selectInlineLibraryEntryId,
Expand Down Expand Up @@ -43,7 +43,7 @@ const InactiveSpellsListItem: FC<Props> = props => {
const translateMap = useTranslateMap()
const dispatch = useAppDispatch()
const inlineLibraryEntryId = useAppSelector(selectInlineLibraryEntryId)
const getProperty = useAppSelector(selectGetProperty)
const getProperty = useAppSelector(SelectGetById.Static.Property)

const { name = "" } = translateMap(translations) ?? {}

Expand Down
4 changes: 2 additions & 2 deletions src/main_window/routes/characters/character/spells/Spells.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ import { assertExhaustive } from "../../../../../shared/utils/typeSafety.ts"
import { useModalState } from "../../../../hooks/modalState.ts"
import { useAppDispatch, useAppSelector } from "../../../../hooks/redux.ts"
import { InlineLibrary } from "../../../../inlineLibrary/InlineLibrary.tsx"
import { SelectGetById } from "../../../../selectors/basicCapabilitySelectors.ts"
import { selectCanRemove } from "../../../../selectors/characterSelectors.ts"
import {
selectVisibleActiveSpellworks,
selectVisibleInactiveSpellworks,
} from "../../../../selectors/spellSelectors.ts"
import { addCantrip, removeCantrip } from "../../../../slices/cantripsSlice.ts"
import { selectGetProperty } from "../../../../slices/databaseSlice.ts"
import {
addAnimistPower,
decrementAnimistPower,
Expand Down Expand Up @@ -138,7 +138,7 @@ export const Spells: FC = () => {
const localeCompare = useLocaleCompare()

const canRemove = useAppSelector(selectCanRemove)
const getProperty = useAppSelector(selectGetProperty)
const getProperty = useAppSelector(SelectGetById.Static.Property)

const [activeFilterText, setActiveFilterText] = useState("")
const [inactiveFilterText, setInactiveFilterText] = useState("")
Expand Down

0 comments on commit 9474357

Please sign in to comment.