style: fix incomplete or missing documentation comments
This commit is contained in:
@@ -6,6 +6,9 @@ import "./InlineLibrary.scss"
|
||||
import { InlineLibraryPlaceholder } from "./InlineLibraryPlaceholder.tsx"
|
||||
import { InlineLibraryRouter } from "./InlineLibraryRouter.tsx"
|
||||
|
||||
/**
|
||||
* Displays all information about a selected entry in a sidebar.
|
||||
*/
|
||||
export const InlineLibrary: FC = () => {
|
||||
const id = useAppSelector(selectInlineLibraryEntryId)
|
||||
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
import { FC } from "react"
|
||||
|
||||
/**
|
||||
* Temporary component for entry types for which a inline library component is
|
||||
* not available yet.
|
||||
*/
|
||||
export const InlineLibraryPlaceholder: FC = () => (
|
||||
<div className="inline-library-placeholder">{"\uE912"}</div>
|
||||
)
|
||||
|
||||
@@ -2,6 +2,10 @@ import { FC, ReactNode } from "react"
|
||||
import { filterNonNullable } from "../../shared/utils/array.ts"
|
||||
import "./InlineLibraryProperties.scss"
|
||||
|
||||
/**
|
||||
* A combination of a property label and its corresponding description for
|
||||
* display in the inline library.
|
||||
*/
|
||||
export type InlineLibraryProperty = {
|
||||
label: string
|
||||
value: ReactNode
|
||||
@@ -11,6 +15,9 @@ type Props = {
|
||||
list: (InlineLibraryProperty | undefined)[]
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays all properties as a definition list.
|
||||
*/
|
||||
export const InlineLibraryProperties: FC<Props> = ({ list }) => (
|
||||
<dl className="inline-library-properties">
|
||||
{filterNonNullable(list).map(({ label, value }) => (
|
||||
|
||||
@@ -7,6 +7,9 @@ type Props = {
|
||||
subtitle?: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Wraps entry properties in a common view with title and scroll behaviour.
|
||||
*/
|
||||
export const InlineLibraryTemplate: FCC<Props> = ({ className, children, title, subtitle }) => (
|
||||
<Scroll>
|
||||
<div className={`info ${className}-info`}>
|
||||
|
||||
@@ -11,6 +11,9 @@ type Props = {
|
||||
id: number
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays all information about an experience level.
|
||||
*/
|
||||
export const InlineLibraryExperienceLevel: FC<Props> = ({ id }) => {
|
||||
const translate = useTranslate()
|
||||
const translateMap = useTranslateMap()
|
||||
|
||||
@@ -15,6 +15,9 @@ type Props = {
|
||||
id: number
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays all information about a focus rule.
|
||||
*/
|
||||
export const InlineLibraryFocusRule: FC<Props> = ({ id }) => {
|
||||
const translateMap = useTranslateMap()
|
||||
|
||||
|
||||
@@ -11,6 +11,9 @@ type Props = {
|
||||
id: number
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays all information about an optional rule.
|
||||
*/
|
||||
export const InlineLibraryOptionalRule: FC<Props> = ({ id }) => {
|
||||
const translateMap = useTranslateMap()
|
||||
|
||||
|
||||
@@ -23,6 +23,9 @@ type Props = {
|
||||
id: number
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays all information about a skill.
|
||||
*/
|
||||
export const InlineLibrarySkill: FC<Props> = ({ id }) => {
|
||||
const translate = useTranslate()
|
||||
const translateMap = useTranslateMap()
|
||||
@@ -39,6 +42,12 @@ export const InlineLibrarySkill: FC<Props> = ({ id }) => {
|
||||
return <InlineLibraryPlaceholder />
|
||||
}
|
||||
|
||||
// TODO: Implement
|
||||
const newApplications = []
|
||||
|
||||
// TODO: Implement
|
||||
const uses = []
|
||||
|
||||
const applications = (() => {
|
||||
switch (entry.applications.tag) {
|
||||
case "Derived":
|
||||
@@ -77,6 +86,14 @@ export const InlineLibrarySkill: FC<Props> = ({ id }) => {
|
||||
<InlineLibraryTemplate className="Skill" title={translation?.name ?? entry.id.toString()}>
|
||||
<InlineLibraryProperties
|
||||
list={[
|
||||
{
|
||||
label: translate("New Applications"),
|
||||
value: newApplications.join(", "),
|
||||
},
|
||||
{
|
||||
label: translate("Uses"),
|
||||
value: uses.join(", "),
|
||||
},
|
||||
createCheck(translate, translateMap, attributes, entry.check),
|
||||
{
|
||||
label: translate("Applications"),
|
||||
@@ -117,45 +134,6 @@ export const InlineLibrarySkill: FC<Props> = ({ id }) => {
|
||||
]}
|
||||
/>
|
||||
<Source sources={entry.src} />
|
||||
{/* <WikiApplications
|
||||
advantages={advantages}
|
||||
specialAbilities={specialAbilities}
|
||||
staticData={staticData}
|
||||
x={x}
|
||||
acc={Skill.A}
|
||||
showNewApplications
|
||||
/>
|
||||
<WikiUses
|
||||
advantages={advantages}
|
||||
specialAbilities={specialAbilities}
|
||||
staticData={staticData}
|
||||
x={x}
|
||||
acc={Skill.A}
|
||||
/>
|
||||
<WikiSkillCheck
|
||||
staticData={staticData}
|
||||
x={x}
|
||||
acc={Skill.A}
|
||||
/>
|
||||
<WikiApplications
|
||||
advantages={advantages}
|
||||
specialAbilities={specialAbilities}
|
||||
staticData={staticData}
|
||||
x={x}
|
||||
acc={Skill.A}
|
||||
/>
|
||||
<WikiEncumbrance staticData={staticData} x={x} acc={Skill.A} />
|
||||
<WikiTools staticData={staticData} x={x} acc={Skill.A} />
|
||||
<WikiQuality staticData={staticData} x={x} acc={Skill.A} />
|
||||
<WikiFailedCheck staticData={staticData} x={x} acc={Skill.A} />
|
||||
<WikiCriticalSuccess staticData={staticData} x={x} acc={Skill.A} />
|
||||
<WikiBotch staticData={staticData} x={x} acc={Skill.A} />
|
||||
<WikiImprovementCost staticData={staticData} x={x} acc={Skill.A} />
|
||||
<WikiSource
|
||||
staticData={staticData}
|
||||
x={x}
|
||||
acc={Skill.A}
|
||||
/> */}
|
||||
</InlineLibraryTemplate>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -55,6 +55,9 @@ const printPageRange = (translate: Translate, pageRange: PageRange) =>
|
||||
const printPageRanges = (translate: Translate, pageRanges: PageRange[]) =>
|
||||
pageRanges.map(pageRange => printPageRange(translate, pageRange)).join(", ")
|
||||
|
||||
/**
|
||||
* Displays the sources of an entry.
|
||||
*/
|
||||
export const Source: FC<Props> = ({ sources }) => {
|
||||
const translate = useTranslate()
|
||||
const translateMap = useTranslateMap()
|
||||
|
||||
@@ -3,6 +3,9 @@ import { SkillCheck } from "optolith-database-schema/types/_SkillCheck"
|
||||
import { Translate, TranslateMap } from "../../../shared/utils/translate.ts"
|
||||
import { InlineLibraryProperty } from "../InlineLibraryProperties.tsx"
|
||||
|
||||
/**
|
||||
* Returns the skill check as an inline library property.
|
||||
*/
|
||||
export const createCheck = (
|
||||
translate: Translate,
|
||||
translateMap: TranslateMap,
|
||||
|
||||
@@ -3,6 +3,9 @@ import { fromRaw, toString } from "../../../shared/domain/adventurePoints/improv
|
||||
import { Translate } from "../../../shared/utils/translate.ts"
|
||||
import { InlineLibraryProperty } from "../InlineLibraryProperties.tsx"
|
||||
|
||||
/**
|
||||
* Returns the imporvement cost as an inline library property.
|
||||
*/
|
||||
export const createImprovementCost = (
|
||||
translate: Translate,
|
||||
improvementCost: ImprovementCost,
|
||||
|
||||
@@ -4,17 +4,26 @@ import { selectIsCharacterCreationFinished } from "../slices/characterSlice.ts"
|
||||
import { selectAdventurePointsAvailable } from "./adventurePointSelectors.ts"
|
||||
import { selectCurrentProfession } from "./professionSelectors.ts"
|
||||
|
||||
/**
|
||||
* Returns whether the *finish character creation* button needs to be shown.
|
||||
*/
|
||||
export const selectShowFinishCharacterCreation = createSelector(
|
||||
selectIsCharacterCreationFinished,
|
||||
(isCharacterCreationFinished): boolean => !isCharacterCreationFinished,
|
||||
)
|
||||
|
||||
/**
|
||||
* Returns whether the character creation can be finished.
|
||||
*/
|
||||
export const selectCanFinishCharacterCreation = createSelector(
|
||||
selectAdventurePointsAvailable,
|
||||
(availableAdventurePoints): boolean =>
|
||||
availableAdventurePoints >= 0 && availableAdventurePoints <= 10,
|
||||
)
|
||||
|
||||
/**
|
||||
* Returns whether the profession name can be customized.
|
||||
*/
|
||||
export const selectCanDefineCustomProfessionName = createSelector(
|
||||
selectCurrentProfession,
|
||||
(profession): boolean => profession?.base.id === ProfessionIdentifier.OwnProfession,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable jsdoc/require-jsdoc */
|
||||
import { createSlice } from "@reduxjs/toolkit"
|
||||
import { RootState } from "../store.ts"
|
||||
import { CharacterState, initialCharacterState } from "./characterSlice.ts"
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable jsdoc/require-jsdoc */
|
||||
/* eslint-disable max-len */
|
||||
import { createAction } from "@reduxjs/toolkit"
|
||||
import { createImmerReducer } from "../../shared/utils/redux.ts"
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable jsdoc/require-jsdoc */
|
||||
import { createImmerReducer } from "../../shared/utils/redux.ts"
|
||||
import { RootState } from "../store.ts"
|
||||
import { characterReducer } from "./characterSlice.ts"
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
/* eslint-disable jsdoc/require-jsdoc */
|
||||
import { PayloadAction, createSlice } from "@reduxjs/toolkit"
|
||||
import * as ID from "optolith-database-schema/types/_Identifier"
|
||||
import { RootState } from "../store.ts"
|
||||
import { goToTab, goToTabGroup } from "./routeSlice.ts"
|
||||
|
||||
/**
|
||||
* An identifier that can be displayed in the inline library.
|
||||
*/
|
||||
export type DisplayableMainIdentifier =
|
||||
| ID.AdvancedCombatSpecialAbilityIdentifier
|
||||
| ID.AdvancedKarmaSpecialAbilityIdentifier
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable jsdoc/require-jsdoc */
|
||||
import { createAction } from "@reduxjs/toolkit"
|
||||
import { Height, Weight, WeightDiceOffsetStrategy } from "optolith-database-schema/types/Race"
|
||||
import { DieType } from "optolith-database-schema/types/_Dice"
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable jsdoc/require-jsdoc */
|
||||
import { createAction } from "@reduxjs/toolkit"
|
||||
import { createImmerReducer } from "../../shared/utils/redux.ts"
|
||||
import { CharacterState } from "./characterSlice.ts"
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable jsdoc/require-jsdoc */
|
||||
import { createAction } from "@reduxjs/toolkit"
|
||||
import { createImmerReducer } from "../../shared/utils/redux.ts"
|
||||
import { CharacterState } from "./characterSlice.ts"
|
||||
|
||||
@@ -10,6 +10,9 @@ import { Reducer, createImmerReducer } from "../../shared/utils/redux.ts"
|
||||
import { CharacterState } from "./characterSlice.ts"
|
||||
import { DatabaseState } from "./databaseSlice.ts"
|
||||
|
||||
/**
|
||||
* A slice that handles rated entries.
|
||||
*/
|
||||
export type RatedSlice<N extends string, E extends string> = {
|
||||
/**
|
||||
* Creates a new entry with an initial value if active. The initial adventure
|
||||
@@ -63,6 +66,10 @@ export type RatedSlice<N extends string, E extends string> = {
|
||||
reducer: Reducer<CharacterState, AnyAction, [database: DatabaseState]>
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a reducer, actions and selectors for a slice that handles rated
|
||||
* entries.
|
||||
*/
|
||||
export const createRatedSlice = <N extends string, E extends string>(config: {
|
||||
namespace: N
|
||||
entityName: E
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable jsdoc/require-jsdoc */
|
||||
import { createAction } from "@reduxjs/toolkit"
|
||||
import { OptionalRuleIdentifier } from "../../shared/domain/identifier.ts"
|
||||
import { createImmerReducer } from "../../shared/utils/redux.ts"
|
||||
@@ -50,8 +51,7 @@ export const rulesReducer = createImmerReducer<CharacterState>((state, action) =
|
||||
}
|
||||
} else if (changeOptionalRuleOption.match(action)) {
|
||||
if (Object.hasOwn(state.rules.optionalRules, action.payload.id)) {
|
||||
;(state.rules.optionalRules[action.payload.id]!.options ??= [])[0] =
|
||||
action.payload.option
|
||||
;(state.rules.optionalRules[action.payload.id]!.options ??= [])[0] = action.payload.option
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable jsdoc/require-jsdoc */
|
||||
/* eslint-disable max-len */
|
||||
import { PayloadAction, createSlice } from "@reduxjs/toolkit"
|
||||
import {
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import { FCC } from "../../utils/react.ts"
|
||||
|
||||
/**
|
||||
* Wrapper for form elements to specify variable options for an entry.
|
||||
*/
|
||||
export const ListItemSelections: FCC = props => {
|
||||
const { children } = props
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ export type FocusRuleInstance = {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an instance of an active focus rule.
|
||||
* Creates an instance of a focus rule.
|
||||
*/
|
||||
export const createFocusRule = (id: number): FocusRuleInstance => ({
|
||||
id,
|
||||
|
||||
@@ -24,7 +24,7 @@ export type OptionalRuleInstance = {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an instance of an active optional rule.
|
||||
* Creates an instance of an optional rule.
|
||||
*/
|
||||
export const createOptionalRule = (id: number): OptionalRuleInstance => ({
|
||||
id,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
/**
|
||||
* Types for the user-configurable app-wide settings.
|
||||
* @main Config
|
||||
*/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user