Skip to content

Commit

Permalink
Merge branch 'feat/tasks' into feat/editable-vanilla-columns
Browse files Browse the repository at this point in the history
  • Loading branch information
GamerGirlandCo committed Oct 20, 2024
2 parents fe9a359 + b564533 commit fa26495
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/api/ui/views/task.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { useStableCallback } from "ui/hooks";
import { Fragment } from "preact";
import { APP_CONTEXT, DATACORE_CONTEXT } from "ui/markdown";
import { JSXInternal } from "preact/src/jsx";
import { Dispatch, useContext, useMemo, useRef, useState } from "preact/hooks";
import { Dispatch, useContext, useEffect, useMemo, useRef, useState } from "preact/hooks";
import { completeTask, rewriteTask } from "utils/task";
import { Literal, Literals } from "expression/literal";
import {
Expand All @@ -22,7 +22,6 @@ import { setInlineField } from "index/import/inline-field";
import { Field } from "expression/field";
import { DateTime } from "luxon";
import "styles/lists.css";
import { ControlledEditableTextField } from "ui/fields/editable-fields";

/**
* Props passed to the task list component.
Expand Down Expand Up @@ -126,13 +125,16 @@ export function Task({ item, state: props }: { item: MarkdownTaskItem; state: Ta
[eState.content, item, props.rows]
);

const [collapsed, setCollapsed] = useState<boolean>(true);
const [collapsed, setCollapsed] = useState<boolean>(false);
const hasChildren = item.$elements.length > 0;
useEffect(() => {
setCollapsed(!collapsed);
}, []);

return (
<li className={"datacore task-list-item" + (checked ? " is-checked" : "")} data-task={status}>
<CollapseIndicator
onClick={() => setCollapsed(!collapsed)}
onClick={() => setCollapsed((c) => !c)}
collapsed={collapsed}
hasChildren={hasChildren}
/>
Expand Down

0 comments on commit fa26495

Please sign in to comment.