Skip to content

Commit cdf70c2

Browse files
committed
rename to keep the naming
1 parent f0a5ae8 commit cdf70c2

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

frontend/src/ts/modals/edit-preset.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ function hide(): void {
221221
async function apply(): Promise<void> {
222222
const modalEl = modal.getModal();
223223
const action = modalEl.getAttribute("data-action");
224-
const presetName = modalEl
224+
const propPresetName = modalEl
225225
.qsr<HTMLInputElement>(".group input[title='presets']")
226226
.getValue() as string;
227227
const presetId = modalEl.getAttribute("data-preset-id") as string;
@@ -252,7 +252,7 @@ async function apply(): Promise<void> {
252252
//validate the preset name only in add or edit mode
253253

254254
const noPresetName: boolean =
255-
presetName.replace(/^_+|_+$/g, "").length === 0; //all whitespace names are rejected
255+
propPresetName.replace(/^_+|_+$/g, "").length === 0; //all whitespace names are rejected
256256
if (noPresetName) {
257257
showNoticeNotification("Preset name cannot be empty");
258258
return;
@@ -271,10 +271,10 @@ async function apply(): Promise<void> {
271271
if (action === "add") {
272272
const configChanges = getConfigChanges();
273273
const activeSettingGroups = getActiveSettingGroupsFromState();
274-
const cleanedName = PresetNameSchema.parse(presetName);
274+
const presetName = PresetNameSchema.parse(propPresetName);
275275
const response = await Ape.presets.add({
276276
body: {
277-
name: cleanedName,
277+
name: presetName,
278278
config: configChanges,
279279
...(state.presetType === "partial" && {
280280
settingGroups: activeSettingGroups,
@@ -287,12 +287,12 @@ async function apply(): Promise<void> {
287287
} else {
288288
showSuccessNotification("Preset added", { durationMs: 2000 });
289289
snapshotPresets.push({
290-
name: cleanedName,
290+
name: presetName,
291291
config: configChanges,
292292
...(state.presetType === "partial" && {
293293
settingGroups: activeSettingGroups,
294294
}),
295-
display: cleanedName.replace(/_/g, " "),
295+
display: presetName.replace(/_/g, " "),
296296
_id: response.body.data.presetId,
297297
} as SnapshotPreset);
298298
}
@@ -307,11 +307,11 @@ async function apply(): Promise<void> {
307307
const configChanges = getConfigChanges();
308308
const activeSettingGroups: ConfigGroupName[] | null =
309309
state.presetType === "partial" ? getActiveSettingGroupsFromState() : null;
310-
const cleanedName = PresetNameSchema.parse(presetName);
310+
const presetName = PresetNameSchema.parse(propPresetName);
311311
const response = await Ape.presets.save({
312312
body: {
313313
_id: presetId,
314-
name: cleanedName,
314+
name: presetName,
315315
...(updateConfig && {
316316
config: configChanges,
317317
settingGroups: activeSettingGroups,
@@ -324,8 +324,8 @@ async function apply(): Promise<void> {
324324
} else {
325325
showSuccessNotification("Preset updated");
326326

327-
preset.name = cleanedName;
328-
preset.display = cleanedName.replace(/_/g, " ");
327+
preset.name = presetName;
328+
preset.display = presetName.replace(/_/g, " ");
329329
if (updateConfig) {
330330
preset.config = configChanges;
331331
if (state.presetType === "partial") {

frontend/src/ts/modals/edit-tag.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const actionModals: Record<Action, SimpleModal> = {
4646

4747
DB.getSnapshot()?.tags?.push({
4848
display: tagName.replace(/_/g, " "),
49-
name: response.body.data.name,
49+
name: tagName,
5050
_id: response.body.data._id,
5151
personalBests: {
5252
time: {},

0 commit comments

Comments
 (0)