Default Challenge.canStart to true
This commit is contained in:
parent
da6a47b1da
commit
8d0489c8e1
2 changed files with 8 additions and 3 deletions
|
@ -12,12 +12,16 @@
|
||||||
feature: true,
|
feature: true,
|
||||||
challenge: true,
|
challenge: true,
|
||||||
done: unref(completed),
|
done: unref(completed),
|
||||||
canStart: unref(canStart),
|
canStart: unref(canStart) && !unref(maxed),
|
||||||
maxed: unref(maxed),
|
maxed: unref(maxed),
|
||||||
...unref(classes)
|
...unref(classes)
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<button class="toggleChallenge" @click="toggle">
|
<button
|
||||||
|
class="toggleChallenge"
|
||||||
|
@click="toggle"
|
||||||
|
:disabled="!unref(canStart) || unref(maxed)"
|
||||||
|
>
|
||||||
{{ buttonText }}
|
{{ buttonText }}
|
||||||
</button>
|
</button>
|
||||||
<component v-if="unref(comp)" :is="unref(comp)" />
|
<component v-if="unref(comp)" :is="unref(comp)" />
|
||||||
|
|
|
@ -73,7 +73,7 @@ export type Challenge<T extends ChallengeOptions> = Replace<
|
||||||
T & BaseChallenge,
|
T & BaseChallenge,
|
||||||
{
|
{
|
||||||
visibility: GetComputableTypeWithDefault<T["visibility"], Visibility.Visible>;
|
visibility: GetComputableTypeWithDefault<T["visibility"], Visibility.Visible>;
|
||||||
canStart: GetComputableTypeWithDefault<T["canStart"], Ref<boolean>>;
|
canStart: GetComputableTypeWithDefault<T["canStart"], true>;
|
||||||
canComplete: GetComputableTypeWithDefault<T["canComplete"], Ref<boolean>>;
|
canComplete: GetComputableTypeWithDefault<T["canComplete"], Ref<boolean>>;
|
||||||
completionLimit: GetComputableTypeWithDefault<T["completionLimit"], 1>;
|
completionLimit: GetComputableTypeWithDefault<T["completionLimit"], 1>;
|
||||||
mark: GetComputableTypeWithDefault<T["mark"], Ref<boolean>>;
|
mark: GetComputableTypeWithDefault<T["mark"], Ref<boolean>>;
|
||||||
|
@ -209,6 +209,7 @@ export function createChallenge<T extends ChallengeOptions>(
|
||||||
}
|
}
|
||||||
|
|
||||||
processComputable(challenge as T, "canStart");
|
processComputable(challenge as T, "canStart");
|
||||||
|
setDefault(challenge, "canStart", true);
|
||||||
processComputable(challenge as T, "canComplete");
|
processComputable(challenge as T, "canComplete");
|
||||||
processComputable(challenge as T, "completionLimit");
|
processComputable(challenge as T, "completionLimit");
|
||||||
setDefault(challenge, "completionLimit", 1);
|
setDefault(challenge, "completionLimit", 1);
|
||||||
|
|
Loading…
Reference in a new issue