Skip to content

Commit fee3240

Browse files
committed
fix: fix misaligns
1 parent 76e370c commit fee3240

File tree

5 files changed

+63
-38
lines changed

5 files changed

+63
-38
lines changed

src/components/chat/shortcutHandler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ export class ShortcutHandler {
143143
this.input.value = '';
144144
break;
145145
case '/screenshot':
146-
document.getElementById('screenshot-btn')?.click();
146+
document.getElementById('ai-screenshot-btn')?.click();
147147
this.input.value = '';
148148
break;
149149
// Add more command handlers as needed

src/components/context/__tests__/contextModes.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,16 @@ describe('Context Modes', () => {
3636
<div class="slider-option" data-mode="screenshot">Screenshot</div>
3737
<div class="slider-highlight"></div>
3838
</div>
39-
<button id="screenshot-btn">Take Screenshot</button>
40-
<div id="drop-zone">Drop zone</div>
41-
<div id="content-preview"></div>
42-
<input type="file" id="file-input" />
39+
<button id="ai-screenshot-btn">Take Screenshot</button>
40+
<div id="ai-drop-zone">Drop zone</div>
41+
<div id="ai-content-preview"></div>
42+
<input type="file" id="ai-file-input" />
4343
`;
4444
document.body.appendChild(container);
4545

4646
// Get elements
47-
contentPreview = document.getElementById('content-preview') as HTMLDivElement;
48-
screenshotBtn = document.getElementById('screenshot-btn') as HTMLButtonElement;
47+
contentPreview = document.getElementById('ai-content-preview') as HTMLDivElement;
48+
screenshotBtn = document.getElementById('ai-screenshot-btn') as HTMLButtonElement;
4949
options = document.querySelectorAll('.slider-option');
5050
highlight = document.querySelector('.slider-highlight') as HTMLElement;
5151

src/components/ui/sidebar.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ export function createSidebar(): void {
297297
<div class="ai-slider-highlight"></div>
298298
</div>
299299
</div>
300-
<button id="ai-screenshot-btn" class="ai-hidden" aria-label="Take Screenshot">
300+
<button id="ai-screenshot-btn" class="hidden" aria-label="Take Screenshot">
301301
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
302302
<path d="M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z"/>
303303
<circle cx="12" cy="13" r="4"/>
@@ -306,7 +306,7 @@ export function createSidebar(): void {
306306
</div>
307307
<div id="ai-context-area">
308308
<div id="ai-content-preview"></div>
309-
<div id="ai-drop-zone" class="ai-hidden">
309+
<div id="ai-drop-zone" class="hidden">
310310
<p>Take a screenshot or drag and drop an image here</p>
311311
<input type="file" id="ai-file-input" accept="image/*" hidden>
312312
</div>

src/styles.css

Lines changed: 47 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105
}
106106

107107
.ai-context-mode-wrapper {
108-
width: 300px;
108+
width: 320px;
109109
}
110110

111111
.ai-slider-container {
@@ -114,13 +114,13 @@
114114
border-radius: 6px;
115115
padding: 3px;
116116
position: relative;
117-
margin-bottom: 8px;
117+
margin-bottom: 0px;
118118
}
119119

120120
.ai-slider-option {
121121
flex: 1;
122122
text-align: center;
123-
padding: 4px 8px;
123+
padding: 8px 8px;
124124
font-size: 12px;
125125
cursor: pointer;
126126
position: relative;
@@ -219,7 +219,7 @@
219219
color: var(--text, #e2e8f0);
220220
}
221221

222-
.ai-hidden {
222+
#ai-drop-zone.hidden {
223223
display: none !important;
224224
}
225225

@@ -302,7 +302,7 @@
302302

303303
.ai-modal {
304304
display: none;
305-
position: fixed;
305+
position: absolute;
306306
top: 0;
307307
left: 0;
308308
width: 100%;
@@ -311,18 +311,20 @@
311311
z-index: 10001;
312312
}
313313

314-
.ai-modal.ai-show {
314+
.ai-modal.show {
315315
display: flex;
316316
align-items: center;
317317
justify-content: center;
318318
}
319319

320320
.ai-modal-content {
321-
background: white;
321+
background: var(--bg, white);
322322
padding: 20px;
323323
border-radius: 4px;
324-
max-width: 400px;
325-
width: 100%;
324+
max-width: 300px;
325+
width: calc(100% - 40px);
326+
margin: 0 20px;
327+
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
326328
}
327329

328330
.ai-modal-actions {
@@ -333,22 +335,47 @@
333335
}
334336

335337
.ai-modal-button {
336-
padding: 8px 16px;
337-
border-radius: 4px;
338+
padding: 6px 12px;
339+
border-radius: 6px;
338340
cursor: pointer;
341+
font-size: 13px;
342+
font-family: inherit;
343+
font-weight: 500;
344+
transition: all 0.2s ease;
339345
}
340346

341-
.cancel-button {
342-
background: none;
343-
border: 1px solid #ddd;
347+
.ai-cancel-button {
348+
background: var(--bg, #ffffff);
349+
color: var(--text, #1e293b);
350+
border: 1px solid var(--border, #e2e8f0);
351+
}
352+
353+
.ai-cancel-button:hover {
354+
background: var(--hover, #f8fafc);
355+
border-color: var(--button-bg, #3b82f6);
344356
}
345357

346-
.confirm-button {
347-
background: #e74c3c;
358+
.ai-confirm-button {
359+
background: var(--button-bg, #ef4444);
348360
color: white;
349361
border: none;
350362
}
351363

364+
.ai-confirm-button:hover {
365+
background: var(--button-hover-bg, #dc2626);
366+
}
367+
368+
[data-theme="dark"] .ai-cancel-button {
369+
background: var(--bg, #1e293b);
370+
border-color: var(--border, #4d4d4d);
371+
color: var(--text, #e2e8f0);
372+
}
373+
374+
[data-theme="dark"] .ai-cancel-button:hover {
375+
background: var(--hover, #334155);
376+
border-color: var(--button-bg, #3b82f6);
377+
}
378+
352379
.ai-theme-toggle {
353380
background: none;
354381
border: none;
@@ -419,15 +446,6 @@
419446
background: #2d2d2d;
420447
}
421448

422-
[data-theme="dark"] .ai-cancel-button {
423-
border-color: #4d4d4d;
424-
color: #fff;
425-
}
426-
427-
[data-theme="dark"] .ai-theme-toggle {
428-
color: #fff;
429-
}
430-
431449
.image-preview {
432450
position: relative;
433451
display: inline-block;
@@ -760,7 +778,7 @@
760778
color: var(--light-text, #94a3b8);
761779
}
762780

763-
#screenshot-btn {
781+
#ai-screenshot-btn {
764782
padding: 6px;
765783
background: var(--bg, #ffffff);
766784
color: var(--text, #1e293b);
@@ -777,17 +795,17 @@
777795
box-sizing: border-box;
778796
}
779797

780-
#screenshot-btn:hover {
798+
#ai-screenshot-btn:hover {
781799
background: var(--hover, #f8fafc);
782800
border-color: var(--button-bg, #3b82f6);
783801
}
784802

785-
#screenshot-btn svg {
803+
#ai-screenshot-btn svg {
786804
width: 16px;
787805
height: 16px;
788806
}
789807

790-
#screenshot-btn.hidden {
808+
#ai-screenshot-btn.hidden {
791809
display: none;
792810
}
793811

src/utils/theme.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,11 @@ export function applyTheme(theme: Theme): void {
1616
themeToggle.classList.remove('light', 'dark');
1717
themeToggle.classList.add(theme);
1818
}
19+
20+
// Update modal theme
21+
const modal = document.getElementById('ai-modal');
22+
if (modal) {
23+
modal.classList.remove('light', 'dark');
24+
modal.classList.add(theme);
25+
}
1926
}

0 commit comments

Comments
 (0)