From d8edac1c9af2944804ea395cad9c6c8664dcf7f9 Mon Sep 17 00:00:00 2001 From: thepaperpilot Date: Fri, 11 Mar 2022 08:54:36 -0600 Subject: [PATCH] Add manual complete function for milestones --- src/features/milestones/milestone.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/features/milestones/milestone.tsx b/src/features/milestones/milestone.tsx index c22693c..9056ab2 100644 --- a/src/features/milestones/milestone.tsx +++ b/src/features/milestones/milestone.tsx @@ -59,6 +59,7 @@ export interface MilestoneOptions { export interface BaseMilestone extends Persistent { id: string; earned: Ref; + complete: VoidFunction; type: typeof MilestoneType; [Component]: typeof MilestoneComponent; [GatherProps]: () => Record; @@ -92,6 +93,10 @@ export function createMilestone( milestone[Component] = MilestoneComponent; milestone.earned = milestone[PersistentState]; + milestone.complete = function () { + milestone[PersistentState].value = true; + }; + processComputable(milestone as T, "visibility"); setDefault(milestone, "visibility", Visibility.Visible); const visibility = milestone.visibility as ProcessedComputable;