Skip to content

Commit e404611

Browse files
committed
clean up buttons
1 parent 485378a commit e404611

File tree

5 files changed

+4
-47
lines changed

5 files changed

+4
-47
lines changed

src/config/ButtonConfig.ts

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ export enum ButtonActionType {
1515
INPUT = 'input',
1616
SLEEP = 'sleep',
1717
TEMPLATER_CREATE_NOTE = 'templaterCreateNote',
18-
QUICK_SWITCHER = 'quickSwitcher',
1918
}
2019

2120
export interface CommandButtonAction {
@@ -96,26 +95,13 @@ export const TemplaterCreateNoteButtonActionValidator = schemaForType<TemplaterC
9695
}),
9796
);
9897

99-
export interface QuickSwitcherButtonAction {
100-
type: ButtonActionType.QUICK_SWITCHER;
101-
filter: string;
102-
}
103-
104-
export const QuickSwitcherButtonActionValidator = schemaForType<QuickSwitcherButtonAction>()(
105-
z.object({
106-
type: z.literal(ButtonActionType.QUICK_SWITCHER),
107-
filter: z.string(),
108-
}),
109-
);
110-
11198
export type ButtonAction =
11299
| CommandButtonAction
113100
| JSButtonAction
114101
| OpenButtonAction
115102
| InputButtonAction
116103
| SleepButtonAction
117-
| TemplaterCreateNoteButtonAction
118-
| QuickSwitcherButtonAction;
104+
| TemplaterCreateNoteButtonAction;
119105

120106
export const ButtonActionValidator = schemaForType<ButtonAction>()(
121107
z.union([
@@ -125,7 +111,6 @@ export const ButtonActionValidator = schemaForType<ButtonAction>()(
125111
InputButtonActionValidator,
126112
SleepButtonActionValidator,
127113
TemplaterCreateNoteButtonActionValidator,
128-
QuickSwitcherButtonActionValidator,
129114
]),
130115
);
131116

src/faq/FaqComponent.svelte

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,13 @@
7272
<p>
7373
When creating <a href={DocsUtils.linkToInputFields()}>Input Fields</a> or
7474
<a href={DocsUtils.linkToViewFields()}>View Fields</a>
75-
<strong>warnings</strong>
76-
(
75+
<strong>warnings</strong> (
7776
<ErrorIndicatorComponent
7877
app={app}
7978
declaration={exampleWarningDeclaration}
8079
errorCollection={exampleWarningErrorCollection}
8180
></ErrorIndicatorComponent>
82-
) and <strong>errors</strong>
83-
(
81+
) and <strong>errors</strong> (
8482
<ErrorIndicatorComponent
8583
app={app}
8684
declaration={exampleErrorDeclaration}

src/fields/button/ButtonActionRunner.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
type InputButtonAction,
66
type JSButtonAction,
77
type OpenButtonAction,
8-
type QuickSwitcherButtonAction,
98
type SleepButtonAction,
109
type TemplaterCreateNoteButtonAction,
1110
} from '../../config/ButtonConfig';
@@ -39,11 +38,6 @@ export class ButtonActionRunner {
3938
fileName: '',
4039
openNote: true,
4140
} satisfies TemplaterCreateNoteButtonAction;
42-
} else if (type === ButtonActionType.QUICK_SWITCHER) {
43-
return {
44-
type: ButtonActionType.QUICK_SWITCHER,
45-
filter: '',
46-
} satisfies QuickSwitcherButtonAction;
4741
}
4842

4943
throw new Error(`Unknown button action type: ${type}`);
@@ -68,9 +62,6 @@ export class ButtonActionRunner {
6862
} else if (action.type === ButtonActionType.TEMPLATER_CREATE_NOTE) {
6963
await this.runTemplaterCreateNoteAction(action);
7064
return;
71-
} else if (action.type === ButtonActionType.QUICK_SWITCHER) {
72-
await this.runQuickSwitcherAction(action);
73-
return;
7465
}
7566

7667
throw new Error(`Unknown button action type`);
@@ -110,8 +101,4 @@ export class ButtonActionRunner {
110101
async runTemplaterCreateNoteAction(_action: TemplaterCreateNoteButtonAction): Promise<void> {
111102
throw new Error('Not supported');
112103
}
113-
114-
async runQuickSwitcherAction(_action: QuickSwitcherButtonAction): Promise<void> {
115-
throw new Error('Not supported');
116-
}
117104
}

src/fields/button/ButtonBuilderModalComponent.svelte

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,6 @@
9292
return 'Sleep for Some Time';
9393
} else if (actionType === ButtonActionType.TEMPLATER_CREATE_NOTE) {
9494
return 'Create a New Note Using Templater';
95-
} else if (actionType === ButtonActionType.QUICK_SWITCHER) {
96-
return 'Open the Quick Switcher';
9795
}
9896
9997
return 'CHANGE ME';
@@ -219,15 +217,6 @@ Add action of type
219217
<Toggle bind:checked={action.openNote}></Toggle>
220218
</SettingComponent>
221219
{/if}
222-
223-
{#if action.type === ButtonActionType.QUICK_SWITCHER}
224-
<p>
225-
Not Implemented Yet
226-
<Button variant="destructive" on:click={() => removeAction(i)}>
227-
<Icon iconName="x"></Icon>
228-
</Button>
229-
</p>
230-
{/if}
231220
{/each}
232221

233222
<h4>Preview</h4>

src/fields/button/ObsidianButtonActionRunner.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ButtonActionRunner } from './ButtonActionRunner';
2-
import { type QuickSwitcherButtonAction, type TemplaterCreateNoteButtonAction } from '../../config/ButtonConfig';
2+
import { type TemplaterCreateNoteButtonAction } from '../../config/ButtonConfig';
33
import { TFile, TFolder } from 'obsidian';
44
import type MetaBindPlugin from '../../main';
55

@@ -53,6 +53,4 @@ export class ObsidianButtonActionRunner extends ButtonActionRunner {
5353
);
5454
}
5555
}
56-
57-
public async runQuickSwitcherAction(_action: QuickSwitcherButtonAction): Promise<void> {}
5856
}

0 commit comments

Comments
 (0)