mirror of https://github.com/usememos/memos.git
[Feature] Complete-tasks: Remove Complete Todos Task, By Adding Complete Button & integrate task extraction utility
This commit is contained in:
parent
3826d5804b
commit
c399a23582
|
|
@ -10,12 +10,12 @@ function MemoCompleteList() {
|
|||
const { mutate: deleteMemo } = useDeleteMemo();
|
||||
const { mutate: createMemo } = useCreateMemo();
|
||||
|
||||
// Parse tasks once per render for both counting and clearing
|
||||
// Parse tasks once per render for both counting and clearing
|
||||
const tasks = extractTasks(memo.content);
|
||||
const completedTasks = tasks.filter((task) => task.checked);
|
||||
const completedCount = completedTasks.length;
|
||||
const hasCompletedTasks = completedCount > 0;
|
||||
|
||||
|
||||
const handleClearCompleted = () => {
|
||||
if (!hasCompletedTasks) {
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -2,15 +2,17 @@ import { useMemoViewContext } from "../MemoViewContext";
|
|||
import MemoCompleteList from "./MemoCompleteList";
|
||||
|
||||
function MemoFooter() {
|
||||
const { memo } = useMemoViewContext();
|
||||
const hasTaskList = memo.property?.hasTaskList;
|
||||
if (!hasTaskList) {
|
||||
const { memo } = useMemoViewContext();
|
||||
const hasTaskList = memo.property?.hasTaskList;
|
||||
|
||||
if (!hasTaskList) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<footer className=" w-full mt-5 flex justify-end items-center">
|
||||
<MemoCompleteList/>
|
||||
</footer>
|
||||
<footer className="w-full mt-5 flex justify-end items-center">
|
||||
<MemoCompleteList />
|
||||
</footer>
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -146,6 +146,7 @@ const PagedMemoList = (props: Props) => {
|
|||
|
||||
const children = (
|
||||
<div className="flex flex-col justify-start w-full max-w-2xl mx-auto">
|
||||
|
||||
{/* Show skeleton loader during initial load */}
|
||||
{isLoading ? (
|
||||
<Skeleton showCreator={props.showCreator} count={4} />
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ export const memoKeys = {
|
|||
};
|
||||
|
||||
export function useMemos(request: Partial<ListMemosRequest> = {}) {
|
||||
|
||||
return useQuery({
|
||||
queryKey: memoKeys.list(request),
|
||||
queryFn: async () => {
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ export interface TaskInfo {
|
|||
checked: boolean;
|
||||
}
|
||||
|
||||
|
||||
// Extract all task list items from markdown using AST parsing
|
||||
// This correctly ignores task-like patterns inside code blocks
|
||||
function extractTasksFromAst(markdown: string): TaskInfo[] {
|
||||
|
|
|
|||
Loading…
Reference in New Issue