342 lines
8.6 KiB
HTML
342 lines
8.6 KiB
HTML
<?xml version="1.0"?>
|
|
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
|
|
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
|
xmlns:html="http://www.w3.org/1999/xhtml"
|
|
title="Sync to Research OS"
|
|
width="550"
|
|
height="500"
|
|
onload="init()">
|
|
|
|
<html:style>
|
|
:root {
|
|
--bg-primary: #ffffff;
|
|
--bg-secondary: #f8fafc;
|
|
--bg-tertiary: #f1f5f9;
|
|
--text-primary: #000000;
|
|
--text-secondary: #475569;
|
|
--accent: #4f46e5;
|
|
--accent-hover: #4338ca;
|
|
--success: #16a34a;
|
|
--error: #dc2626;
|
|
--border-color: #cbd5e1;
|
|
}
|
|
|
|
:root, window {
|
|
background-color: var(--bg-primary) !important;
|
|
color: var(--text-primary) !important;
|
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
|
margin: 0;
|
|
padding: 20px;
|
|
height: 100vh;
|
|
display: flex;
|
|
flex-direction: column;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
.container {
|
|
display: flex;
|
|
flex-direction: column;
|
|
height: 100%;
|
|
gap: 16px;
|
|
}
|
|
|
|
h2 {
|
|
margin: 0 0 4px 0;
|
|
font-size: 18px;
|
|
font-weight: 600;
|
|
color: var(--text-primary);
|
|
}
|
|
|
|
.subtitle {
|
|
margin: 0 0 16px 0;
|
|
font-size: 13px;
|
|
color: var(--text-secondary);
|
|
}
|
|
|
|
/* Screen layout */
|
|
.screen {
|
|
display: none;
|
|
flex-direction: column;
|
|
flex: 1;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.screen.active {
|
|
display: flex;
|
|
}
|
|
|
|
/* Folder selection styles */
|
|
.folder-list {
|
|
flex: 1;
|
|
border: 1px solid var(--border-color);
|
|
border-radius: 8px;
|
|
background-color: var(--bg-secondary);
|
|
overflow-y: auto;
|
|
padding: 8px;
|
|
}
|
|
|
|
.folder-item {
|
|
display: flex;
|
|
align-items: center;
|
|
padding: 8px 12px;
|
|
border-radius: 6px;
|
|
cursor: pointer;
|
|
margin-bottom: 4px;
|
|
transition: all 0.2s;
|
|
font-size: 13px;
|
|
}
|
|
|
|
.folder-item:hover {
|
|
background-color: var(--bg-tertiary);
|
|
}
|
|
|
|
.folder-item.selected {
|
|
background-color: var(--accent);
|
|
color: #ffffff !important;
|
|
}
|
|
|
|
.folder-tree,
|
|
.folder-branch {
|
|
list-style: none;
|
|
padding: 0;
|
|
margin: 0;
|
|
}
|
|
|
|
.folder-branch {
|
|
margin-left: 12px;
|
|
padding-left: 12px;
|
|
border-left: 1px solid var(--border-color);
|
|
}
|
|
|
|
.folder-node {
|
|
position: relative;
|
|
}
|
|
|
|
.folder-branch > .folder-node::before {
|
|
content: "";
|
|
position: absolute;
|
|
left: -12px;
|
|
top: 17px;
|
|
width: 12px;
|
|
height: 1px;
|
|
background-color: var(--border-color);
|
|
}
|
|
|
|
.folder-icon {
|
|
margin-right: 8px;
|
|
font-size: 16px;
|
|
}
|
|
|
|
/* Progress tracker styles */
|
|
.progress-card {
|
|
border: 1px solid var(--border-color);
|
|
border-radius: 8px;
|
|
background-color: var(--bg-secondary);
|
|
padding: 16px;
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 12px;
|
|
}
|
|
|
|
.progress-bar-container {
|
|
background-color: var(--bg-tertiary);
|
|
height: 8px;
|
|
border-radius: 4px;
|
|
overflow: hidden;
|
|
width: 100%;
|
|
}
|
|
|
|
.progress-bar {
|
|
background: linear-gradient(90deg, #4f46e5 0%, #818cf8 100%);
|
|
height: 100%;
|
|
width: 0%;
|
|
border-radius: 4px;
|
|
transition: width 0.3s ease;
|
|
}
|
|
|
|
.progress-status {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
font-size: 13px;
|
|
font-weight: 500;
|
|
}
|
|
|
|
.item-list {
|
|
flex: 1;
|
|
border: 1px solid var(--border-color);
|
|
border-radius: 8px;
|
|
background-color: var(--bg-secondary);
|
|
overflow-y: auto;
|
|
padding: 8px;
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 6px;
|
|
}
|
|
|
|
.sync-item-row {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
padding: 10px 12px;
|
|
border-radius: 6px;
|
|
background-color: rgba(0, 0, 0, 0.02);
|
|
border: 1px solid rgba(0, 0, 0, 0.05);
|
|
font-size: 13px;
|
|
}
|
|
|
|
.sync-item-info {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 2px;
|
|
flex: 1;
|
|
overflow: hidden;
|
|
padding-right: 12px;
|
|
}
|
|
|
|
.sync-item-title {
|
|
font-weight: 500;
|
|
white-space: nowrap;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
color: var(--text-primary);
|
|
}
|
|
|
|
.sync-item-detail {
|
|
font-size: 11px;
|
|
color: var(--text-secondary);
|
|
}
|
|
|
|
.sync-item-status {
|
|
font-weight: 600;
|
|
font-size: 12px;
|
|
padding: 4px 8px;
|
|
border-radius: 4px;
|
|
text-transform: uppercase;
|
|
}
|
|
|
|
.status-pending {
|
|
background-color: rgba(0, 0, 0, 0.04);
|
|
color: var(--text-secondary);
|
|
}
|
|
|
|
.status-syncing {
|
|
background-color: rgba(79, 70, 229, 0.08);
|
|
color: #4f46e5;
|
|
}
|
|
|
|
.status-success {
|
|
background-color: rgba(16, 185, 129, 0.15);
|
|
color: var(--success);
|
|
}
|
|
|
|
.status-error {
|
|
background-color: rgba(239, 68, 68, 0.15);
|
|
color: var(--error);
|
|
}
|
|
|
|
/* Buttons block */
|
|
.button-group {
|
|
display: flex;
|
|
justify-content: flex-end;
|
|
gap: 12px;
|
|
margin-top: 8px;
|
|
}
|
|
|
|
.btn {
|
|
padding: 10px 20px;
|
|
border-radius: 6px;
|
|
font-weight: 600;
|
|
font-size: 13px;
|
|
cursor: pointer;
|
|
border: none;
|
|
transition: all 0.2s;
|
|
}
|
|
|
|
.btn-primary {
|
|
background-color: var(--accent);
|
|
color: #ffffff;
|
|
}
|
|
|
|
.btn-primary:hover {
|
|
background-color: var(--accent-hover);
|
|
}
|
|
|
|
.btn-secondary {
|
|
background-color: var(--bg-tertiary);
|
|
color: var(--text-primary);
|
|
}
|
|
|
|
.btn-secondary:hover {
|
|
background-color: var(--border-color);
|
|
}
|
|
|
|
.btn:disabled {
|
|
opacity: 0.5;
|
|
cursor: not-allowed;
|
|
}
|
|
|
|
/* Scrollbars */
|
|
::-webkit-scrollbar {
|
|
width: 6px;
|
|
}
|
|
::-webkit-scrollbar-track {
|
|
background: transparent;
|
|
}
|
|
::-webkit-scrollbar-thumb {
|
|
background: var(--border-color);
|
|
border-radius: 3px;
|
|
}
|
|
</html:style>
|
|
|
|
<html:div class="container">
|
|
<!-- View 1: Folder Selection -->
|
|
<html:div id="folder-screen" class="screen active">
|
|
<html:h2>Sync to Research OS</html:h2>
|
|
<html:div class="subtitle">Select the destination folder in Research OS for the selected items.</html:div>
|
|
|
|
<html:div id="folders-container" class="folder-list">
|
|
<html:div style="display: flex; align-items: center; justify-content: center; height: 100%; color: var(--text-secondary); font-size: 13px;">
|
|
Loading folders from Research OS...
|
|
</html:div>
|
|
</html:div>
|
|
|
|
<html:div class="button-group">
|
|
<html:button id="btn-cancel" class="btn btn-secondary" onclick="window.close()">Cancel</html:button>
|
|
<html:button id="btn-sync" class="btn btn-primary" onclick="startSync()" disabled="true">Sync Now</html:button>
|
|
</html:div>
|
|
</html:div>
|
|
|
|
<!-- View 2: Progress Screen -->
|
|
<html:div id="progress-screen" class="screen">
|
|
<html:h2>Syncing Papers</html:h2>
|
|
<html:div class="subtitle">Please wait while items are being securely uploaded to Research OS.</html:div>
|
|
|
|
<html:div class="progress-card">
|
|
<html:div class="progress-status">
|
|
<html:span id="progress-text">Initializing...</html:span>
|
|
<html:span id="progress-percent">0%</html:span>
|
|
</html:div>
|
|
<html:div class="progress-bar-container">
|
|
<html:div id="progress-bar" class="progress-bar"></html:div>
|
|
</html:div>
|
|
</html:div>
|
|
|
|
<html:h2 style="margin-top: 16px; font-size: 14px;">Sync Status List</html:h2>
|
|
<html:div id="items-container" class="item-list">
|
|
<!-- Progress rows injected here -->
|
|
</html:div>
|
|
|
|
<html:div id="error-log-container" style="display: none; flex-direction: column; gap: 6px; margin-top: 16px; min-height: 120px; height: 120px;">
|
|
<html:h2 style="font-size: 13px; color: var(--error); margin: 0 0 2px 0;">Detailed Error Logs</html:h2>
|
|
<html:textarea id="error-log-box" readonly="true" style="flex: 1; width: 100%; font-family: monospace; font-size: 11px; padding: 8px; border: 1px solid var(--border-color); border-radius: 6px; background-color: var(--bg-secondary); color: var(--text-primary); resize: none; box-sizing: border-box; outline: none;"></html:textarea>
|
|
</html:div>
|
|
|
|
<html:div class="button-group">
|
|
<html:button id="btn-close" class="btn btn-secondary" onclick="window.close()" disabled="true">Close</html:button>
|
|
</html:div>
|
|
</html:div>
|
|
</html:div>
|
|
|
|
<script src="chrome://researchossync/content/dialog.js" type="application/javascript"/>
|
|
</window>
|