Skip to content

Commit 3c9f5f5

Browse files
committed
Update plugin version to 1.1.1, enhance folder settings UI with donation options, and improve dashboard view with habit chart labeling.
1 parent 90959d7 commit 3c9f5f5

File tree

4 files changed

+193
-53
lines changed

4 files changed

+193
-53
lines changed

main.ts

Lines changed: 46 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export default class NoteMetricsPlugin extends Plugin {
6565
this.app.workspace.revealLeaf(existingLeaves[0]);
6666
return;
6767
}
68-
68+
6969
// If no dashboard leaf exists, create a new right sidebar leaf.
7070
const rightLeaf = this.app.workspace.getRightLeaf(false);
7171
if (rightLeaf) {
@@ -75,7 +75,7 @@ export default class NoteMetricsPlugin extends Plugin {
7575
});
7676
this.app.workspace.revealLeaf(rightLeaf);
7777
}
78-
}
78+
}
7979
}
8080

8181
class NoteMetricsSettingTab extends PluginSettingTab {
@@ -90,34 +90,32 @@ class NoteMetricsSettingTab extends PluginSettingTab {
9090
const { containerEl } = this;
9191
containerEl.empty();
9292

93-
// Settings for folder selection.
94-
new Setting(containerEl).setName('Folders to scan').setHeading();
93+
// Add the heading using Setting
94+
new Setting(containerEl)
95+
.setName('Folders to scan')
96+
.setDesc('Select folders to scan for tags and daily habits')
97+
.setHeading();
98+
99+
// Container for all folder inputs
95100
const folderContainer = containerEl.createDiv('folder-container');
96101

97102
const renderFolderInputs = () => {
98103
folderContainer.empty();
99104
this.plugin.settings.folders.forEach((folder, index) => {
100-
// Create a row for each folder input.
101105
const folderDiv = folderContainer.createDiv({ cls: 'folder-input-row' });
102-
// Create an inline container for the text input and remove button.
103106
const inputContainer = folderDiv.createDiv({ cls: 'input-container' });
107+
104108
new Setting(inputContainer)
105-
.setName(
106-
index === 0
107-
? 'Default daily note folder'
108-
: `Folder ${index + 1}`
109-
)
110-
.setDesc('Folder to scan for tags and daily habits.')
111109
.addText((text) =>
112110
text
113-
.setPlaceholder('Enter folder name')
111+
.setPlaceholder(index === 0 ? 'Default daily note folder' : 'Enter folder name')
114112
.setValue(folder)
115113
.onChange(async (value) => {
116114
this.plugin.settings.folders[index] = value;
117115
await this.plugin.saveSettings();
118116
})
119117
);
120-
// For additional folders (not the default), add a remove button.
118+
121119
if (index > 0) {
122120
const removeBtn = inputContainer.createEl('button', { text: '×' });
123121
removeBtn.addClass('small-remove-button');
@@ -132,12 +130,39 @@ class NoteMetricsSettingTab extends PluginSettingTab {
132130

133131
renderFolderInputs();
134132

135-
containerEl
136-
.createEl('button', { text: 'Add folder' })
137-
.addEventListener('click', async () => {
138-
this.plugin.settings.folders.push('');
139-
await this.plugin.saveSettings();
140-
renderFolderInputs();
141-
});
133+
const addButton = containerEl.createEl('button', { text: 'Add folder' });
134+
addButton.addClass('add-folder-button');
135+
addButton.addEventListener('click', async () => {
136+
this.plugin.settings.folders.push('');
137+
await this.plugin.saveSettings();
138+
renderFolderInputs();
139+
});
140+
141+
// Add donation section
142+
containerEl.createEl('hr');
143+
144+
new Setting(containerEl)
145+
.setName('Support the development')
146+
.setDesc('If you find this plugin helpful, consider supporting its development')
147+
.setHeading();
148+
149+
const donationButtons = containerEl.createDiv('donation-buttons');
150+
donationButtons.addClass('donation-container');
151+
152+
const githubButton = donationButtons.createEl('button', {
153+
text: 'GitHub Sponsors',
154+
cls: 'donation-button github-sponsor'
155+
});
156+
githubButton.addEventListener('click', () => {
157+
window.open('https://github.com/sponsors/Andre-Diamond');
158+
});
159+
160+
const buyMeACoffeeButton = donationButtons.createEl('button', {
161+
text: 'Buy Me a Coffee',
162+
cls: 'donation-button buymeacoffee'
163+
});
164+
buyMeACoffeeButton.addEventListener('click', () => {
165+
window.open('https://www.buymeacoffee.com/signius');
166+
});
142167
}
143168
}

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"id": "note-metrics",
33
"name": "Daily Note Metrics",
4-
"version": "1.1.0",
4+
"version": "1.1.1",
55
"minAppVersion": "0.15.0",
66
"description": "Parses the tags in your Daily Notes to create interactive charts in a dashboard view.",
77
"author": "Andre-Diamond",

src/views/DashboardView.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ export class DashboardView extends ItemView {
1717
return VIEW_TYPE_DASHBOARD;
1818
}
1919

20+
getIcon(): string {
21+
return "bar-chart";
22+
}
23+
2024
getDisplayText(): string {
2125
return "Daily note dashboard";
2226
}
@@ -80,6 +84,7 @@ export class DashboardView extends ItemView {
8084
// Checkbox Habit Chart: Grouped by habit (only if data exists).
8185
const habits = Object.keys(periodData.checkboxHabits).sort((a, b) => a.localeCompare(b));
8286
if (habits.length > 0) {
87+
checkboxChartContainer.createEl('h3', { text: "Habits" });
8388
const counts = habits.map(habit => periodData.checkboxHabits[habit]);
8489
const checkboxChartData = {
8590
labels: habits,

styles.css

Lines changed: 141 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,101 @@
11
.chart-container {
2-
width: 100%;
3-
height: 400px;
4-
position: relative;
5-
margin-top: 20px;
2+
width: 100%;
3+
height: 400px;
4+
position: relative;
5+
margin-top: 20px;
66
}
77

88
.refresh-button {
9-
background-color: #4CAF50;
9+
background-color: #4CAF50;
1010
color: white;
1111
padding: 8px 16px;
1212
border: none;
1313
border-radius: 4px;
1414
cursor: pointer;
1515
font-size: 14px;
16-
margin-left: 25px;
16+
margin-left: 25px;
1717
position: relative;
18-
top: 1px;
18+
top: 1px;
1919
}
2020

2121
.refresh-button:hover {
2222
background-color: #45a049;
2323
}
2424

25+
.folder-container {
26+
margin-top: 12px;
27+
margin-bottom: 24px;
28+
}
29+
30+
.folder-input-row {
31+
margin-bottom: 8px;
32+
}
33+
2534
.input-container {
26-
display: flex;
27-
align-items: center;
28-
gap: 8px;
35+
display: flex;
36+
align-items: center;
37+
gap: 8px;
38+
position: relative;
39+
}
40+
41+
.input-container .setting-item {
42+
border: none;
43+
padding: 0;
44+
margin-top: 4px;
45+
margin-bottom: 4px;
46+
}
47+
48+
.input-container .setting-item-info {
49+
display: none;
2950
}
3051

31-
.input-container input {
32-
flex-grow: 1;
52+
.input-container .setting-item-control {
53+
flex-grow: 1;
54+
padding: 0;
3355
}
3456

3557
.small-remove-button {
36-
background: transparent;
37-
border: none;
38-
color: var(--text-muted);
39-
font-size: 24px;
40-
cursor: pointer;
41-
flex-shrink: 0;
42-
display: flex;
43-
align-items: center;
44-
justify-content: center;
45-
width: 32px;
46-
height: 32px;
47-
padding: 0;
48-
padding-bottom: 6px;
49-
margin-bottom: 12px;
50-
line-height: 1;
58+
background: transparent;
59+
border: 1px solid transparent;
60+
color: var(--text-muted);
61+
font-size: 18px;
62+
cursor: pointer;
63+
flex-shrink: 0;
64+
display: flex;
65+
align-items: center;
66+
justify-content: center;
67+
width: 28px;
68+
height: 28px;
69+
padding: 0;
70+
border-radius: 4px;
71+
transition: all 0.2s ease;
5172
}
5273

5374
.small-remove-button:hover {
54-
color: var(--interactive-accent);
75+
color: var(--text-error);
76+
border-color: var(--text-error);
77+
}
78+
79+
.folder-settings-header {
80+
margin-bottom: 12px;
81+
color: var(--text-normal);
82+
font-size: 14px;
83+
font-weight: 500;
84+
}
85+
86+
.add-folder-button {
87+
background: var(--interactive-accent);
88+
color: var(--text-on-accent);
89+
padding: 6px 12px;
90+
border: none;
91+
border-radius: 4px;
92+
cursor: pointer;
93+
font-size: 14px;
94+
transition: background-color 0.2s ease;
95+
}
96+
97+
.add-folder-button:hover {
98+
background: var(--interactive-accent-hover);
5599
}
56100

57101
@media (max-width: 480px) {
@@ -60,15 +104,15 @@
60104
font-size: 12px;
61105
margin-left: 10px;
62106
}
63-
107+
64108
.input-container {
65109
flex-wrap: wrap;
66110
}
67-
111+
68112
.input-container input {
69113
width: 100%;
70114
}
71-
115+
72116
.small-remove-button {
73117
width: 28px;
74118
height: 28px;
@@ -79,3 +123,69 @@
79123
align-self: center;
80124
}
81125
}
126+
127+
.period-type-selector,
128+
.period-selector {
129+
appearance: none;
130+
-webkit-appearance: none;
131+
-moz-appearance: none;
132+
background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
133+
background-repeat: no-repeat;
134+
background-position: right 8px center;
135+
background-size: 16px;
136+
padding: 6px 32px 6px 12px;
137+
border: 1px solid var(--background-modifier-border);
138+
border-radius: 4px;
139+
font-size: 14px;
140+
color: var(--text-normal);
141+
background-color: var(--background-primary);
142+
cursor: pointer;
143+
margin-right: 12px;
144+
min-width: 120px;
145+
}
146+
147+
.period-type-selector:hover,
148+
.period-selector:hover {
149+
border-color: var(--interactive-accent);
150+
}
151+
152+
.period-type-selector:focus,
153+
.period-selector:focus {
154+
outline: none;
155+
border-color: var(--interactive-accent);
156+
box-shadow: 0 0 0 2px var(--background-modifier-border);
157+
}
158+
159+
.donation-container {
160+
display: flex;
161+
gap: 10px;
162+
margin-top: 10px;
163+
}
164+
165+
.donation-button {
166+
padding: 8px 16px;
167+
border-radius: 4px;
168+
cursor: pointer;
169+
font-weight: 500;
170+
transition: background-color 0.2s;
171+
}
172+
173+
.github-sponsor {
174+
background-color: #db61a2;
175+
color: white;
176+
border: none;
177+
}
178+
179+
.github-sponsor:hover {
180+
background-color: #bf4b8a;
181+
}
182+
183+
.buymeacoffee {
184+
background-color: #ffdd00;
185+
color: #000000;
186+
border: none;
187+
}
188+
189+
.buymeacoffee:hover {
190+
background-color: #e5c700;
191+
}

0 commit comments

Comments
 (0)