generated from obsidianmd/obsidian-sample-plugin
-
-
Notifications
You must be signed in to change notification settings - Fork 222
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add New chat confirm modal, restructure components dir (#872)
- Loading branch information
1 parent
a5b39ff
commit 2b1aa23
Showing
27 changed files
with
98 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...omponents/ChatComponents/ChatMessages.tsx → ...mponents/chat-components/ChatMessages.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...ents/ChatComponents/ChatSingleMessage.tsx → ...nts/chat-components/ChatSingleMessage.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import { App, Modal } from "obsidian"; | ||
|
||
export class NewChatConfirmModal extends Modal { | ||
private onConfirm: () => void; | ||
|
||
constructor(app: App, onConfirm: () => void) { | ||
super(app); | ||
this.onConfirm = onConfirm; | ||
} | ||
|
||
onOpen() { | ||
const { contentEl } = this; | ||
contentEl.empty(); | ||
|
||
contentEl.createEl("h2", { text: "Start New Chat" }); | ||
|
||
const warningText = contentEl.createEl("p"); | ||
warningText.appendChild( | ||
document.createTextNode( | ||
"Starting a new chat will clear the current chat history. Any unsaved messages will be lost." | ||
) | ||
); | ||
|
||
const buttonContainer = contentEl.createEl("div"); | ||
buttonContainer.style.display = "flex"; | ||
buttonContainer.style.justifyContent = "space-between"; | ||
buttonContainer.style.gap = "10px"; | ||
buttonContainer.style.marginTop = "20px"; | ||
|
||
const confirmButton = buttonContainer.createEl("button", { | ||
text: "Continue", | ||
}); | ||
confirmButton.style.padding = "8px 16px"; | ||
confirmButton.style.borderRadius = "4px"; | ||
confirmButton.style.cursor = "pointer"; | ||
confirmButton.style.minWidth = "100px"; | ||
confirmButton.style.backgroundColor = "var(--interactive-accent)"; | ||
confirmButton.style.color = "var(--text-on-accent)"; | ||
confirmButton.addEventListener("click", () => { | ||
this.onConfirm(); | ||
this.close(); | ||
}); | ||
|
||
const cancelButton = buttonContainer.createEl("button", { | ||
text: "Cancel", | ||
}); | ||
cancelButton.style.padding = "8px 16px"; | ||
cancelButton.style.borderRadius = "4px"; | ||
cancelButton.style.cursor = "pointer"; | ||
cancelButton.style.minWidth = "100px"; | ||
cancelButton.addEventListener("click", () => { | ||
this.close(); | ||
}); | ||
} | ||
|
||
onClose() { | ||
const { contentEl } = this; | ||
contentEl.empty(); | ||
} | ||
} |
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
src/components/OramaSearchModal.tsx → src/components/modals/OramaSearchModal.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters