150 lines
3.9 KiB
HTML
150 lines
3.9 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
|
|
<style>
|
|
body {
|
|
margin: 0;
|
|
overflow-x: hidden;
|
|
}
|
|
#config-panel {
|
|
position: fixed;
|
|
width: 300px;
|
|
height: 100vh;
|
|
right: -300px;
|
|
top: 0;
|
|
background: white;
|
|
border-left: 1px solid #ccc;
|
|
padding: 20px;
|
|
box-sizing: border-box;
|
|
transition: right 0.3s ease-in-out;
|
|
z-index: 1000;
|
|
}
|
|
#config-panel.open {
|
|
right: 0;
|
|
}
|
|
#main-content {
|
|
width: 100vw;
|
|
height: 100vh;
|
|
border: none;
|
|
}
|
|
#config-button {
|
|
position: fixed;
|
|
top: 10px;
|
|
right: 180px;
|
|
z-index: 1000;
|
|
padding: 8px 16px;
|
|
background: transparent;
|
|
color: #0078d4;
|
|
border: 1px solid #0078d4;
|
|
border-radius: 4px;
|
|
cursor: pointer;
|
|
font-size: 14px;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 6px;
|
|
height: 32px;
|
|
transition: all 0.2s;
|
|
margin-right: 8px;
|
|
}
|
|
#config-button:hover {
|
|
background: #f0f8ff;
|
|
}
|
|
#config-button i {
|
|
font-size: 14px;
|
|
}
|
|
.close-button {
|
|
position: absolute;
|
|
top: 10px;
|
|
right: 10px;
|
|
background: none;
|
|
border: none;
|
|
font-size: 24px;
|
|
cursor: pointer;
|
|
padding: 5px 10px;
|
|
color: #666;
|
|
transition: color 0.2s;
|
|
}
|
|
.close-button:hover {
|
|
color: #333;
|
|
}
|
|
.panel-header {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
margin-bottom: 20px;
|
|
padding-right: 40px;
|
|
}
|
|
.close-button i {
|
|
font-size: 18px;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<button id="config-button">
|
|
<i class="fas fa-cog"></i>
|
|
Configuration
|
|
</button>
|
|
<webview id="main-content" src="https://photos.onedrive.com"></webview>
|
|
<div id="config-panel">
|
|
<button class="close-button" id="close-config">
|
|
<i class="fas fa-arrow-right"></i>
|
|
</button>
|
|
<div class="panel-header">
|
|
<h1>Configuration</h1>
|
|
</div>
|
|
<form id="config-form">
|
|
<div>
|
|
<label for="dest-folder">Destination Folder for Photo Sync:</label>
|
|
<input type="text" id="dest-folder" name="dest-folder" readonly>
|
|
<button type="button" id="select-folder">Select Folder</button>
|
|
</div>
|
|
<div>
|
|
<label for="onedrive-source">OneDrive Source Path:</label>
|
|
<input type="text" id="onedrive-source" name="onedrive-source">
|
|
</div>
|
|
<button type="submit">Save</button>
|
|
</form>
|
|
</div>
|
|
|
|
<script>
|
|
const { ipcRenderer } = require('electron');
|
|
|
|
// Configuration button handler
|
|
document.getElementById('config-button').addEventListener('click', () => {
|
|
ipcRenderer.send('toggle-config');
|
|
});
|
|
|
|
// Configuration panel toggle
|
|
ipcRenderer.on('toggle-config', () => {
|
|
const panel = document.getElementById('config-panel');
|
|
panel.classList.toggle('open');
|
|
});
|
|
|
|
// Folder selection
|
|
document.getElementById('select-folder').addEventListener('click', () => {
|
|
ipcRenderer.send('select-folder');
|
|
});
|
|
|
|
ipcRenderer.on('folder-selected', (event, path) => {
|
|
document.getElementById('dest-folder').value = path;
|
|
});
|
|
|
|
// Form submission
|
|
document.getElementById('config-form').addEventListener('submit', (event) => {
|
|
event.preventDefault();
|
|
const destFolder = document.getElementById('dest-folder').value;
|
|
const onedriveSource = document.getElementById('onedrive-source').value;
|
|
ipcRenderer.send('set-config', { destFolder, onedriveSource });
|
|
// Close the panel after saving
|
|
document.getElementById('config-panel').classList.remove('open');
|
|
});
|
|
|
|
// Add close button handler
|
|
document.getElementById('close-config').addEventListener('click', () => {
|
|
document.getElementById('config-panel').classList.remove('open');
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|