Skip to content

Commit 8fcf1f7

Browse files
authored
refactor: update settings (#1094)
1 parent a38838d commit 8fcf1f7

File tree

22 files changed

+592
-465
lines changed

22 files changed

+592
-465
lines changed

src/algorithms/base/isrs-algorithm.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ import { OsrNoteGraph } from "src/algorithms/osr/osr-note-graph";
44
import { DueDateHistogram } from "src/due-date-histogram";
55
import { Note } from "src/note";
66

7+
export enum Algorithm {
8+
SM_2_OSR = "SM-2-OSR",
9+
}
10+
711
export interface ISrsAlgorithm {
812
noteOnLoadedNote(path: string, note: Note, noteEase: number): void;
913
noteCalcNewSchedule(

src/data-stores/base/data-store.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ import { RepItemScheduleInfo } from "src/algorithms/base/rep-item-schedule-info"
22
import { RepItemStorageInfo } from "src/data-stores/base/rep-item-storage-info";
33
import { Question } from "src/question";
44

5+
export enum DataStoreName {
6+
NOTES = "NOTES",
7+
}
8+
59
export interface IDataStore {
610
questionCreateSchedule(
711
originalQuestionText: string,

src/data-stores/store-in-note/note.ts renamed to src/data-stores/notes/notes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { Question } from "src/question";
1111
import { SRSettings } from "src/settings";
1212
import { DateUtil, formatDate_YYYY_MM_DD, globalDateProvider } from "src/utils/dates";
1313

14-
export class StoreInNote implements IDataStore {
14+
export class StoreInNotes implements IDataStore {
1515
private settings: SRSettings;
1616
app: App;
1717
easeByPath: NoteEaseList;

src/gui/tabs.tsx

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@
1616
*
1717
* Contact the author (Jarkko Linnanvirta): https://github.com/Taitava/
1818
*/
19-
2019
import { setIcon } from "obsidian";
20+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
21+
import h from "vhtml";
2122

2223
export interface Tab {
2324
title: string;
@@ -63,7 +64,9 @@ export function createTabs(
6364
const tab_buttons: TabButtons = {};
6465
const tab_structure: TabStructure = {
6566
header: tab_header,
66-
active_tab_id: Object.keys(tabs)[0] as string, // Indicate that the first tab is active. This does not affect what tab is active in practise, it just reports the active tab.
67+
// Indicate that the first tab is active.
68+
// This does not affect what tab is active in practise, it just reports the active tab.
69+
active_tab_id: Object.keys(tabs)[0] as string,
6770
buttons: tab_buttons,
6871
contentContainers: tab_content_containers,
6972
contentGeneratorPromises: {},
@@ -80,7 +83,9 @@ export function createTabs(
8083
},
8184
});
8285
button.onclick = function (event: MouseEvent) {
83-
const tab_button = this as HTMLElement; // Use 'this' instead of event.target because this way we'll always get a button element, not an element inside the button (i.e. an icon).
86+
// Use 'this' instead of event.target because this way we'll always get a button element,
87+
// not an element inside the button (i.e. an icon).
88+
const tab_button = this as HTMLElement;
8489

8590
// Hide all tab contents and get the max dimensions
8691
let max_width = 0;
@@ -95,15 +100,19 @@ export function createTabs(
95100
"Container element is missing. Did not get a parent from tab header.",
96101
);
97102
}
98-
const tab_contents = container_element.findAll("div.sr-tab-content"); // Do not get all tab contents that exist, because there might be multiple tab systems open at the same time.
103+
104+
// Do not get all tab contents that exist,
105+
// because there might be multiple tab systems open at the same time.
106+
const tab_contents = container_element.findAll("div.sr-tab-content");
99107
const is_main_settings_modal = container_element.hasClass("vertical-tab-content");
100108
for (const index in tab_contents) {
101109
const tab_content = tab_contents[index];
102110

103111
// Get the maximum tab dimensions so that all tabs can have the same dimensions.
104112
// But don't do it if this is the main settings modal
105113
if (!is_main_settings_modal) {
106-
tab_content.addClass("sr-tab-active"); // Need to make the tab visible temporarily in order to get the dimensions.
114+
// Need to make the tab visible temporarily in order to get the dimensions.
115+
tab_content.addClass("sr-tab-active");
107116
if (tab_content.offsetHeight > max_height) {
108117
max_height = tab_content.offsetHeight;
109118
}
@@ -117,7 +126,9 @@ export function createTabs(
117126
}
118127

119128
// Remove active status from all buttons
120-
const adjacent_tab_buttons = tab_header.findAll(".sr-tab-header-button"); // Do not get all tab buttons that exist, because there might be multiple tab systems open at the same time.
129+
// Do not get all tab buttons that exist,
130+
// because there might be multiple tab systems open at the same time.
131+
const adjacent_tab_buttons = tab_header.findAll(".sr-tab-header-button");
121132
for (const index in adjacent_tab_buttons) {
122133
const tab_button = adjacent_tab_buttons[index];
123134
tab_button.removeClass("sr-tab-active");
@@ -142,10 +153,12 @@ export function createTabs(
142153
tab_content.addClass("sr-tab-active");
143154

144155
// Mark the clicked tab as active in TabStructure (just to report which tab is currently active)
145-
tab_structure.active_tab_id = activate_tab_id.replace(/^sr-tab-/, ""); // Remove "sr-tab" prefix.
156+
// Remove "sr-tab" prefix.
157+
tab_structure.active_tab_id = activate_tab_id.replace(/^sr-tab-/, "");
146158

147159
// Focus an element (if a focusable element is present)
148-
tab_content.find(".sr-focus-element-on-tab-opening")?.focus(); // ? = If not found, do nothing.
160+
// ? = If not found, do nothing.
161+
tab_content.find(".sr-focus-element-on-tab-opening")?.focus();
149162

150163
// Apply the max dimensions to this tab
151164
// But don't do it if this is the main settings modal
@@ -159,7 +172,7 @@ export function createTabs(
159172
};
160173
if (tab.icon) setIcon(button, tab.icon);
161174

162-
button.insertAdjacentText("beforeend", " " + tab.title);
175+
button.insertAdjacentHTML("beforeend", <span style="padding-left: 5px;">{tab.title}</span>);
163176
tab_buttons[tab_id] = button;
164177

165178
// Create content container

src/lang/locale/ar.ts

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ export default {
5555
GROUP_FLASHCARD_REVIEW: "Flashcard Review",
5656
GROUP_FLASHCARD_SEPARATORS: "Flashcard Separators",
5757
GROUP_DATA_STORAGE: "Storage of Scheduling Data",
58+
GROUP_DATA_STORAGE_DESC: "Choose where to store the scheduling data",
5859
GROUP_FLASHCARDS_NOTES: "Flashcards & Notes",
5960
GROUP_CONTRIBUTING: "Contributing",
6061
CHECK_WIKI: '.<a href="${wiki_url}">wiki</a> لمزيد من المعلومات ، تحقق من',
@@ -63,11 +64,11 @@ export default {
6364
GITHUB_ISSUES:
6465
'Raise an issue <a href="${issues_url}">here</a> if you have a feature request or a bug report.',
6566
GITHUB_SOURCE_CODE:
66-
'Project source code available on <a href="${github_project_url}">GitHub</a>',
67+
'The project\'s source code is available on <a href="${github_project_url}">GitHub</a>.',
6768
CODE_CONTRIBUTION_INFO:
68-
'Information on <a href="${code_contribution_url}">code contributions</a>',
69+
'<a href="${code_contribution_url}">Here\'s</a> how to contribute code to the plugin.',
6970
TRANSLATION_CONTRIBUTION_INFO:
70-
'Information on <a href="${translation_contribution_url}">translating the plugin</a> to your language',
71+
'<a href="${translation_contribution_url}">Here\'s</a> how to translate the plugin to another language.',
7172
PROJECT_CONTRIBUTIONS:
7273
'Raise an issue <a href="${issues_url}">here</a> if you have a feature request or a bug report',
7374
FOLDERS_TO_IGNORE: "مجلدات لتجاهلها",
@@ -81,7 +82,7 @@ export default {
8182
FLASHCARD_EASY_DESC: '"تخصيص التسمية للزر "سهل',
8283
FLASHCARD_GOOD_DESC: '"تخصيص التسمية للزر "جيد',
8384
FLASHCARD_HARD_DESC: '"تخصيص التسمية للزر "صعب',
84-
REVIEW_BUTTON_DELAY: "Button press delay (ms)",
85+
REVIEW_BUTTON_DELAY: "Button Press Delay (ms)",
8586
REVIEW_BUTTON_DELAY_DESC: "Add a delay to the review buttons before they can be pressed again.",
8687
FLASHCARD_TAGS: "وُسوم البطاقات",
8788
FLASHCARD_TAGS_DESC: "#2أدخل الوُسوم مفصولة بمسافات أو أسطر جديدة ، أي بطاقات# رزمة3# رزمة",
@@ -137,7 +138,7 @@ export default {
137138
MAX_N_DAYS_REVIEW_QUEUE: "الحد الأقصى لعدد الأيام التي يجب عرضها على اللوحة اليمنى",
138139
MIN_ONE_DAY: "يجب أن يكون عدد الأيام 1 على الأقل",
139140
VALID_NUMBER_WARNING: "يرجى تقديم رقم صالح",
140-
UI_PREFERENCES: "تفضيلات واجهة المستخدم",
141+
UI: "User Interface",
141142
SHOW_STATUS_BAR: "Show status bar",
142143
SHOW_STATUS_BAR_DESC:
143144
"Turn this off to hide the flashcard's review status in Obsidian's status bar",
@@ -148,8 +149,8 @@ export default {
148149
INITIALLY_EXPAND_SUBDECKS_IN_TREE_DESC:
149150
" عطل هذا الخيار لطي الرُزم المتداخلة في نفس البطاقة , مفيد إذا كان لديك بطاقات تنتمي إلى العديد من الرُزم في نفس الملف",
150151
ALGORITHM: "خوارزمية",
151-
CHECK_ALGORITHM_WIKI:
152-
'<a href="${algo_url}">algorithm implementation</a> :لمزيد من المعلومات تحقق من',
152+
CHECK_ALGORITHM_WIKI: '<a href="${algo_url}">algorithm details</a> :لمزيد من المعلومات تحقق من',
153+
SM2_OSR_VARIANT: "OSR's variant of SM-2",
153154
BASE_EASE: "سهولة القاعدة",
154155
BASE_EASE_DESC: "الحد الأدنى = 130 ، ويفضل حوالي 250.",
155156
BASE_EASE_MIN_WARNING: "يجب أن تكون سهولة القاعدة 130 على الأقل.",
@@ -165,9 +166,12 @@ export default {
165166
MAX_LINK_CONTRIB: "أقصى مساهمة ارتباط",
166167
MAX_LINK_CONTRIB_DESC: "أقصى مساهمة للسهولة المرجحة للملاحظات المرتبطة بالسهولة الأولية.",
167168
LOGGING: "تسجيل",
168-
DISPLAY_DEBUG_INFO: "عرض معلومات التصحيح على وحدة تحكم المطور",
169-
DISPLAY_PARSER_DEBUG_INFO:
170-
"Display debugging information for the parser on the developer console",
169+
DISPLAY_SCHEDULING_DEBUG_INFO: "عرض معلومات التصحيح على وحدة تحكم المطور",
170+
DISPLAY_PARSER_DEBUG_INFO: "Show the parser's debugging information on the developer console",
171+
SCHEDULING: "Scheduling",
172+
EXPERIMENTAL: "Experimental",
173+
HELP: "Help",
174+
STORE_IN_NOTES: "In the notes",
171175

172176
// sidebar.ts
173177
NOTES_REVIEW_QUEUE: "ملاحظات قائمة المراجعة",

src/lang/locale/cz.ts

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ export default {
5555
GROUP_FLASHCARD_REVIEW: "Flashcard Review",
5656
GROUP_FLASHCARD_SEPARATORS: "Flashcard Separators",
5757
GROUP_DATA_STORAGE: "Storage of Scheduling Data",
58+
GROUP_DATA_STORAGE_DESC: "Choose where to store the scheduling data",
5859
GROUP_FLASHCARDS_NOTES: "Flashcards & Notes",
5960
GROUP_CONTRIBUTING: "Contributing",
6061
CHECK_WIKI: 'Pro více informací jděte na <a href="${wiki_url}">wiki</a>.',
@@ -63,11 +64,11 @@ export default {
6364
GITHUB_ISSUES:
6465
'Raise an issue <a href="${issues_url}">here</a> if you have a feature request or a bug report.',
6566
GITHUB_SOURCE_CODE:
66-
'Project source code available on <a href="${github_project_url}">GitHub</a>',
67+
'The project\'s source code is available on <a href="${github_project_url}">GitHub</a>.',
6768
CODE_CONTRIBUTION_INFO:
68-
'Information on <a href="${code_contribution_url}">code contributions</a>',
69+
'<a href="${code_contribution_url}">Here\'s</a> how to contribute code to the plugin.',
6970
TRANSLATION_CONTRIBUTION_INFO:
70-
'Information on <a href="${translation_contribution_url}">translating the plugin</a> to your language',
71+
'<a href="${translation_contribution_url}">Here\'s</a> how to translate the plugin to another language.',
7172
PROJECT_CONTRIBUTIONS:
7273
'Raise an issue <a href="${issues_url}">here</a> if you have a feature request or a bug report',
7374
FOLDERS_TO_IGNORE: "Ignorované složky",
@@ -81,7 +82,7 @@ export default {
8182
FLASHCARD_EASY_DESC: 'Customize the label for the "Easy" Button',
8283
FLASHCARD_GOOD_DESC: 'Customize the label for the "Good" Button',
8384
FLASHCARD_HARD_DESC: 'Customize the label for the "Hard" Button',
84-
REVIEW_BUTTON_DELAY: "Button press delay (ms)",
85+
REVIEW_BUTTON_DELAY: "Button Press Delay (ms)",
8586
REVIEW_BUTTON_DELAY_DESC: "Add a delay to the review buttons before they can be pressed again.",
8687
FLASHCARD_TAGS: "Tag pro kartičky",
8788
FLASHCARD_TAGS_DESC:
@@ -141,7 +142,7 @@ export default {
141142
MAX_N_DAYS_REVIEW_QUEUE: "Maximální počet dní zobrazených v pravém panelu",
142143
MIN_ONE_DAY: "Počet dní musí být minimálně 1.",
143144
VALID_NUMBER_WARNING: "Prosím zadejte validní číslo.",
144-
UI_PREFERENCES: "Předvolby uživatelského rozhraní",
145+
UI: "Předvolby uživatelského rozhraní",
145146
SHOW_STATUS_BAR: "Show status bar",
146147
SHOW_STATUS_BAR_DESC:
147148
"Turn this off to hide the flashcard's review status in Obsidian's status bar",
@@ -153,6 +154,7 @@ export default {
153154
"Vypněte toto, chcete-li sbalit vnořené balíčky na stejné kartě. To je užitečné, pokud máte kartičky, které patří k mnoha balíčkům ve stejném souboru.",
154155
ALGORITHM: "Algoritmus",
155156
CHECK_ALGORITHM_WIKI: 'Pro více informací jděte na <a href="${algo_url}">popis algoritmu</a>.',
157+
SM2_OSR_VARIANT: "OSR's variant of SM-2",
156158
BASE_EASE: "Základní složitost",
157159
BASE_EASE_DESC: "minimum = 130, nejlépe přibližně 250.",
158160
BASE_EASE_MIN_WARNING: "Základní složitost musí být minimálně 130.",
@@ -169,9 +171,12 @@ export default {
169171
MAX_LINK_CONTRIB_DESC:
170172
"Maximální příspěvek vážené složitosti prolinkovaných poznámek použitý pro určení počáteční složitosti.",
171173
LOGGING: "Zaznamenávám",
172-
DISPLAY_DEBUG_INFO: "Zobrazit informace pro ladění na vývojářské konzoli",
173-
DISPLAY_PARSER_DEBUG_INFO:
174-
"Display debugging information for the parser on the developer console",
174+
DISPLAY_SCHEDULING_DEBUG_INFO: "Zobrazit informace pro ladění na vývojářské konzoli",
175+
DISPLAY_PARSER_DEBUG_INFO: "Show the parser's debugging information on the developer console",
176+
SCHEDULING: "Scheduling",
177+
EXPERIMENTAL: "Experimental",
178+
HELP: "Help",
179+
STORE_IN_NOTES: "In the notes",
175180

176181
// sidebar.ts
177182
NOTES_REVIEW_QUEUE: "Fronta poznámek k revizi",

src/lang/locale/de.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ export default {
6161
GROUP_FLASHCARD_REVIEW: "Flashcard Review",
6262
GROUP_FLASHCARD_SEPARATORS: "Flashcard Separators",
6363
GROUP_DATA_STORAGE: "Storage of Scheduling Data",
64+
GROUP_DATA_STORAGE_DESC: "Choose where to store the scheduling data",
6465
GROUP_FLASHCARDS_NOTES: "Flashcards & Notes",
6566
GROUP_CONTRIBUTING: "Contributing",
6667
CHECK_WIKI: 'Weitere Informationen gibt es im <a href="${wiki_url}">Wiki</a> (english).',
@@ -69,11 +70,11 @@ export default {
6970
GITHUB_ISSUES:
7071
'Raise an issue <a href="${issues_url}">here</a> if you have a feature request or a bug report.',
7172
GITHUB_SOURCE_CODE:
72-
'Project source code available on <a href="${github_project_url}">GitHub</a>',
73+
'The project\'s source code is available on <a href="${github_project_url}">GitHub</a>.',
7374
CODE_CONTRIBUTION_INFO:
74-
'Information on <a href="${code_contribution_url}">code contributions</a>',
75+
'<a href="${code_contribution_url}">Here\'s</a> how to contribute code to the plugin.',
7576
TRANSLATION_CONTRIBUTION_INFO:
76-
'Information on <a href="${translation_contribution_url}">translating the plugin</a> to your language',
77+
'<a href="${translation_contribution_url}">Here\'s</a> how to translate the plugin to another language.',
7778
PROJECT_CONTRIBUTIONS:
7879
'Raise an issue <a href="${issues_url}">here</a> if you have a feature request or a bug report',
7980
FOLDERS_TO_IGNORE: "Ausgeschlossene Ordner",
@@ -157,7 +158,7 @@ export default {
157158
"Maximale Anzahl anstehender Notizen, die im rechten Fensterbereich angezeigt werden",
158159
MIN_ONE_DAY: "Anzahl der Tage muss mindestens 1 sein.",
159160
VALID_NUMBER_WARNING: "Bitte eine gültige Zahl eingeben.",
160-
UI_PREFERENCES: "Einstellungen der Benutzeroberfläche",
161+
UI: "User Interface",
161162
SHOW_STATUS_BAR: "Show status bar",
162163
SHOW_STATUS_BAR_DESC:
163164
"Turn this off to hide the flashcard's review status in Obsidian's status bar",
@@ -170,6 +171,7 @@ export default {
170171
ALGORITHM: "Algorithmus",
171172
CHECK_ALGORITHM_WIKI:
172173
'Weiterführende Informationen: <a href="${algo_url}">Implementierung des Algorithmus</a> (english).',
174+
SM2_OSR_VARIANT: "OSR's variant of SM-2",
173175
BASE_EASE: "Basis der Schwierigkeit",
174176
BASE_EASE_DESC: "Minimum ist 130. Empfohlen wird ca. 250.",
175177
BASE_EASE_MIN_WARNING: "Basis der Schwierigkeit muss mindestens 130 sein.",
@@ -188,9 +190,13 @@ export default {
188190
MAX_LINK_CONTRIB_DESC:
189191
"Maximaler Einfluss der Einfachheiten verlinkter Notizen zur gewichteten initialen Einfachheit einer neuen Lernkarte.",
190192
LOGGING: "Protokollierung",
191-
DISPLAY_DEBUG_INFO: "Informationen zum Debugging in der Entwicklerkonsole anzeigen",
193+
DISPLAY_SCHEDULING_DEBUG_INFO: "Informationen zum Debugging in der Entwicklerkonsole anzeigen",
192194
DISPLAY_PARSER_DEBUG_INFO:
193195
"Informationen zum parser Debugging in der Entwicklerkonsole anzeigen",
196+
SCHEDULING: "Scheduling",
197+
EXPERIMENTAL: "Experimental",
198+
HELP: "Help",
199+
STORE_IN_NOTES: "In the notes",
194200

195201
// sidebar.ts
196202
NOTES_REVIEW_QUEUE: "Anstehende Notizen zur Wiederholung",

0 commit comments

Comments
 (0)