refactor: extract sort orders to shared domain folder
This commit is contained in:
@@ -8,17 +8,14 @@ import { Page } from "../../../shared/components/page/Page.tsx"
|
||||
import { RadioButtonGroup } from "../../../shared/components/radioButton/RadioButtonGroup.tsx"
|
||||
import { Scroll } from "../../../shared/components/scroll/Scroll.tsx"
|
||||
import { TextField } from "../../../shared/components/textField/TextField.tsx"
|
||||
import { CharactersSortOrder } from "../../../shared/domain/sortOrders.ts"
|
||||
import { useLocaleCompare } from "../../../shared/hooks/localeCompare.ts"
|
||||
import { useTranslate } from "../../../shared/hooks/translate.ts"
|
||||
import { compareAt, reduceCompare } from "../../../shared/utils/compare.ts"
|
||||
import { assertExhaustive } from "../../../shared/utils/typeSafety.ts"
|
||||
import { useAppDispatch, useAppSelector } from "../../hooks/redux.ts"
|
||||
import { selectCharacters } from "../../slices/charactersSlice.ts"
|
||||
import {
|
||||
CharactersSortOrder,
|
||||
changeCharactersSortOrder,
|
||||
selectCharactersSortOrder,
|
||||
} from "../../slices/settingsSlice.ts"
|
||||
import { changeCharactersSortOrder, selectCharactersSortOrder } from "../../slices/settingsSlice.ts"
|
||||
import "./Characters.scss"
|
||||
import { CharactersItem } from "./CharactersItem.tsx"
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ import {
|
||||
compareImprovementCost,
|
||||
fromRaw,
|
||||
} from "../../../../../shared/domain/adventurePoints/improvementCost.ts"
|
||||
import { CombatTechniquesSortOrder } from "../../../../../shared/domain/sortOrders.ts"
|
||||
import { useLocaleCompare } from "../../../../../shared/hooks/localeCompare.ts"
|
||||
import { useTranslate } from "../../../../../shared/hooks/translate.ts"
|
||||
import { useTranslateMap } from "../../../../../shared/hooks/translateMap.ts"
|
||||
@@ -34,7 +35,6 @@ import {
|
||||
incrementRangedCombatTechnique,
|
||||
} from "../../../../slices/rangedCombatTechniqueSlice.ts"
|
||||
import {
|
||||
CombatTechniquesSortOrder,
|
||||
changeCombatTechniquesSortOrder,
|
||||
selectCombatTechniquesSortOrder,
|
||||
} from "../../../../slices/settingsSlice.ts"
|
||||
|
||||
+1
-1
@@ -6,6 +6,7 @@ import { ListItemSeparator } from "../../../../../shared/components/list/ListIte
|
||||
import { ListItemValues } from "../../../../../shared/components/list/ListItemValues.tsx"
|
||||
import { AspectIdentifier } from "../../../../../shared/domain/identifier.ts"
|
||||
import { DisplayedActiveBlessing } from "../../../../../shared/domain/liturgicalChantActive.ts"
|
||||
import { LiturgiesSortOrder } 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"
|
||||
@@ -15,7 +16,6 @@ import {
|
||||
changeInlineLibraryEntry,
|
||||
selectInlineLibraryEntryId,
|
||||
} from "../../../../slices/inlineWikiSlice.ts"
|
||||
import { LiturgiesSortOrder } from "../../../../slices/settingsSlice.ts"
|
||||
import { SkillButtons } from "../skills/SkillButtons.tsx"
|
||||
import { SkillFill } from "../skills/SkillFill.tsx"
|
||||
|
||||
|
||||
+1
-1
@@ -7,6 +7,7 @@ import { ListItemValues } from "../../../../../shared/components/list/ListItemVa
|
||||
import { fromRaw } from "../../../../../shared/domain/adventurePoints/improvementCost.ts"
|
||||
import { getAspectsForTranslation } from "../../../../../shared/domain/liturgicalChant.ts"
|
||||
import { DisplayedActiveCeremony } from "../../../../../shared/domain/liturgicalChantActive.ts"
|
||||
import { LiturgiesSortOrder } from "../../../../../shared/domain/sortOrders.ts"
|
||||
import { useLocaleCompare } from "../../../../../shared/hooks/localeCompare.ts"
|
||||
import { useTranslate } from "../../../../../shared/hooks/translate.ts"
|
||||
import { useTranslateMap } from "../../../../../shared/hooks/translateMap.ts"
|
||||
@@ -18,7 +19,6 @@ import {
|
||||
changeInlineLibraryEntry,
|
||||
selectInlineLibraryEntryId,
|
||||
} from "../../../../slices/inlineWikiSlice.ts"
|
||||
import { LiturgiesSortOrder } from "../../../../slices/settingsSlice.ts"
|
||||
import { SkillButtons } from "../skills/SkillButtons.tsx"
|
||||
import { SkillCheck } from "../skills/SkillCheck.tsx"
|
||||
import { SkillFill } from "../skills/SkillFill.tsx"
|
||||
|
||||
+1
-1
@@ -7,6 +7,7 @@ import { ListItemValues } from "../../../../../shared/components/list/ListItemVa
|
||||
import { fromRaw } from "../../../../../shared/domain/adventurePoints/improvementCost.ts"
|
||||
import { getAspectsForTranslation } from "../../../../../shared/domain/liturgicalChant.ts"
|
||||
import { DisplayedActiveLiturgicalChant } from "../../../../../shared/domain/liturgicalChantActive.ts"
|
||||
import { LiturgiesSortOrder } from "../../../../../shared/domain/sortOrders.ts"
|
||||
import { useLocaleCompare } from "../../../../../shared/hooks/localeCompare.ts"
|
||||
import { useTranslate } from "../../../../../shared/hooks/translate.ts"
|
||||
import { useTranslateMap } from "../../../../../shared/hooks/translateMap.ts"
|
||||
@@ -18,7 +19,6 @@ import {
|
||||
changeInlineLibraryEntry,
|
||||
selectInlineLibraryEntryId,
|
||||
} from "../../../../slices/inlineWikiSlice.ts"
|
||||
import { LiturgiesSortOrder } from "../../../../slices/settingsSlice.ts"
|
||||
import { SkillButtons } from "../skills/SkillButtons.tsx"
|
||||
import { SkillCheck } from "../skills/SkillCheck.tsx"
|
||||
import { SkillFill } from "../skills/SkillFill.tsx"
|
||||
|
||||
+1
-1
@@ -6,6 +6,7 @@ import { ListItemSeparator } from "../../../../../shared/components/list/ListIte
|
||||
import { ListItemValues } from "../../../../../shared/components/list/ListItemValues.tsx"
|
||||
import { AspectIdentifier } from "../../../../../shared/domain/identifier.ts"
|
||||
import { DisplayedInactiveBlessing } from "../../../../../shared/domain/liturgicalChantInactive.ts"
|
||||
import { LiturgiesSortOrder } 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"
|
||||
@@ -14,7 +15,6 @@ import {
|
||||
changeInlineLibraryEntry,
|
||||
selectInlineLibraryEntryId,
|
||||
} from "../../../../slices/inlineWikiSlice.ts"
|
||||
import { LiturgiesSortOrder } from "../../../../slices/settingsSlice.ts"
|
||||
import { SkillButtons } from "../skills/SkillButtons.tsx"
|
||||
import { SkillFill } from "../skills/SkillFill.tsx"
|
||||
|
||||
|
||||
+1
-1
@@ -7,6 +7,7 @@ import { ListItemValues } from "../../../../../shared/components/list/ListItemVa
|
||||
import { fromRaw } from "../../../../../shared/domain/adventurePoints/improvementCost.ts"
|
||||
import { getAspectsForTranslation } from "../../../../../shared/domain/liturgicalChant.ts"
|
||||
import { DisplayedInactiveCeremony } from "../../../../../shared/domain/liturgicalChantInactive.ts"
|
||||
import { LiturgiesSortOrder } from "../../../../../shared/domain/sortOrders.ts"
|
||||
import { useLocaleCompare } from "../../../../../shared/hooks/localeCompare.ts"
|
||||
import { useTranslate } from "../../../../../shared/hooks/translate.ts"
|
||||
import { useTranslateMap } from "../../../../../shared/hooks/translateMap.ts"
|
||||
@@ -17,7 +18,6 @@ import {
|
||||
changeInlineLibraryEntry,
|
||||
selectInlineLibraryEntryId,
|
||||
} from "../../../../slices/inlineWikiSlice.ts"
|
||||
import { LiturgiesSortOrder } from "../../../../slices/settingsSlice.ts"
|
||||
import { SkillButtons } from "../skills/SkillButtons.tsx"
|
||||
import { SkillCheck } from "../skills/SkillCheck.tsx"
|
||||
import { SkillFill } from "../skills/SkillFill.tsx"
|
||||
|
||||
+1
-1
@@ -7,6 +7,7 @@ import { ListItemValues } from "../../../../../shared/components/list/ListItemVa
|
||||
import { fromRaw } from "../../../../../shared/domain/adventurePoints/improvementCost.ts"
|
||||
import { getAspectsForTranslation } from "../../../../../shared/domain/liturgicalChant.ts"
|
||||
import { DisplayedInactiveLiturgicalChant } from "../../../../../shared/domain/liturgicalChantInactive.ts"
|
||||
import { LiturgiesSortOrder } from "../../../../../shared/domain/sortOrders.ts"
|
||||
import { useLocaleCompare } from "../../../../../shared/hooks/localeCompare.ts"
|
||||
import { useTranslate } from "../../../../../shared/hooks/translate.ts"
|
||||
import { useTranslateMap } from "../../../../../shared/hooks/translateMap.ts"
|
||||
@@ -17,7 +18,6 @@ import {
|
||||
changeInlineLibraryEntry,
|
||||
selectInlineLibraryEntryId,
|
||||
} from "../../../../slices/inlineWikiSlice.ts"
|
||||
import { LiturgiesSortOrder } from "../../../../slices/settingsSlice.ts"
|
||||
import { SkillButtons } from "../skills/SkillButtons.tsx"
|
||||
import { SkillCheck } from "../skills/SkillCheck.tsx"
|
||||
import { SkillFill } from "../skills/SkillFill.tsx"
|
||||
|
||||
@@ -14,6 +14,7 @@ import { TextField } from "../../../../../shared/components/textField/TextField.
|
||||
import { filterAndSortDisplayed } from "../../../../../shared/domain/liturgicalChant.ts"
|
||||
import { DisplayedActiveLiturgy } from "../../../../../shared/domain/liturgicalChantActive.ts"
|
||||
import { DisplayedInactiveLiturgy } from "../../../../../shared/domain/liturgicalChantInactive.ts"
|
||||
import { LiturgiesSortOrder } from "../../../../../shared/domain/sortOrders.ts"
|
||||
import { useLocaleCompare } from "../../../../../shared/hooks/localeCompare.ts"
|
||||
import { useTranslate } from "../../../../../shared/hooks/translate.ts"
|
||||
import { useTranslateMap } from "../../../../../shared/hooks/translateMap.ts"
|
||||
@@ -40,7 +41,6 @@ import {
|
||||
removeLiturgicalChant,
|
||||
} from "../../../../slices/liturgicalChantsSlice.ts"
|
||||
import {
|
||||
LiturgiesSortOrder,
|
||||
changeLiturgiesSortOrder,
|
||||
selectLiturgiesSortOrder,
|
||||
} from "../../../../slices/settingsSlice.ts"
|
||||
|
||||
@@ -16,6 +16,7 @@ import {
|
||||
compareImprovementCost,
|
||||
fromRaw,
|
||||
} from "../../../../../shared/domain/adventurePoints/improvementCost.ts"
|
||||
import { SkillsSortOrder } from "../../../../../shared/domain/sortOrders.ts"
|
||||
import { useLocaleCompare } from "../../../../../shared/hooks/localeCompare.ts"
|
||||
import { useTranslate } from "../../../../../shared/hooks/translate.ts"
|
||||
import { useTranslateMap } from "../../../../../shared/hooks/translateMap.ts"
|
||||
@@ -27,7 +28,6 @@ import { selectCanRemove } from "../../../../selectors/characterSelectors.ts"
|
||||
import { DisplayedSkill, selectVisibleSkills } from "../../../../selectors/skillsSelectors.ts"
|
||||
import { selectStaticSkillGroups } from "../../../../slices/databaseSlice.ts"
|
||||
import {
|
||||
SkillsSortOrder,
|
||||
changeSkillsSortOrder,
|
||||
selectSkillsCultureRatingVisibility,
|
||||
selectSkillsSortOrder,
|
||||
|
||||
@@ -9,12 +9,12 @@ import { Page } from "../../../../../shared/components/page/Page.tsx"
|
||||
import { RadioButtonGroup } from "../../../../../shared/components/radioButton/RadioButtonGroup.tsx"
|
||||
import { Scroll } from "../../../../../shared/components/scroll/Scroll.tsx"
|
||||
import { TextField } from "../../../../../shared/components/textField/TextField.tsx"
|
||||
import { SpecialAbilitiesSortOrder } from "../../../../../shared/domain/sortOrders.ts"
|
||||
import { useTranslate } from "../../../../../shared/hooks/translate.ts"
|
||||
import { useAppDispatch, useAppSelector } from "../../../../hooks/redux.ts"
|
||||
import { InlineLibrary } from "../../../../inlineLibrary/InlineLibrary.tsx"
|
||||
import { selectCanRemove } from "../../../../selectors/characterSelectors.ts"
|
||||
import {
|
||||
SpecialAbilitiesSortOrder,
|
||||
changeSpecialAbilitiesSortOrder,
|
||||
selectSpecialAbilitiesSortOrder,
|
||||
} from "../../../../slices/settingsSlice.ts"
|
||||
|
||||
@@ -1,83 +1,23 @@
|
||||
/* eslint-disable max-len */
|
||||
import { PayloadAction, createSlice } from "@reduxjs/toolkit"
|
||||
import {
|
||||
CharactersSortOrder,
|
||||
CombatTechniquesSortOrder,
|
||||
CulturesSortOrder,
|
||||
CulturesVisibilityFilter,
|
||||
EquipmentSortOrder,
|
||||
LiturgiesSortOrder,
|
||||
ProfessionsGroupVisibilityFilter,
|
||||
ProfessionsSortOrder,
|
||||
ProfessionsVisibilityFilter,
|
||||
RacesSortOrder,
|
||||
SkillsSortOrder,
|
||||
SpecialAbilitiesSortOrder,
|
||||
SpellsSortOrder,
|
||||
} from "../../shared/domain/sortOrders.ts"
|
||||
import { init } from "../init.ts"
|
||||
import { RootState } from "../store.ts"
|
||||
|
||||
export enum CharactersSortOrder {
|
||||
Name = "name",
|
||||
DateModified = "datemodified",
|
||||
DateCreated = "datecreated",
|
||||
}
|
||||
|
||||
export enum RacesSortOrder {
|
||||
Name = "name",
|
||||
Cost = "cost",
|
||||
}
|
||||
|
||||
export enum CulturesSortOrder {
|
||||
Name = "name",
|
||||
Cost = "cost",
|
||||
}
|
||||
|
||||
export enum CulturesVisibilityFilter {
|
||||
All = "all",
|
||||
Common = "common",
|
||||
}
|
||||
|
||||
export enum ProfessionsSortOrder {
|
||||
Name = "name",
|
||||
Cost = "cost",
|
||||
}
|
||||
|
||||
export enum ProfessionsVisibilityFilter {
|
||||
All = "all",
|
||||
Common = "common",
|
||||
}
|
||||
|
||||
export enum ProfessionsGroupVisibilityFilter {
|
||||
All = 0,
|
||||
Mundane = 1,
|
||||
Magical = 2,
|
||||
Blessed = 3,
|
||||
}
|
||||
|
||||
export enum SkillsSortOrder {
|
||||
Name = "name",
|
||||
Group = "group",
|
||||
ImprovementCost = "ic",
|
||||
}
|
||||
|
||||
export enum CombatTechniquesSortOrder {
|
||||
Name = "name",
|
||||
Group = "group",
|
||||
ImprovementCost = "ic",
|
||||
}
|
||||
|
||||
export enum SpecialAbilitiesSortOrder {
|
||||
Name = "name",
|
||||
Group = "group",
|
||||
}
|
||||
|
||||
export enum SpellsSortOrder {
|
||||
Name = "name",
|
||||
Group = "group",
|
||||
Property = "property",
|
||||
ImprovementCost = "ic",
|
||||
}
|
||||
|
||||
export enum LiturgiesSortOrder {
|
||||
Name = "name",
|
||||
Group = "group",
|
||||
ImprovementCost = "ic",
|
||||
}
|
||||
|
||||
export enum EquipmentSortOrder {
|
||||
Name = "name",
|
||||
GroupName = "groupname",
|
||||
Where = "where",
|
||||
Weight = "weight",
|
||||
}
|
||||
|
||||
type SettingsState = {
|
||||
locale: string | undefined
|
||||
fallbackLocale: string | undefined
|
||||
|
||||
@@ -5,7 +5,6 @@ import { LiturgyIdentifier } from "optolith-database-schema/types/_IdentifierGro
|
||||
import { ImprovementCost } from "optolith-database-schema/types/_ImprovementCost"
|
||||
import { SkillCheck } from "optolith-database-schema/types/_SkillCheck"
|
||||
import { BlessedTradition } from "optolith-database-schema/types/specialAbility/BlessedTradition"
|
||||
import { LiturgiesSortOrder } from "../../main_window/slices/settingsSlice.ts"
|
||||
import { count, countByMany } from "../utils/array.ts"
|
||||
import { Compare, compareAt, compareNullish, numAsc, reduceCompare } from "../utils/compare.ts"
|
||||
import { isNotNullish } from "../utils/nullable.ts"
|
||||
@@ -24,6 +23,7 @@ import {
|
||||
isRatedActive,
|
||||
isRatedWithEnhancementsActive,
|
||||
} from "./ratedEntry.ts"
|
||||
import { LiturgiesSortOrder } from "./sortOrders.ts"
|
||||
|
||||
/**
|
||||
* Returns the value for a dynamic liturgical chant entry that might not exist
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
/**
|
||||
* Possible sort orders for displayed characters.
|
||||
*/
|
||||
export enum CharactersSortOrder {
|
||||
Name = "name",
|
||||
DateModified = "datemodified",
|
||||
DateCreated = "datecreated",
|
||||
}
|
||||
|
||||
/**
|
||||
* Possible sort orders for displayed races.
|
||||
*/
|
||||
export enum RacesSortOrder {
|
||||
Name = "name",
|
||||
Cost = "cost",
|
||||
}
|
||||
|
||||
/**
|
||||
* Possible sort orders for displayed cultures.
|
||||
*/
|
||||
export enum CulturesSortOrder {
|
||||
Name = "name",
|
||||
Cost = "cost",
|
||||
}
|
||||
|
||||
/**
|
||||
* Possible filter options by recommendation for cultures.
|
||||
*/
|
||||
export enum CulturesVisibilityFilter {
|
||||
All = "all",
|
||||
Common = "common",
|
||||
}
|
||||
|
||||
/**
|
||||
* Possible sort orders for displayed professions.
|
||||
*/
|
||||
export enum ProfessionsSortOrder {
|
||||
Name = "name",
|
||||
Cost = "cost",
|
||||
}
|
||||
|
||||
/**
|
||||
* Possible filter options by recommendation for professions
|
||||
*/
|
||||
export enum ProfessionsVisibilityFilter {
|
||||
All = "all",
|
||||
Common = "common",
|
||||
}
|
||||
|
||||
/**
|
||||
* Possible filter options by group for professions.
|
||||
*/
|
||||
export enum ProfessionsGroupVisibilityFilter {
|
||||
All = 0,
|
||||
Mundane = 1,
|
||||
Magical = 2,
|
||||
Blessed = 3,
|
||||
}
|
||||
|
||||
/**
|
||||
* Possible sort orders for displayed skills.
|
||||
*/
|
||||
export enum SkillsSortOrder {
|
||||
Name = "name",
|
||||
Group = "group",
|
||||
ImprovementCost = "ic",
|
||||
}
|
||||
|
||||
/**
|
||||
* Possible sort orders for displayed combat techniques.
|
||||
*/
|
||||
export enum CombatTechniquesSortOrder {
|
||||
Name = "name",
|
||||
Group = "group",
|
||||
ImprovementCost = "ic",
|
||||
}
|
||||
|
||||
/**
|
||||
* Possible sort orders for displayed spells.
|
||||
*/
|
||||
export enum SpellsSortOrder {
|
||||
Name = "name",
|
||||
Group = "group",
|
||||
Property = "property",
|
||||
ImprovementCost = "ic",
|
||||
}
|
||||
|
||||
/**
|
||||
* Possible sort orders for displayed liturgical chants.
|
||||
*/
|
||||
export enum LiturgiesSortOrder {
|
||||
Name = "name",
|
||||
Group = "group",
|
||||
ImprovementCost = "ic",
|
||||
}
|
||||
|
||||
/**
|
||||
* Possible sort orders for displayed special abilities.
|
||||
*/
|
||||
export enum SpecialAbilitiesSortOrder {
|
||||
Name = "name",
|
||||
Group = "group",
|
||||
}
|
||||
|
||||
/**
|
||||
* Possible sort orders for displayed equipment.
|
||||
*/
|
||||
export enum EquipmentSortOrder {
|
||||
Name = "name",
|
||||
GroupName = "groupname",
|
||||
Where = "where",
|
||||
Weight = "weight",
|
||||
}
|
||||
Reference in New Issue
Block a user