mirror of
https://github.com/Zippland/Snap-Solver.git
synced 2026-02-08 00:42:01 +08:00
重构前端UI和交互逻辑,提升用户体验和代码可维护性
This commit is contained in:
533
static/style.css
533
static/style.css
@@ -95,88 +95,86 @@ body {
|
||||
/* Header Styles */
|
||||
.app-header {
|
||||
background-color: var(--surface);
|
||||
padding: 1rem 1.5rem;
|
||||
padding: 0.75rem 1rem;
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
z-index: 100;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
border-bottom: 1px solid var(--border-color);
|
||||
}
|
||||
|
||||
.header-left {
|
||||
.header-content {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
gap: 2rem;
|
||||
flex-wrap: nowrap;
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.header-left h1 {
|
||||
font-size: 1.5rem;
|
||||
.app-header h1 {
|
||||
font-size: 1.3rem;
|
||||
color: var(--primary);
|
||||
margin: 0;
|
||||
font-weight: 600;
|
||||
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
|
||||
letter-spacing: -0.5px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.connection-status {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.status {
|
||||
padding: 0.4rem 0.8rem;
|
||||
#connectionStatus {
|
||||
font-size: 0.8rem;
|
||||
padding: 0.2rem 0.5rem;
|
||||
border-radius: 1rem;
|
||||
font-size: 0.875rem;
|
||||
margin: 0 0.5rem;
|
||||
white-space: nowrap;
|
||||
font-weight: 600;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
gap: 0.3rem;
|
||||
transition: all 0.3s ease;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.status::before {
|
||||
#connectionStatus::before {
|
||||
content: "";
|
||||
display: inline-block;
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.status.connected {
|
||||
#connectionStatus.connected {
|
||||
background-color: rgba(76, 175, 80, 0.15);
|
||||
color: var(--success);
|
||||
border: 1px solid rgba(76, 175, 80, 0.3);
|
||||
}
|
||||
|
||||
.status.connected::before {
|
||||
#connectionStatus.connected::before {
|
||||
background-color: var(--success);
|
||||
box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.3);
|
||||
}
|
||||
|
||||
.status.disconnected {
|
||||
#connectionStatus.disconnected {
|
||||
background-color: rgba(244, 67, 54, 0.15);
|
||||
color: var(--danger);
|
||||
border: 1px solid rgba(244, 67, 54, 0.3);
|
||||
}
|
||||
|
||||
.status.disconnected::before {
|
||||
#connectionStatus.disconnected::before {
|
||||
background-color: var(--danger);
|
||||
box-shadow: 0 0 0 2px rgba(244, 67, 54, 0.3);
|
||||
}
|
||||
|
||||
.header-right {
|
||||
.header-buttons {
|
||||
display: flex;
|
||||
gap: 0.8rem;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.header-right .btn-icon {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
.header-buttons .btn-icon {
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -187,14 +185,14 @@ body {
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
.header-right .btn-icon:hover {
|
||||
.header-buttons .btn-icon:hover {
|
||||
transform: translateY(-2px);
|
||||
background-color: var(--hover-color);
|
||||
color: var(--primary);
|
||||
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.header-right .btn-icon:active {
|
||||
.header-buttons .btn-icon:active {
|
||||
transform: translateY(0);
|
||||
}
|
||||
|
||||
@@ -275,21 +273,20 @@ body {
|
||||
|
||||
.text-editor {
|
||||
width: 100%;
|
||||
max-width: 700px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1rem;
|
||||
gap: 1.5rem;
|
||||
background-color: var(--surface);
|
||||
padding: 1.5rem;
|
||||
border-radius: 0.75rem;
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
|
||||
border: 1px solid var(--border-color);
|
||||
transition: all 0.3s ease;
|
||||
margin-top: 1.5rem;
|
||||
}
|
||||
|
||||
.text-editor:hover {
|
||||
box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
|
||||
.text-editor textarea {
|
||||
@@ -303,7 +300,7 @@ body {
|
||||
font-size: 1rem;
|
||||
resize: vertical;
|
||||
transition: all 0.2s ease;
|
||||
line-height: 1.6;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.text-editor textarea:focus {
|
||||
@@ -312,44 +309,14 @@ body {
|
||||
box-shadow: 0 0 0 3px rgba(74, 108, 247, 0.15);
|
||||
}
|
||||
|
||||
.text-editor button {
|
||||
align-self: flex-end;
|
||||
}
|
||||
|
||||
.text-format-controls {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
/* 发送文本按钮样式 */
|
||||
#sendExtractedText {
|
||||
width: 100%;
|
||||
justify-content: center;
|
||||
padding: 0.875rem;
|
||||
margin-top: 0.5rem;
|
||||
}
|
||||
|
||||
.send-text-group {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 1rem;
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
.confidence-indicator {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
padding: 0.5rem 0.75rem;
|
||||
border-radius: 0.5rem;
|
||||
background-color: var(--surface-alt);
|
||||
color: var(--success);
|
||||
font-size: 0.875rem;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.confidence-indicator i {
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.confidence-value {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.image-preview {
|
||||
position: relative;
|
||||
border-radius: 1rem;
|
||||
@@ -388,10 +355,144 @@ body {
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.app-header {
|
||||
padding: 0.6rem;
|
||||
}
|
||||
|
||||
.app-header h1 {
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
|
||||
#connectionStatus {
|
||||
font-size: 0.7rem;
|
||||
padding: 0.15rem 0.4rem;
|
||||
}
|
||||
|
||||
.header-buttons .btn-icon {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
}
|
||||
|
||||
.toolbar-buttons {
|
||||
flex-direction: row;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.button-group {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.btn-primary, .btn-secondary {
|
||||
padding: 0.5rem 0.7rem;
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
|
||||
.app-main {
|
||||
padding: 1rem 0.75rem;
|
||||
}
|
||||
|
||||
.settings-panel {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.claude-panel {
|
||||
border-radius: 0.75rem;
|
||||
min-height: 200px;
|
||||
}
|
||||
|
||||
.response-content {
|
||||
padding: 1rem;
|
||||
font-size: 0.95rem;
|
||||
}
|
||||
|
||||
.thinking-content {
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
|
||||
.thinking-content.expanded {
|
||||
padding: 0.75rem 1rem;
|
||||
}
|
||||
|
||||
.fab {
|
||||
right: 1rem;
|
||||
bottom: 1rem;
|
||||
}
|
||||
|
||||
.text-editor {
|
||||
padding: 1.25rem;
|
||||
margin-top: 1.25rem;
|
||||
}
|
||||
|
||||
.text-editor textarea {
|
||||
min-height: 120px;
|
||||
font-size: 0.95rem;
|
||||
}
|
||||
|
||||
#sendExtractedText {
|
||||
padding: 0.75rem;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 480px) {
|
||||
.app-header h1 {
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
#connectionStatus {
|
||||
max-width: 70px;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.header-buttons .btn-icon {
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
|
||||
.toolbar-buttons {
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.toast-container {
|
||||
top: 3.5rem;
|
||||
right: 0.5rem;
|
||||
}
|
||||
|
||||
.empty-state i {
|
||||
font-size: 3rem;
|
||||
}
|
||||
|
||||
.empty-state h3 {
|
||||
font-size: 1.2rem;
|
||||
}
|
||||
|
||||
.empty-state p {
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.text-editor {
|
||||
padding: 1rem;
|
||||
border-radius: 0.5rem;
|
||||
margin-top: 1rem;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.text-editor textarea {
|
||||
min-height: 100px;
|
||||
padding: 0.75rem;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.confidence-indicator {
|
||||
padding: 0.375rem 0.625rem;
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
|
||||
#sendExtractedText {
|
||||
padding: 0.75rem;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
}
|
||||
|
||||
/* Claude Panel */
|
||||
@@ -403,10 +504,9 @@ body {
|
||||
flex-direction: column;
|
||||
height: auto;
|
||||
min-height: 300px;
|
||||
max-height: 90vh;
|
||||
border: 1px solid var(--border-color);
|
||||
transition: all 0.3s ease;
|
||||
overflow: hidden;
|
||||
overflow: visible;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
@@ -498,6 +598,8 @@ body {
|
||||
overflow-wrap: break-word;
|
||||
margin-top: 1rem;
|
||||
font-size: 1rem;
|
||||
height: auto;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
[data-theme="dark"] .response-content {
|
||||
@@ -847,7 +949,7 @@ button:disabled {
|
||||
/* Toast Notifications */
|
||||
.toast-container {
|
||||
position: fixed;
|
||||
top: 1rem;
|
||||
top: 4rem;
|
||||
right: 1rem;
|
||||
left: auto;
|
||||
transform: none;
|
||||
@@ -937,233 +1039,6 @@ button:disabled {
|
||||
}
|
||||
}
|
||||
|
||||
/* Responsive Design */
|
||||
@media (max-width: 768px) {
|
||||
.app-header {
|
||||
flex-direction: column;
|
||||
gap: 1rem;
|
||||
padding: 0.75rem;
|
||||
}
|
||||
|
||||
.header-left {
|
||||
flex-direction: column;
|
||||
gap: 1rem;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.connection-status {
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.connection-form {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.connection-form input {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.header-right {
|
||||
width: 100%;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.settings-panel {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.fab {
|
||||
right: 1rem;
|
||||
bottom: 1rem;
|
||||
}
|
||||
}
|
||||
|
||||
/* History Panel */
|
||||
/* Hide specific elements when viewing history items */
|
||||
body.history-view .text-editor,
|
||||
body.history-view .text-format-controls,
|
||||
body.history-view .confidence-indicator,
|
||||
body.history-view #confidenceIndicator,
|
||||
body.history-view #confidenceDisplay,
|
||||
body.history-view #extractText,
|
||||
body.history-view #sendExtractedText,
|
||||
body.history-view .format-toggle,
|
||||
body.history-view .send-text-group,
|
||||
body.history-view #textEditor,
|
||||
body.history-view .analysis-button .button-group {
|
||||
display: none !important;
|
||||
visibility: hidden !important;
|
||||
opacity: 0 !important;
|
||||
pointer-events: none !important;
|
||||
position: absolute !important;
|
||||
z-index: -1 !important;
|
||||
}
|
||||
|
||||
/* Ensure only image and response are visible in history view */
|
||||
body.history-view .image-preview,
|
||||
body.history-view .claude-panel {
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
.history-panel {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
width: 400px;
|
||||
max-width: 100vw;
|
||||
background-color: var(--surface);
|
||||
box-shadow: -2px 0 4px var(--shadow-color);
|
||||
z-index: 1000;
|
||||
transform: translateX(100%);
|
||||
transition: transform 0.3s ease;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.history-panel:not(.hidden) {
|
||||
transform: translateX(0);
|
||||
}
|
||||
|
||||
.history-content {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
.history-empty {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 100%;
|
||||
color: var(--text-secondary);
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.history-empty i {
|
||||
font-size: 3rem;
|
||||
}
|
||||
|
||||
.history-item {
|
||||
background-color: var(--background);
|
||||
border-radius: 0.5rem;
|
||||
padding: 1rem;
|
||||
margin-bottom: 1rem;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s;
|
||||
position: relative;
|
||||
border: 1px solid var(--border-color);
|
||||
}
|
||||
|
||||
.history-item:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 2px 8px var(--shadow-color);
|
||||
}
|
||||
|
||||
.history-item[data-has-response="true"]::after {
|
||||
content: "Has Analysis";
|
||||
position: absolute;
|
||||
top: 0.5rem;
|
||||
right: 0.5rem;
|
||||
background-color: var(--primary-color);
|
||||
color: white;
|
||||
padding: 0.25rem 0.5rem;
|
||||
border-radius: 1rem;
|
||||
font-size: 0.75rem;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.history-item-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 0.5rem;
|
||||
font-size: 0.875rem;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.history-image {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
border-radius: 0.25rem;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.history-response {
|
||||
background-color: var(--background);
|
||||
border-radius: 0.5rem;
|
||||
padding: 1rem;
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
.history-response h4 {
|
||||
color: var(--text-primary);
|
||||
margin-bottom: 0.5rem;
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.history-response pre {
|
||||
white-space: pre-wrap;
|
||||
font-family: inherit;
|
||||
font-size: 0.9375rem;
|
||||
line-height: 1.6;
|
||||
color: var(--text-secondary);
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* API Key Groups */
|
||||
.api-key-group {
|
||||
margin-bottom: 1.5rem;
|
||||
padding: 1rem;
|
||||
background-color: var(--background);
|
||||
border-radius: 0.5rem;
|
||||
border: 1px solid var(--border-color);
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.api-key-group:not([style*="display: none"]) {
|
||||
animation: fade-in 0.3s ease;
|
||||
}
|
||||
|
||||
.api-key-group label {
|
||||
font-weight: 500;
|
||||
color: var(--text-primary);
|
||||
margin-bottom: 0.75rem;
|
||||
}
|
||||
|
||||
.api-key-group .input-group {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
@keyframes fade-in {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(-10px);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
/* Utility Classes */
|
||||
.hidden {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* Additional Responsive Styles */
|
||||
@media (max-width: 768px) {
|
||||
.history-panel {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.history-item {
|
||||
padding: 0.75rem;
|
||||
}
|
||||
}
|
||||
|
||||
/* Thinking Section */
|
||||
.thinking-section {
|
||||
margin-bottom: 1rem;
|
||||
@@ -1184,7 +1059,6 @@ body.history-view .claude-panel {
|
||||
}
|
||||
|
||||
.thinking-header::after {
|
||||
content: "点击展开/折叠";
|
||||
position: absolute;
|
||||
right: 60px;
|
||||
color: var(--text-secondary);
|
||||
@@ -1256,9 +1130,9 @@ body.history-view .claude-panel {
|
||||
}
|
||||
|
||||
.thinking-content.expanded {
|
||||
max-height: 600px;
|
||||
max-height: none;
|
||||
padding: 1rem 1.5rem;
|
||||
overflow-y: auto;
|
||||
overflow-y: visible;
|
||||
}
|
||||
|
||||
/* Animation for thinking content */
|
||||
@@ -1313,41 +1187,14 @@ body.history-view .claude-panel {
|
||||
}
|
||||
|
||||
[data-theme="dark"] .init-error pre {
|
||||
background-color: rgba(255, 255, 255, 0.05);
|
||||
background-color: rgba(var(--surface-rgb), 0.5);
|
||||
}
|
||||
|
||||
.history-thumbnail {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
border-radius: 4px;
|
||||
}
|
||||
/* 删除历史缩略图相关样式 */
|
||||
|
||||
.history-thumbnail-placeholder {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background-color: #f0f0f0;
|
||||
border-radius: 4px;
|
||||
color: #666;
|
||||
text-align: center;
|
||||
padding: 10px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.history-thumbnail-placeholder i {
|
||||
font-size: 24px;
|
||||
margin-bottom: 5px;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.history-thumbnail-placeholder span {
|
||||
font-size: 12px;
|
||||
line-height: 1.2;
|
||||
display: block;
|
||||
/* Utility Classes */
|
||||
.hidden {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* Select Styling */
|
||||
@@ -1427,3 +1274,17 @@ body.history-view .claude-panel {
|
||||
.response-title h3 {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* 大屏幕设备的布局 */
|
||||
@media (min-width: 769px) {
|
||||
.text-editor {
|
||||
max-width: 900px;
|
||||
margin: 1.5rem auto;
|
||||
}
|
||||
|
||||
#sendExtractedText {
|
||||
width: auto;
|
||||
min-width: 200px;
|
||||
align-self: flex-end;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user