mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 00:36:38 -04:00
Move Optimize All action into main deck options page
Closes #3696 I have no strong feelings about the message/button wordings or layout, so if people have better suggestions, they are welcome.
This commit is contained in:
parent
c253d40d1d
commit
5883e4eae8
3 changed files with 18 additions and 15 deletions
|
@ -314,7 +314,7 @@ deck-config-confirm-remove-name = Remove { $name }?
|
|||
|
||||
deck-config-save-button = Save
|
||||
deck-config-save-to-all-subdecks = Save to All Subdecks
|
||||
deck-config-save-and-optimize = Optimize All Presets
|
||||
deck-config-save-and-optimize = Optimize All
|
||||
deck-config-revert-button-tooltip = Restore this setting to its default value?
|
||||
|
||||
## These strings are shown via the Description button at the bottom of the
|
||||
|
@ -363,10 +363,10 @@ deck-config-must-have-400-reviews =
|
|||
deck-config-weights = FSRS parameters
|
||||
deck-config-compute-optimal-weights = Optimize FSRS parameters
|
||||
deck-config-compute-minimum-recommended-retention = Minimum recommended retention
|
||||
deck-config-optimize-button = Optimize
|
||||
deck-config-optimize-button = Optimize Current
|
||||
deck-config-compute-button = Compute
|
||||
deck-config-ignore-before = Ignore cards reviewed before
|
||||
deck-config-optimize-all-tip = You can optimize all presets at once by using the dropdown button next to "Save".
|
||||
deck-config-time-to-optimize = It's been a while - using the Optimize All button is recommended.
|
||||
deck-config-evaluate-button = Evaluate
|
||||
deck-config-desired-retention = Desired retention
|
||||
deck-config-historical-retention = Historical retention
|
||||
|
@ -542,3 +542,4 @@ deck-config-invalid-weights = Parameters must be either left blank to use the de
|
|||
deck-config-fsrs-on-all-clients =
|
||||
Please ensure all of your Anki clients are Anki(Mobile) 23.10+ or AnkiDroid 2.17+. FSRS will
|
||||
not work correctly if one of your clients is older.
|
||||
deck-config-optimize-all-tip = You can optimize all presets at once by using the dropdown button next to "Save".
|
||||
|
|
|
@ -26,7 +26,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
import SwitchRow from "$lib/components/SwitchRow.svelte";
|
||||
|
||||
import GlobalLabel from "./GlobalLabel.svelte";
|
||||
import { fsrsParams, type DeckOptionsState } from "./lib";
|
||||
import { commitEditing, fsrsParams, type DeckOptionsState } from "./lib";
|
||||
import SpinBoxFloatRow from "./SpinBoxFloatRow.svelte";
|
||||
import SpinBoxRow from "./SpinBoxRow.svelte";
|
||||
import Warning from "./Warning.svelte";
|
||||
|
@ -45,6 +45,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
import TableData from "../graphs/TableData.svelte";
|
||||
import { defaultGraphBounds, type TableDatum } from "../graphs/graph-helpers";
|
||||
import InputBox from "../graphs/InputBox.svelte";
|
||||
import { UpdateDeckConfigsMode } from "@generated/anki/deck_config_pb";
|
||||
|
||||
export let state: DeckOptionsState;
|
||||
export let openHelpModal: (String) => void;
|
||||
|
@ -57,7 +58,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
const daysSinceLastOptimization = state.daysSinceLastOptimization;
|
||||
|
||||
$: lastOptimizationWarning =
|
||||
$daysSinceLastOptimization > 30 ? tr.deckConfigOptimizeAllTip() : "";
|
||||
$daysSinceLastOptimization > 30 ? tr.deckConfigTimeToOptimize() : "";
|
||||
|
||||
let computeParamsProgress: ComputeParamsProgress | undefined;
|
||||
let computingParams = false;
|
||||
|
@ -300,6 +301,11 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
return tr.deckConfigPredictedOptimalRetention({ num: retention.toFixed(2) });
|
||||
}
|
||||
|
||||
async function computeAllParams(): Promise<void> {
|
||||
await commitEditing();
|
||||
state.save(UpdateDeckConfigsMode.COMPUTE_ALL_PARAMS);
|
||||
}
|
||||
|
||||
let tableData: TableDatum[] = [];
|
||||
const bounds = defaultGraphBounds();
|
||||
bounds.marginLeft += 8;
|
||||
|
@ -436,8 +442,14 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
{tr.statisticsReviews({ reviews: totalReviews })}
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="m-1">
|
||||
<Warning warning={lastOptimizationWarning} className="alert-warning" />
|
||||
|
||||
<button class="btn btn-primary" on:click={() => computeAllParams()}>
|
||||
{tr.deckConfigSaveAndOptimize()}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="m-2">
|
||||
|
|
|
@ -8,7 +8,6 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
import { withCollapsedWhitespace } from "@tslib/i18n";
|
||||
import { getPlatformString } from "@tslib/shortcuts";
|
||||
import { createEventDispatcher, tick } from "svelte";
|
||||
import { get } from "svelte/store";
|
||||
|
||||
import DropdownDivider from "$lib/components/DropdownDivider.svelte";
|
||||
import DropdownItem from "$lib/components/DropdownItem.svelte";
|
||||
|
@ -56,10 +55,6 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
|
||||
async function save(mode: UpdateDeckConfigsMode): Promise<void> {
|
||||
await commitEditing();
|
||||
if (mode === UpdateDeckConfigsMode.COMPUTE_ALL_PARAMS && !get(state.fsrs)) {
|
||||
alert(tr.deckConfigFsrsMustBeEnabled());
|
||||
return;
|
||||
}
|
||||
state.save(mode);
|
||||
}
|
||||
|
||||
|
@ -118,11 +113,6 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
>
|
||||
{tr.deckConfigSaveToAllSubdecks()}
|
||||
</DropdownItem>
|
||||
<DropdownItem
|
||||
on:click={() => save(UpdateDeckConfigsMode.COMPUTE_ALL_PARAMS)}
|
||||
>
|
||||
{tr.deckConfigSaveAndOptimize()}
|
||||
</DropdownItem>
|
||||
</Popover>
|
||||
</WithFloating>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue