fix bug, in the middle
This commit is contained in:
61
spec/bug-fix-1.md
Normal file
61
spec/bug-fix-1.md
Normal file
@@ -0,0 +1,61 @@
|
||||
# Bug Fixes & UI Polishing Tasks
|
||||
|
||||
**Context:**
|
||||
We are refining the "LiteRequest" application. The core logic works, but there are specific UI bugs and a functional regression in the Settings module.
|
||||
|
||||
**Goal:** Fix visual inconsistencies and ensure the Settings (Font Size/Family) are correctly applied to the CodeMirror editor.
|
||||
|
||||
## Task List
|
||||
|
||||
### 1. Reorder Tabs in Request Panel
|
||||
* **Issue:** The **"Auth"** tab is currently the first tab.
|
||||
* **Fix:** Move the **"Auth"** tab to the **last position**.
|
||||
* **Order:** `Params` -> `Headers` -> `Body` -> `Auth`.
|
||||
* **Action:** Update `RequestPanel.vue` (both the tab navigation list and the conditional rendering of the content).
|
||||
|
||||
### 2. Fix Method Dropdown Styling (Dark Mode)
|
||||
* **Issue:** The HTML `<select>` dropdown for HTTP Methods shows a white background when expanded, which clashes with the dark theme.
|
||||
* **Fix:**
|
||||
* Apply Tailwind classes `bg-slate-900` and `text-white` (or `text-slate-200`) explicitly to the `<option>` tags within the `<select>`.
|
||||
* Ensure the `<select>` itself has `bg-slate-900`, `border-slate-700`, and `text-white`.
|
||||
* *Note:* Browser native dropdowns are hard to style perfectly, but ensuring the background color is set on options fixes the glaring white box issue.
|
||||
|
||||
### 3. Fix Editor Background Color Mismatch
|
||||
* **Issue:** The CodeMirror editor background is currently a generic gray (likely from a default theme), which looks disconnected from the App's `slate-900` / `slate-950` theme.
|
||||
* **Fix:**
|
||||
* In `Editor.vue`, modify the CodeMirror theme configuration.
|
||||
* **Transparent Background:** Set the CodeMirror editor's background to `transparent` so it adopts the parent container's color.
|
||||
* **Code Snippet Hint:**
|
||||
```javascript
|
||||
EditorView.theme({
|
||||
"&": { backgroundColor: "transparent !important", height: "100%" },
|
||||
".cm-gutters": { backgroundColor: "transparent !important" } // Match gutter too
|
||||
})
|
||||
```
|
||||
* Ensure the parent container in `Editor.vue` has the correct Tailwind class (e.g., `bg-slate-900`).
|
||||
|
||||
### 4. Fix Font Settings Not Applying
|
||||
* **Issue:** Changing Font Size or Family in Settings does not update the Editor view.
|
||||
* **Root Cause:** CodeMirror 6 does not automatically react to CSS style changes on the parent container for everything (especially if a Theme is hardcoded).
|
||||
* **Fix:**
|
||||
* Update `Editor.vue`.
|
||||
* Use a **Vue `watch` effect** to listen to changes in `settingsStore.editorFontSize` and `settingsStore.editorFontFamily`.
|
||||
* **Implementation Strategy:**
|
||||
* Instead of trying to update the theme, simply apply a reactive `style` object to the **wrapper `<div>`** of the CodeMirror component.
|
||||
* **Crucial Step:** Ensure the CodeMirror theme allows inheritance.
|
||||
* **Alternative (Better):** Re-dispatch a CodeMirror Effect or update the `EditorView` style via a `Compartment` if the wrapper style approach fails.
|
||||
* *Simplified approach for Vue:* Bind `:style="{ fontSize: store.fontSize + 'px', fontFamily: store.fontFamily }"` to the outer div, and ensure the `.cm-editor` CSS allows inheritance (usually it does by default, but confirm standard text styles).
|
||||
|
||||
## Implementation Instructions for AI
|
||||
|
||||
Please generate the code corrections in the following order:
|
||||
|
||||
1. **`RequestPanel.vue`:** Show the updated template with the reordered Tabs.
|
||||
2. **`RequestPanel.vue` (or wherever the Method Selector is):** Show the CSS/Tailwind fix for the Dropdown and Options.
|
||||
3. **`Editor.vue`:**
|
||||
* Show the updated CodeMirror configuration (making background transparent).
|
||||
* Show the logical fix to apply Font Settings (using `watch` or reactive styles).
|
||||
|
||||
---
|
||||
**Instruction to AI:**
|
||||
Please generate the corrected code blocks for these specific files to resolve the visual bugs and settings regression.
|
||||
@@ -8,14 +8,25 @@ import { invoke } from '@tauri-apps/api/core';
|
||||
import { Codemirror } from 'vue-codemirror';
|
||||
import { json } from '@codemirror/lang-json';
|
||||
import { oneDark } from '@codemirror/theme-one-dark';
|
||||
import { EditorView } from '@codemirror/view';
|
||||
import { Play, Loader2 } from 'lucide-vue-next';
|
||||
|
||||
const store = useRequestStore();
|
||||
const settings = useSettingsStore();
|
||||
const activeTab = ref('auth'); // Default to auth or params? Spec says "add a new Tab... place it first". I'll set default to 'params' or 'auth'? Usually params is more common, but let's stick to 'params' as default unless user changed it, or maybe the spec implies it's important. I'll leave 'params' as default activeTab for now or switch to 'auth' if requested. Spec doesn't say to make it default active.
|
||||
const activeTab = ref('params');
|
||||
const isLoading = ref(false);
|
||||
|
||||
const extensions = [json(), oneDark];
|
||||
const transparentTheme = EditorView.theme({
|
||||
"&": {
|
||||
backgroundColor: "transparent !important",
|
||||
height: "100%"
|
||||
},
|
||||
".cm-gutters": {
|
||||
backgroundColor: "transparent !important"
|
||||
}
|
||||
});
|
||||
|
||||
const extensions = [json(), oneDark, transparentTheme];
|
||||
|
||||
const methods = ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'HEAD', 'OPTIONS'];
|
||||
|
||||
@@ -71,9 +82,9 @@ const executeRequest = async () => {
|
||||
<div class="flex-1 flex items-center bg-slate-950 rounded-lg border border-slate-800 focus-within:border-indigo-500/50 focus-within:ring-1 focus-within:ring-indigo-500/50 transition-all overflow-hidden">
|
||||
<select
|
||||
v-model="store.activeRequest.method"
|
||||
class="bg-transparent text-xs font-bold px-3 py-2 text-slate-300 border-r border-slate-800 focus:outline-none hover:bg-slate-900 cursor-pointer uppercase appearance-none"
|
||||
class="bg-slate-900 text-xs font-bold px-3 py-2 text-white border-r border-slate-800 focus:outline-none hover:bg-slate-800 cursor-pointer uppercase appearance-none"
|
||||
>
|
||||
<option v-for="m in methods" :key="m" :value="m">{{ m }}</option>
|
||||
<option v-for="m in methods" :key="m" :value="m" class="bg-slate-900 text-white">{{ m }}</option>
|
||||
</select>
|
||||
<input
|
||||
type="text"
|
||||
@@ -97,7 +108,7 @@ const executeRequest = async () => {
|
||||
<!-- Configuration Tabs -->
|
||||
<div class="flex border-b border-slate-800">
|
||||
<button
|
||||
v-for="tab in ['auth', 'params', 'headers', 'body']"
|
||||
v-for="tab in ['params', 'headers', 'body', 'auth']"
|
||||
:key="tab"
|
||||
@click="activeTab = tab"
|
||||
class="px-4 py-2 text-xs font-medium uppercase tracking-wide border-b-2 transition-colors"
|
||||
@@ -109,11 +120,6 @@ const executeRequest = async () => {
|
||||
|
||||
<!-- Content Area -->
|
||||
<div class="flex-1 overflow-hidden relative">
|
||||
<KeepAlive>
|
||||
<AuthPanel
|
||||
v-if="activeTab === 'auth'"
|
||||
/>
|
||||
</KeepAlive>
|
||||
<KeepAlive>
|
||||
<KeyValueEditor
|
||||
v-if="activeTab === 'params'"
|
||||
@@ -141,6 +147,11 @@ const executeRequest = async () => {
|
||||
:extensions="extensions"
|
||||
/>
|
||||
</div>
|
||||
<KeepAlive>
|
||||
<AuthPanel
|
||||
v-if="activeTab === 'auth'"
|
||||
/>
|
||||
</KeepAlive>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user