Skip to content

Settings menu #26

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

Merged
merged 7 commits into from
Jun 1, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
align title with nav buttons
  • Loading branch information
zubyj committed Jun 1, 2023
commit 6b8d5fbf89af6fbaac8ccc605b86c95eb3f92c01
Binary file added assets/images/home-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/images/settings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
47 changes: 25 additions & 22 deletions src/popup/popup.css
Original file line number Diff line number Diff line change
Expand Up @@ -27,31 +27,43 @@ a:hover {
color: #a0a0a0;
}

#title-container {
.navbar {
display: flex;
flex-direction: row;
justify-content: flex-end;
width: 100%;
padding: 0;
margin: 0;
/* Align items to the right */
}

.icon {
width: 100%;
height: 100%;
}

.navbar {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
margin-bottom: 20px;
}

#title {
.nav-button {
margin-left: 20px;
cursor: pointer;
padding: 0;
width: 25px;
height: 25px;
}

.title {
font-weight: 100;
font-size: 1.2rem;
color: lightcyan;
}

#open-settings-btn {
background-image: url("../../assets/images/settings.png");
background-repeat: no-repeat;
background-size: contain;
background-position: center;
padding: 10px;
margin-left: 10px;
border: none;
cursor: pointer;
}

#chat-section {
align-items: center;
justify-content: center;
Expand Down Expand Up @@ -90,13 +102,4 @@ a:hover {

.video-container {
display: none;
}

/* Settings menu */
#home-button {
margin-bottom: 20px;
}

#toggle-video {
margin-bottom: 20px;
}
10 changes: 5 additions & 5 deletions src/popup/popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@
</head>

<body>
<span id="title-container">
<h2 id="title">
<div class="navbar">
<h2 class="title">
Leetcode Explained
</h2>
<button id="open-settings-btn" class="material-button">
<button id="open-settings-btn" class="nav-button">
<img src="../../assets/images/settings.png" class="icon" alt="Settings" />
</button>
</span>
</div>
<button id="login-button" class="material-button hidden">
Open ChatGPT website
</button>
<div id="chat-section">

<button id="analyze-button" class="material-button hidden">
<span id="buttonText">
Analyze Complexity
Expand Down
6 changes: 1 addition & 5 deletions src/popup/popup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import {
ChatGPTProvider,
} from '../background/chatgpt/chatgpt.js';



async function main(): Promise<void> {
try {
const accessToken = await getChatGPTAccessToken();
Expand All @@ -19,8 +17,6 @@ async function main(): Promise<void> {
}
}



document.getElementById('login-button')!.onclick = () => {
chrome.runtime.sendMessage({ type: 'OPEN_LOGIN_PAGE' });
};
Expand Down Expand Up @@ -107,7 +103,7 @@ function displayUnableToRetrieveCodeMessage(): void {
}

window.onload = () => {
chrome.storage.sync.get('fontSize', (data) => {
chrome.storage.local.get('fontSize', (data) => {
document.body.style.fontSize = data.fontSize + 'px';
});
};
Expand Down
15 changes: 8 additions & 7 deletions src/popup/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@
</head>

<body>
<button id="home-button" class="material-button">Return Home</button>
<div class="navbar">
<h2 class="title">Settings</h2>
<button id="home-button" class="nav-button">
<image src="../../assets/images/home-icon.png" class="icon" alt="Home" />
</button>
</div>
<button id="toggle-video" class="material-button">
Show/Hide Solution Video
<span id="toggleText">Show</span>
Solution Video
</button>
<form id="settings-form">
<label for="font-size">Font Size</label>
<input type="number" id="font-size" name="font-size" min="1" max="50">
<button type="submit">Save</button>
</form>
</body>

</html>