Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing navigation to settings #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added gear48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions popup.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,20 @@ body {
height: 100%;
}

.header {
display: flex;
justify-content: flex-end;
align-items: center;
padding: 8px;
}

.settings-icon {
width: 24px;
height: 24px;
padding: 8px;
cursor: pointer;
}

.chat-box {
flex-grow: 1;
overflow-y: auto;
Expand Down
9 changes: 9 additions & 0 deletions popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@
</head>
<body>
<div class="container">
<div class="header">
<img
id="settings-icon"
class="settings-icon"
tabindex="0"
alt="settings"
src="gear48.png"
/>
</div>
<div id="chat-box" class="chat-box"></div>
<div class="input-container">
<input id="input" type="text" placeholder="Type your message...">
Expand Down
5 changes: 5 additions & 0 deletions popup.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const inputField = document.getElementById("input");
const sendButton = document.getElementById("send-button");
const chatBox = document.getElementById("chat-box");
const settingsIcon = document.getElementById("settings-icon");

const clearButton = document.getElementById("clear-button");
clearButton.addEventListener("click", clearChatHistory);
Expand All @@ -13,6 +14,10 @@ function clearChatHistory() {
chrome.storage.local.set({ chat_history: [] });
}

settingsIcon.addEventListener("click", () => {
chrome.runtime.openOptionsPage();
});

sendButton.addEventListener("click", sendMessage);
inputField.addEventListener("keydown", event => {
if (event.key === "Enter" && !event.shiftKey && !event.metaKey) {
Expand Down