Skip to content

Commit

Permalink
linting and type check
Browse files Browse the repository at this point in the history
  • Loading branch information
talyaron committed Sep 5, 2024
1 parent 46bb012 commit d441391
Show file tree
Hide file tree
Showing 12 changed files with 468 additions and 511 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export async function getFirstEvaluationOptions(
): Promise<void> {

try {
console.log("getFirstEvaluationOptions")

const dispatch = store.dispatch;
const urlBase = isProduction() ? "qeesi7aziq-uc.a.run.app" : "http://localhost:5001/synthesistalyaron/us-central1";

Expand All @@ -23,7 +23,7 @@ export async function getFirstEvaluationOptions(
const { randomStatements, error } = await response.json();
if (error) throw new Error(error);
z.array(StatementSchema).parse(randomStatements);
console.log(randomStatements)


dispatch(setCurrentMultiStepOptions(randomStatements));

Expand Down
9 changes: 3 additions & 6 deletions src/model/statements/statementsSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ import {

// Helpers
import { updateArray } from "../../controllers/general/helpers";
import { sortSubStatements } from "../../view/pages/statement/components/solutions/statementSolutionsCont";


enum StatementScreen {
chat = "chat",
Expand Down Expand Up @@ -393,9 +391,7 @@ export const statementOptionsSelector =
.sort((a, b) => a.createdAt - b.createdAt)
.map((statement) => ({ ...statement }));

const sortedSubStatements = sortSubStatements(subStatements, state.statements.screen);

return sortedSubStatements;
return subStatements;
};

export const questionsSelector = (statementId: string | undefined) => (state: RootState) => state.statements.statements.filter((statement) => statement.parentId === statementId && statement.statementType === StatementType.question).sort((a, b) => a.createdAt - b.createdAt);
Expand Down Expand Up @@ -467,7 +463,8 @@ export const subscriptionParentStatementSelector = (parentId: string) =>

export const myStatementsByStatementIdSelector = (statementId: string) => {
const user = store.getState().user.user;
return createSelector(

return createSelector(
(state: RootState) => state.statements.statements,
(statements) =>
statements.filter((st) => st.parentId === statementId && st.creatorId === user?.uid)
Expand Down
8 changes: 4 additions & 4 deletions src/view/components/triangle/Triangle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ interface Props {

const Triangle: FC<Props> = ({ statement }) => {
const {t} = useLanguage();
const subStatements = useSelector(
const subStatements:Statement[] = useSelector(
statementOptionsSelector(statement.statementId)
).filter((s) => s.evaluation?.sumCon !== undefined);
).filter((s:Statement) => s.evaluation?.sumCon !== undefined);

let maxEvaluators = 0;
subStatements.forEach((subStatement) => {
subStatements.forEach((subStatement:Statement) => {
if (subStatement.evaluation?.numberOfEvaluators !== undefined && subStatement.evaluation?.numberOfEvaluators > maxEvaluators) maxEvaluators = subStatement.evaluation.numberOfEvaluators;
});

Expand All @@ -29,7 +29,7 @@ const Triangle: FC<Props> = ({ statement }) => {

</div>
<div className={`${styles.triangle} ${styles["triangle--invisible"]}`}>
{subStatements.map((subStatement) => {
{subStatements.map((subStatement:Statement) => {
return (
<Dot key={subStatement.statementId} subStatement={subStatement} maxEvaluators={maxEvaluators}/>
);
Expand Down
2 changes: 0 additions & 2 deletions src/view/pages/statement/components/SwitchScreens.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ export default function SwitchScreens({
return (
<StatementEvaluationPage
statement={statement}
subStatements={subStatements}
handleShowTalker={handleShowTalker}
toggleAskNotifications={toggleAskNotifications}
/>
Expand Down Expand Up @@ -83,7 +82,6 @@ export default function SwitchScreens({
return (
<StatementEvaluationPage
statement={statement}
subStatements={subStatements}
handleShowTalker={handleShowTalker}
questions={true}
toggleAskNotifications={toggleAskNotifications}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,7 @@ export async function createStatementFromModal({
description,
isOptionSelected,
toggleAskNotifications,
parentStatement,
isSendToStoreTemp,
parentStatement
}: CreateStatementFromModalParams) {
try {
if (!title) throw new Error('title is undefined');
Expand Down
Loading

0 comments on commit d441391

Please sign in to comment.