Skip to content

Commit 20552a0

Browse files
typeScript converted son --> child
1 parent 830e96c commit 20552a0

File tree

8 files changed

+69
-69
lines changed

8 files changed

+69
-69
lines changed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,10 @@ When you open a note from either the `CLUSTERS` or `ORPHANS` folder the `Cluster
7777

7878
![baby](https://github.com/lorens-osman-dev/cluster/blob/assets/babdc.svg)
7979

80-
- This button creates a new note linked to the current note, we call it `son` note.
81-
- `son` note means the new created note will contains link to the current note and tag with cluster's name.
82-
- The generation property of the `son` note will be the current note's generation +1
83-
- A new folder with the same name of current note will be created for all `son` notes of the current note.
80+
- This button creates a new note linked to the current note, we call it `child` note.
81+
- `child` note means the new created note will contains link to the current note and tag with cluster's name.
82+
- The generation property of the `child` note will be the current note's generation +1
83+
- A new folder with the same name of current note will be created for all `child` notes of the current note.
8484

8585
![brother](https://github.com/lorens-osman-dev/cluster/blob/assets/git-compare.svg)
8686

@@ -96,7 +96,7 @@ When you open a note from either the `CLUSTERS` or `ORPHANS` folder the `Cluster
9696

9797
- This button deletes current note.
9898
- If the current note has no brothers the containing folder will be deleted.
99-
- If the current note has sons the sons will be deleted along with their own folders.
99+
- If the current note has children the children will be deleted along with their own folders.
100100
- If the current note is `cluster` all the cluster's files and folders will be deleted.
101101

