diff --git a/src/components/App/DefaultState.ts b/src/components/App/DefaultState.ts index 1290da98da..1294ddf45d 100644 --- a/src/components/App/DefaultState.ts +++ b/src/components/App/DefaultState.ts @@ -2,7 +2,6 @@ import { defaultState as goalTimelineState } from "components/GoalTimeline/Defau import { defaultState as loginState } from "components/Login/Redux/LoginReducer"; import { defaultState as currentProjectState } from "components/Project/ProjectReduxTypes"; import { defaultState as exportProjectState } from "components/ProjectExport/Redux/ExportProjectReduxTypes"; -import { defaultState as createProjectState } from "components/ProjectScreen/CreateProject/Redux/CreateProjectReduxTypes"; import { defaultState as pronunciationsState } from "components/Pronunciations/Redux/PronunciationsReduxTypes"; import { defaultState as treeViewState } from "components/TreeView/Redux/TreeViewReduxTypes"; import { defaultState as characterInventoryState } from "goals/CharacterInventory/Redux/CharacterInventoryReducer"; @@ -15,10 +14,6 @@ export const defaultState = { loginState: { ...loginState }, //project - createProjectState: { - ...createProjectState, - success: true, - }, currentProjectState: { ...currentProjectState }, exportProjectState: { ...exportProjectState }, diff --git a/src/components/DataEntry/DataEntryTable/index.tsx b/src/components/DataEntry/DataEntryTable/index.tsx index 5ebc1bc007..e3d37e5e0e 100644 --- a/src/components/DataEntry/DataEntryTable/index.tsx +++ b/src/components/DataEntry/DataEntryTable/index.tsx @@ -865,9 +865,12 @@ export default function DataEntryTable( {state.recentWords.map((wordAccess, index) => ( - + (); const tileSize = props.size / 3 - 1.25; + const id = (g: Goal): string => + props.completed ? `completed-goal-${g.guid}` : `new-goal-${g.name}`; + return ( setScrollVisible(props.scrollable)} onMouseLeave={() => setScrollVisible(false)} > - {props.data.length > 0 - ? props.data.map((g, i) => { - const buttonProps = { - id: props.completed - ? `completed-goal-${i}` - : `new-goal-${g.name}`, - onClick: () => props.handleChange(g), - }; - return makeGoalTile(tileSize, props.orientation, g, buttonProps); - }) - : makeGoalTile(tileSize, props.orientation)} + {props.data.length > 0 ? ( + props.data.map((g) => ( + props.handleChange(g) }} + goal={g} + key={g.guid || g.name} + orientation={props.orientation} + size={tileSize} + /> + )) + ) : ( + + )}
{ if (props.scrollToEnd && element) { @@ -93,19 +98,22 @@ function buttonStyle(orientation: Orientation, size: number): CSSProperties { } } -export function makeGoalTile( - size: number, - orientation: Orientation, - goal?: Goal, - buttonProps?: ButtonProps -): ReactElement { +interface GoalTileProps { + buttonProps?: ButtonProps; + goal?: Goal; + orientation: Orientation; + size: number; +} + +function GoalTile(props: GoalTileProps): ReactElement { + const goal = props.goal; return ( - +