Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions frontend/src/html/pages/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,27 @@
<button class="addPresetButton fullWidth">add preset</button>
</div>
</div>
<div
class="section resultSaving needsAccount"
data-config-name="resultSavingEnabled"
>
<div class="groupTitle">
<i class="fas fa-save"></i>
<span>result saving</span>
<button class="text" tabindex="-1">
<i class="fas fa-fw fa-link"></i>
</button>
</div>
<div class="text">
Toggle result saving. When disabled, results will not be saved (
<b>practice mode</b>
).
</div>
<div class="buttons">
<button data-config-value="false">off</button>
<button data-config-value="true">on</button>
</div>
</div>
<div class="section" data-config-name="difficulty">
<div class="groupTitle">
<i class="fas fa-star"></i>
Expand Down
7 changes: 7 additions & 0 deletions frontend/src/ts/commandline/commandline-metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,13 @@ export const commandlineConfigMetadata: CommandlineConfigMetadataObject = {
options: "fromSchema",
},
},
resultSavingEnabled: {
subgroup: {
options: "fromSchema",
alias: (val) => (val ? "enabled" : "disabled"),
},
alias: "results practice incognito",
},
blindMode: {
subgroup: {
options: "fromSchema",
Expand Down
4 changes: 1 addition & 3 deletions frontend/src/ts/commandline/lists.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import MinBurstCommands from "./lists/min-burst";
import BailOutCommands from "./lists/bail-out";
import QuoteFavoriteCommands from "./lists/quote-favorites";
import ResultSavingCommands from "./lists/result-saving";
import NavigationCommands from "./lists/navigation";
import ResultScreenCommands from "./lists/result-screen";
import CustomBackgroundCommands from "./lists/custom-background";
Expand Down Expand Up @@ -98,10 +97,10 @@ export const commands: CommandsSubgroup = {
//account
...TagsCommands,
...PresetsCommands,
...ResultSavingCommands,

//behavior
...buildCommands(
"resultSavingEnabled",
"difficulty",
"quickRestart",
"repeatQuotes",
Expand Down Expand Up @@ -379,7 +378,6 @@ const lists = {
minBurst: MinBurstCommands[0]?.subgroup,
funbox: FunboxCommands[0]?.subgroup,
tags: TagsCommands[0]?.subgroup,
resultSaving: ResultSavingCommands[0]?.subgroup,
ads: adsCommands[0]?.subgroup,
};

Expand Down
39 changes: 0 additions & 39 deletions frontend/src/ts/commandline/lists/result-saving.ts

This file was deleted.

6 changes: 6 additions & 0 deletions frontend/src/ts/config-metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,12 @@ export const configMetadata: ConfigMetadataObject = {
changeRequiresRestart: false,
group: "behavior",
},
resultSavingEnabled: {
icon: "fa-save",
displayString: "result saving",
changeRequiresRestart: false,
group: "behavior",
},
blindMode: {
icon: "fa-eye-slash",
displayString: "blind mode",
Expand Down
1 change: 1 addition & 0 deletions frontend/src/ts/constants/default-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ const obj: Config = {
minAccCustom: 90,
monkey: false,
repeatQuotes: "off",
resultSavingEnabled: true,
oppositeShiftMode: "off",
customBackground: "",
customBackgroundSize: "cover",
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/ts/elements/modes-notice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ ConfigEvent.subscribe(({ key }) => {
"quickRestart",
"customPolyglot",
"alwaysShowDecimalPlaces",
"resultSavingEnabled",
];
if (configKeys.includes(key)) {
void update();
Expand All @@ -49,9 +50,9 @@ export async function update(): Promise<void> {
);
}

if (!TestState.savingEnabled) {
if (!Config.resultSavingEnabled) {
testModesNotice.appendHtml(
`<div class="textButton" commands="resultSaving" style="color:var(--error-color);"><i class="fas fa-save"></i>saving disabled</div>`,
`<div class="textButton" commands="resultSavingEnabled" style="color:var(--error-color);"><i class="fas fa-save"></i>saving disabled</div>`,
);
}

Expand Down
1 change: 1 addition & 0 deletions frontend/src/ts/pages/account-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ export function updateUI(): void {
updateAuthenticationSections();
updateIntegrationSections();
updateAccountSections();

void ApeKeyTable.update(updateUI);
void BlockedUserTable.update();
updateTabs();
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/ts/pages/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ async function initGroups(): Promise<void> {
);
groups["difficulty"] = new SettingsGroup("difficulty", "button");
groups["quickRestart"] = new SettingsGroup("quickRestart", "button");
groups["resultSavingEnabled"] = new SettingsGroup(
"resultSavingEnabled",
"button",
);
groups["showAverage"] = new SettingsGroup("showAverage", "button");
groups["keymapMode"] = new SettingsGroup("keymapMode", "button", {
updateCallback: () => {
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/ts/test/test-logic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ export function restart(options = {} as RestartOptions): void {
options.withSameWordset = true;
}

if (TestState.savingEnabled) {
if (Config.resultSavingEnabled) {
TestInput.pushKeypressesToHistory();
TestInput.pushErrorToHistory();
TestInput.pushAfkToHistory();
Expand Down Expand Up @@ -1192,7 +1192,7 @@ async function saveResult(
): Promise<null | Awaited<ReturnType<typeof Ape.results.add>>> {
AccountButton.loading(true);

if (!TestState.savingEnabled) {
if (!Config.resultSavingEnabled) {
Notifications.add("Result not saved: disabled by user", -1, {
duration: 3,
customTitle: "Notice",
Expand Down Expand Up @@ -1355,7 +1355,7 @@ export function fail(reason: string): void {
TestInput.pushErrorToHistory();
TestInput.pushAfkToHistory();
void finish(true);
if (!TestState.savingEnabled) return;
if (!Config.resultSavingEnabled) return;
const testSeconds = TestStats.calculateTestSeconds(performance.now());
const afkseconds = TestStats.calculateAfkSeconds(testSeconds);
let tt = Numbers.roundTo2(testSeconds - afkseconds);
Expand Down
5 changes: 0 additions & 5 deletions frontend/src/ts/test/test-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ export let isRepeated = false;
export let isPaceRepeat = false;
export let isActive = false;
export let activeChallenge: null | Challenge = null;
export let savingEnabled = true;
export let bailedOut = false;
export let selectedQuoteId = 1;
export let activeWordIndex = 0;
Expand All @@ -31,10 +30,6 @@ export function setActiveChallenge(val: null | Challenge): void {
activeChallenge = val;
}

export function setSaving(val: boolean): void {
savingEnabled = val;
}

export function setBailedOut(tf: boolean): void {
bailedOut = tf;
}
Expand Down
1 change: 1 addition & 0 deletions packages/schemas/src/configs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@ export const ConfigSchema = z
difficulty: DifficultySchema,
quickRestart: QuickRestartSchema,
repeatQuotes: RepeatQuotesSchema,
resultSavingEnabled: z.boolean(),
blindMode: z.boolean(),
alwaysShowWordsHistory: z.boolean(),
singleListCommandLine: SingleListCommandLineSchema,
Expand Down