102102
![extra buttons](https://github.com/lorens-osman-dev/cluster/blob/assets/arrow-left-square.svg?raw=true)
@@ -118,18 +118,18 @@ When you open a note from either the `CLUSTERS` or `ORPHANS` folder the `Cluster
118118
### ⚙️ PC Recommendation
119119

120120
- Set `Ctrl+Shift+B` hotkey to New brother command.
121-
- Set `Ctrl+Shift+S` hotkey to New son command.
121+
- Set `Ctrl+Shift+S` hotkey to New child command.
122122
- Set `Ctrl+Shift+C` hotkey to New cluster command.
123123
- Set `Ctrl+Shift+D` hotkey to Delete active note command.
124124

125125
## HELP !
126126

127127
**The Challenge**:
128128

129-
Currently, the Cluster plugin for each `son` note creates a subfolder with the same name as the `parent` note, following these steps :
129+
Currently, the Cluster plugin for each `child` note creates a subfolder with the same name as the `parent` note, following these steps :
130130

131131
1. create folder with same name of the `parent` note if is not exist.
132-
2. Create the `son` note within the newly created folder.
132+
2. Create the `child` note within the newly created folder.
133133

134134
**Benefits:**
135135

src/createFamily/buttons.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -117,16 +117,16 @@ function appendOrRemoveChild(appObject: App, file: TFile, obsidianContainer: any
117117
const clusterBtn = makeButton(appObject, "Cluster", "clusterBtn", "Create New Cluster in [CLUSTERS] folder")
118118
setExternalIcon(clusterBtn, "cluster")
119119

120-
const sonBtn = makeButton(appObject, "Son", "sonBtn", `Create Son for current [${file.basename}] note`)
121-
setIcon(sonBtn, "baby")
120+
const childBtn = makeButton(appObject, "Child", "childBtn", `Create Child for current [${file.basename}] note`)
121+
setIcon(childBtn, "baby")
122122

123123
const brotherBtn = makeButton(appObject, "Brother", "brotherBtn", `Create Brother for current [${file.basename}] note`)
124124
setIcon(brotherBtn, "git-compare")
125125

126126
const orphanBtn = makeButton(appObject, "Orphan", "orphanBtn", `Create New Orphan note in [ORPHANS] folder`)
127127
setIcon(orphanBtn, "disc")
128128

129-
const deleteBtn = makeButton(appObject, "Delete", "deleteBtn", `Delete the current [${file.basename}] note along with its associated son notes if they exist`)
129+
const deleteBtn = makeButton(appObject, "Delete", "deleteBtn", `Delete the current [${file.basename}] note along with its associated child notes if they exist`)
130130
setIcon(deleteBtn, "trash-2")
131131

132132
// Making Extra Buttons
@@ -146,7 +146,7 @@ function appendOrRemoveChild(appObject: App, file: TFile, obsidianContainer: any
146146

147147
// Append Buttons to buttonsLineContainer
148148
buttonsLineContainer?.appendChild(clusterBtn)
149-
buttonsLineContainer?.appendChild(sonBtn)
149+
buttonsLineContainer?.appendChild(childBtn)
150150
buttonsLineContainer?.appendChild(brotherBtn)
151151
buttonsLineContainer?.appendChild(orphanBtn)
152152
buttonsLineContainer?.appendChild(deleteBtn)
@@ -166,7 +166,7 @@ function appendOrRemoveChild(appObject: App, file: TFile, obsidianContainer: any
166166
buttonsLineContainer.style.backgroundColor = Vars.buttonsLineContainerBG_orphans
167167
//@ts-ignore
168168
extraButtonsContainer.style.backgroundColor = Vars.buttonsLineContainerBG_orphans
169-
buttonsLineContainer?.removeChild(sonBtn)
169+
buttonsLineContainer?.removeChild(childBtn)
170170
buttonsLineContainer?.removeChild(brotherBtn)
171171
}
172172

@@ -188,9 +188,9 @@ function makeButton(appObject: App, type: string, className: string, tooltipMsg:
188188
createClustersAndOrphansFolder(appObject);
189189
new familyModal(appObject, U.NewFileLocation.NewTab, "newCluster", undefined).open();
190190
}
191-
else if (type == "Son") {
191+
else if (type == "Child") {
192192
createClustersAndOrphansFolder(appObject);
193-
new familyModal(appObject, U.NewFileLocation.NewTab, "newSon", undefined).open()
193+
new familyModal(appObject, U.NewFileLocation.NewTab, "newChild", undefined).open()
194194
}
195195
else if (type == "Brother") {
196196
createClustersAndOrphansFolder(appObject);

src/createFamily/deleteActiveNoteModal.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export default class deleteActiveNoteModal extends Modal {
2121
this.inputEl.addClasses(["prompt-input", "inputDelete"])
2222

2323
//-Delete message
24-
const theRelatedSonsFolder = getActiveFile?.parent?.children?.find((item: any) => {
24+
const theRelatedChildrenFolder = getActiveFile?.parent?.children?.find((item: any) => {
2525
//normale note
2626
if (item instanceof TFolder && item.name == getActiveFile.basename) {
2727
return item
@@ -33,8 +33,8 @@ export default class deleteActiveNoteModal extends Modal {
3333
})
3434
const text = document.createElement('div');
3535
text.addClass("delMsg")
36-
if (theRelatedSonsFolder) {
37-
text.appendChild(this.createDeleteMsg1(getActiveFile, theRelatedSonsFolder))
36+
if (theRelatedChildrenFolder) {
37+
text.appendChild(this.createDeleteMsg1(getActiveFile, theRelatedChildrenFolder))
3838
} else {
3939
text.appendChild(this.createDeleteMsg2(getActiveFile))
4040
}
@@ -87,8 +87,8 @@ export default class deleteActiveNoteModal extends Modal {
8787
const theContainingFolder = getActiveFile?.parent
8888
const theContainingFolderItemsNumber = getActiveFile?.parent?.children.length
8989

90-
//Related Sons Folder
91-
const theRelatedSonsFolder = getActiveFile?.parent?.children.find((item: any) => {
90+
//Related Children Folder
91+
const theRelatedChildrenFolder = getActiveFile?.parent?.children.find((item: any) => {
9292
// normal note
9393
if (item instanceof TFolder && item.name == getActiveFile?.basename) {
9494
return item
@@ -99,11 +99,11 @@ export default class deleteActiveNoteModal extends Modal {
9999
}
100100
})
101101

102-
if (theRelatedSonsFolder) {
103-
//delete current active file + delete its Sons
102+
if (theRelatedChildrenFolder) {
103+
//delete current active file + delete its children
104104

105105
await this.app.vault.trash(getActiveFile!, true)
106-
await this.app.vault.trash(theRelatedSonsFolder, true)
106+
await this.app.vault.trash(theRelatedChildrenFolder, true)
107107
if (theContainingFolderItemsNumber == 2) {
108108

109109
await this.app.vault.trash(theContainingFolder as TAbstractFile, true)
@@ -130,7 +130,7 @@ export default class deleteActiveNoteModal extends Modal {
130130
this.close();
131131
}
132132
}
133-
createDeleteMsg1(activeFile: any, theRelatedSonsFolder: any) {
133+
createDeleteMsg1(activeFile: any, theRelatedChildrenFolder: any) {
134134
// Create the container element
135135
const deleteMsgContainer = document.createElement('div');
136136

@@ -157,11 +157,11 @@ export default class deleteActiveNoteModal extends Modal {
157157

158158
const delNoteNameMsg2 = document.createElement('span');
159159
delNoteNameMsg2.classList.add('delNoteNameMsg');
160-
delNoteNameMsg2.textContent = `${theRelatedSonsFolder.children.length}`;
160+
delNoteNameMsg2.textContent = `${theRelatedChildrenFolder.children.length}`;
161161
deleteMsgContainer.appendChild(delNoteNameMsg2);
162162

163163
const text4 = document.createElement('span');
164-
text4.textContent = '] direct sons in [' + activeFile.basename + '] folder';
164+
text4.textContent = '] direct children in [' + activeFile.basename + '] folder';
165165
deleteMsgContainer.appendChild(text4);
166166

167167
return deleteMsgContainer

src/createFamily/familyModal.ts

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export default class familyModal extends Modal {
5858
this.inputEl.addClasses(["prompt-input", "inputDelete"])
5959
this.modalEl.appendChild(svgElements().noThing());
6060
const text = document.createElement('div');
61-
text.innerText = `Son ?! Brother ?! of what??\nNo active file in the work space, Press ESC`
61+
text.innerText = `Child ?! Brother ?! of what??\nNo active file in the work space, Press ESC`
6262
text.addClass("nothingMsg")
6363

6464
this.modalEl.appendChild(text);
@@ -68,9 +68,9 @@ export default class familyModal extends Modal {
6868
} else if (this.createType == "newCluster") {
6969
this.inputEl.placeholder = `Type the new Cluster name`;
7070
this.modalEl.appendChild(svgElements().cluster());
71-
} else if (this.createType == "newSon") {
72-
this.inputEl.placeholder = `Type the son name of [${getActiveFile.basename}] note`;
73-
this.modalEl.appendChild(svgElements().son());
71+
} else if (this.createType == "newChild") {
72+
this.inputEl.placeholder = `Type the child name of [${getActiveFile.basename}] note`;
73+
this.modalEl.appendChild(svgElements().child());
7474
} else if (this.createType == "newBrother") {
7575
this.inputEl.placeholder = `Type the brother name of [${getActiveFile.basename}] note`;
7676
this.modalEl.appendChild(svgElements().brother());
@@ -135,55 +135,55 @@ export default class familyModal extends Modal {
135135
const currentActiveFileName = getActiveFile?.basename;
136136

137137

138-
//-make clusterSon to the current active file
139-
if (this.createType == "newSon") {
138+
//-make clusterChild to the current active file
139+
if (this.createType == "newChild") {
140140
if (getActiveFile?.path?.startsWith(clusters)) {
141141
if (getActiveFile.basename.endsWith("-cluster")) {
142142
if ((getActiveFile.path.match(/\//g) || []).length == 1) {
143-
const result = await templates(getActiveFile, "clusterSon");
143+
const result = await templates(getActiveFile, "clusterChild");
144144
if (result.state) {
145145
const childNameFromInput = this.inputEl.value.trim();
146146
if (childNameFromInput.endsWith("-cluster")) {
147147
new Notice("The name should'nt contain '-cluster' suffix", 3e3)
148148
return
149149
}
150-
const sonsFolderPath = `${getActiveFile?.parent?.path}/${currentActiveFileName}`;
151-
await this.createDirectory(appObject, "", sonsFolderPath);
152-
const newCreatedSonsFolder = getActiveFile.parent?.children?.find(
150+
const childrenFolderPath = `${getActiveFile?.parent?.path}/${currentActiveFileName}`;
151+
await this.createDirectory(appObject, "", childrenFolderPath);
152+
const newCreatedChildrenFolder = getActiveFile.parent?.children?.find(
153153
(item: any) => item instanceof TFolder && item.name == `${currentActiveFileName}`
154154
);
155155

156156
// @ts-ignore
157-
this.setFolder(newCreatedSonsFolder, "");
158-
await this.createNewNote(appObject, childNameFromInput, result.clusterSonTemplate);
157+
this.setFolder(newCreatedChildrenFolder, "");
158+
await this.createNewNote(appObject, childNameFromInput, result.clusterChildTemplate);
159159
}
160160

161161
} else {
162162
new Notice("The Cluster should not be in this generation.\nChange the note name. \nOr move it to generation 0", 3e3)
163163
}
164164

165165
}
166-
//-make normalSon to the current active file
166+
//-make normalChild to the current active file
167167
else if (!getActiveFile.basename.endsWith("-cluster")) {
168168
if (!((getActiveFile.path.match(/\//g) || []).length == 1)) {
169169

170-
const result = await templates(getActiveFile, "normalSon");
170+
const result = await templates(getActiveFile, "normalChild");
171171

172172
if (result.state) {
173173
const childNameFromInput = this.inputEl.value.trim();
174174
if (childNameFromInput.endsWith("-cluster")) {
175175
new Notice("The name should'nt contain '-cluster' suffix", 3e3)
176176
return
177177
}
178-
const sonsFolderPath = `${getActiveFile!.parent!.path}/${currentActiveFileName}`;
179-
await this.createDirectory(appObject, "", sonsFolderPath);
180-
const newCreatedSonsFolder = getActiveFile.parent!.children.find(
178+
const childrenFolderPath = `${getActiveFile!.parent!.path}/${currentActiveFileName}`;
179+
await this.createDirectory(appObject, "", childrenFolderPath);
180+
const newCreatedChildrenFolder = getActiveFile.parent!.children.find(
181181
(item: any) => item instanceof TFolder && item.name == `${currentActiveFileName}`
182182
);
183183

184184
// @ts-ignore
185-
this.setFolder(newCreatedSonsFolder, "");
186-
await this.createNewNote(appObject, childNameFromInput, result.normalSonTemplate);
185+
this.setFolder(newCreatedChildrenFolder, "");
186+
await this.createNewNote(appObject, childNameFromInput, result.normalChildTemplate);
187187
}
188188

189189
} else {
@@ -193,7 +193,7 @@ export default class familyModal extends Modal {
193193
}
194194

195195
} else {
196-
new Notice("Create new son should not work outside [CLUSTERS] folder")
196+
new Notice("Create new child should not work outside [CLUSTERS] folder")
197197
}
198198

199199
}

src/createFamily/svg.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,17 @@ export default function svgElements() {
3030

3131
return con;
3232
},
33-
son: function () {
33+
child: function () {
3434
// 1 - Container Element
3535
const con = document.createElement('div');
36-
con.classList.add("inputMsgCon", "son");
36+
con.classList.add("inputMsgCon", "child");
3737

3838
// 2 - SVG Element
3939
setIcon(con, 'baby');
4040

4141
// 3 - Text Element
4242
const text = document.createElement('div');
43-
text.innerText = "Create Son";
43+
text.innerText = "Create Child";
4444
text.classList.add("textMsg");
4545

4646
// Append Text element to the container

0 commit comments

Comments
 (0)