fix ui
This commit is contained in:
@@ -4,6 +4,7 @@ import { computed, onBeforeUnmount, ref } from "vue";
|
|||||||
type Option = {
|
type Option = {
|
||||||
label: string;
|
label: string;
|
||||||
value: string;
|
value: string;
|
||||||
|
iconSrc?: string | null;
|
||||||
};
|
};
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
@@ -63,7 +64,15 @@ onBeforeUnmount(() => {
|
|||||||
type="button"
|
type="button"
|
||||||
@click="toggle"
|
@click="toggle"
|
||||||
>
|
>
|
||||||
<span>{{ selectedLabel }}</span>
|
<span class="sort-dropdown-trigger-label">
|
||||||
|
<img
|
||||||
|
v-if="options.find((option) => option.value === modelValue)?.iconSrc"
|
||||||
|
class="sort-dropdown-option-icon"
|
||||||
|
:src="options.find((option) => option.value === modelValue)?.iconSrc ?? undefined"
|
||||||
|
:alt="selectedLabel"
|
||||||
|
/>
|
||||||
|
<span>{{ selectedLabel }}</span>
|
||||||
|
</span>
|
||||||
<span class="sort-dropdown-caret" aria-hidden="true"></span>
|
<span class="sort-dropdown-caret" aria-hidden="true"></span>
|
||||||
</button>
|
</button>
|
||||||
<div v-if="open" class="sort-dropdown-menu">
|
<div v-if="open" class="sort-dropdown-menu">
|
||||||
@@ -75,7 +84,15 @@ onBeforeUnmount(() => {
|
|||||||
type="button"
|
type="button"
|
||||||
@click="select(option.value)"
|
@click="select(option.value)"
|
||||||
>
|
>
|
||||||
{{ option.label }}
|
<span class="sort-dropdown-option-content">
|
||||||
|
<img
|
||||||
|
v-if="option.iconSrc"
|
||||||
|
class="sort-dropdown-option-icon"
|
||||||
|
:src="option.iconSrc"
|
||||||
|
:alt="option.label"
|
||||||
|
/>
|
||||||
|
<span>{{ option.label }}</span>
|
||||||
|
</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { computed, ref } from "vue";
|
||||||
|
import SortDropdown from "../SortDropdown.vue";
|
||||||
import { browserIconOptions, browserIconSrc } from "../../utils/icons";
|
import { browserIconOptions, browserIconSrc } from "../../utils/icons";
|
||||||
import type { BrowserConfigEntry, CreateCustomBrowserConfigInput } from "../../types/browser";
|
import type { BrowserConfigEntry, CreateCustomBrowserConfigInput } from "../../types/browser";
|
||||||
|
|
||||||
@@ -22,6 +24,16 @@ const emit = defineEmits<{
|
|||||||
createConfig: [];
|
createConfig: [];
|
||||||
deleteConfig: [configId: string];
|
deleteConfig: [configId: string];
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
|
const formExpanded = ref(false);
|
||||||
|
|
||||||
|
const iconOptions = computed(() =>
|
||||||
|
browserIconOptions.map((option) => ({
|
||||||
|
label: option.label,
|
||||||
|
value: option.key,
|
||||||
|
iconSrc: option.src,
|
||||||
|
})),
|
||||||
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -32,12 +44,21 @@ const emit = defineEmits<{
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="config-form-card">
|
<div class="config-form-card">
|
||||||
<div class="config-form-header">
|
<div class="config-form-header collapsible">
|
||||||
<h3>Add Custom Browser</h3>
|
<div>
|
||||||
<p>Provide a name, executable path, and Chromium user data path.</p>
|
<h3>Add Custom Browser</h3>
|
||||||
|
<p>Add a custom executable and Chromium user data path when needed.</p>
|
||||||
|
</div>
|
||||||
|
<button
|
||||||
|
class="secondary-button config-toggle-button"
|
||||||
|
type="button"
|
||||||
|
@click="formExpanded = !formExpanded"
|
||||||
|
>
|
||||||
|
{{ formExpanded ? "Collapse" : "Expand" }}
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="config-form-layout">
|
<div v-if="formExpanded" class="config-form-fields compact">
|
||||||
<div class="config-form-fields">
|
<div class="config-inline-row">
|
||||||
<label class="field-group">
|
<label class="field-group">
|
||||||
<span>Name</span>
|
<span>Name</span>
|
||||||
<input
|
<input
|
||||||
@@ -47,61 +68,54 @@ const emit = defineEmits<{
|
|||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
<label class="field-group">
|
<label class="field-group">
|
||||||
<span>Executable Path</span>
|
<span>Icon</span>
|
||||||
<div class="path-input-row">
|
<SortDropdown
|
||||||
<input
|
:model-value="createConfigForm.iconKey ?? 'chrome'"
|
||||||
:value="createConfigForm.executablePath"
|
:options="iconOptions"
|
||||||
placeholder="C:\Program Files\...\chrome.exe"
|
@update:model-value="emit('updateIconKey', $event)"
|
||||||
@input="emit('updateExecutablePath', ($event.target as HTMLInputElement).value)"
|
/>
|
||||||
/>
|
|
||||||
<button class="secondary-button" type="button" @click="emit('pickExecutablePath')">
|
|
||||||
Browse File
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</label>
|
|
||||||
<label class="field-group">
|
|
||||||
<span>User Data Path</span>
|
|
||||||
<div class="path-input-row">
|
|
||||||
<input
|
|
||||||
:value="createConfigForm.userDataPath"
|
|
||||||
placeholder="C:\Users\...\User Data"
|
|
||||||
@input="emit('updateUserDataPath', ($event.target as HTMLInputElement).value)"
|
|
||||||
/>
|
|
||||||
<button class="secondary-button" type="button" @click="emit('pickUserDataPath')">
|
|
||||||
Browse Folder
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="config-form-side">
|
<label class="field-group">
|
||||||
<label class="field-group">
|
<span>Executable Path</span>
|
||||||
<span>Icon</span>
|
<div class="path-input-row">
|
||||||
<div class="icon-option-grid">
|
<input
|
||||||
<button
|
:value="createConfigForm.executablePath"
|
||||||
v-for="option in browserIconOptions"
|
placeholder="C:\Program Files\...\chrome.exe"
|
||||||
:key="option.key"
|
@input="emit('updateExecutablePath', ($event.target as HTMLInputElement).value)"
|
||||||
class="icon-option-button"
|
/>
|
||||||
:class="{ active: createConfigForm.iconKey === option.key }"
|
<button class="secondary-button" type="button" @click="emit('pickExecutablePath')">
|
||||||
type="button"
|
Browse File
|
||||||
@click="emit('updateIconKey', option.key)"
|
|
||||||
>
|
|
||||||
<img :src="option.src" :alt="option.label" />
|
|
||||||
<span>{{ option.label }}</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</label>
|
|
||||||
<div class="config-form-actions">
|
|
||||||
<button
|
|
||||||
class="primary-button"
|
|
||||||
type="button"
|
|
||||||
:disabled="savingConfig"
|
|
||||||
@click="emit('createConfig')"
|
|
||||||
>
|
|
||||||
{{ savingConfig ? "Saving..." : "Add Config" }}
|
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
</label>
|
||||||
|
<label class="field-group">
|
||||||
|
<span>User Data Path</span>
|
||||||
|
<div class="path-input-row">
|
||||||
|
<input
|
||||||
|
:value="createConfigForm.userDataPath"
|
||||||
|
placeholder="C:\Users\...\User Data"
|
||||||
|
@input="emit('updateUserDataPath', ($event.target as HTMLInputElement).value)"
|
||||||
|
/>
|
||||||
|
<button class="secondary-button" type="button" @click="emit('pickUserDataPath')">
|
||||||
|
Browse Folder
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</label>
|
||||||
|
<div class="config-form-actions">
|
||||||
|
<button
|
||||||
|
class="primary-button"
|
||||||
|
type="button"
|
||||||
|
:disabled="savingConfig"
|
||||||
|
@click="emit('createConfig')"
|
||||||
|
>
|
||||||
|
{{ savingConfig ? "Saving..." : "Add Config" }}
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div v-else class="config-form-collapsed-note">
|
||||||
|
<span>Collapsed by default to keep this page focused on existing configs.</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="configsLoading" class="empty-card">
|
<div v-if="configsLoading" class="empty-card">
|
||||||
|
|||||||
@@ -262,6 +262,13 @@
|
|||||||
font-size: 0.94rem;
|
font-size: 0.94rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.config-form-header.collapsible {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
.config-form-header p,
|
.config-form-header p,
|
||||||
.config-meta-row p {
|
.config-meta-row p {
|
||||||
margin: 6px 0 0;
|
margin: 6px 0 0;
|
||||||
@@ -269,19 +276,33 @@
|
|||||||
font-size: 0.82rem;
|
font-size: 0.82rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.config-form-layout {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.95fr);
|
|
||||||
gap: 14px;
|
|
||||||
margin-top: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.config-form-fields,
|
.config-form-fields,
|
||||||
.config-form-side {
|
.config-form-side {
|
||||||
display: grid;
|
display: grid;
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.config-form-fields.compact {
|
||||||
|
margin-top: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.config-inline-row {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: minmax(0, 1fr) 240px;
|
||||||
|
gap: 12px;
|
||||||
|
align-items: end;
|
||||||
|
}
|
||||||
|
|
||||||
|
.config-form-collapsed-note {
|
||||||
|
margin-top: 12px;
|
||||||
|
padding: 10px 12px;
|
||||||
|
border-radius: 12px;
|
||||||
|
background: rgba(248, 250, 252, 0.78);
|
||||||
|
border: 1px solid rgba(148, 163, 184, 0.12);
|
||||||
|
color: var(--muted);
|
||||||
|
font-size: 0.82rem;
|
||||||
|
}
|
||||||
|
|
||||||
.config-form-side {
|
.config-form-side {
|
||||||
align-content: start;
|
align-content: start;
|
||||||
padding: 10px 12px;
|
padding: 10px 12px;
|
||||||
@@ -344,6 +365,10 @@
|
|||||||
gap: 10px;
|
gap: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.config-toggle-button {
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
.field-group span,
|
.field-group span,
|
||||||
.config-label {
|
.config-label {
|
||||||
color: var(--muted);
|
color: var(--muted);
|
||||||
@@ -366,6 +391,15 @@
|
|||||||
box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.12);
|
box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.12);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.field-group .sort-dropdown {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.field-group .sort-dropdown-trigger {
|
||||||
|
width: 100%;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.config-form-actions {
|
.config-form-actions {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
@@ -489,6 +523,21 @@
|
|||||||
background 160ms ease;
|
background 160ms ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sort-dropdown-trigger-label,
|
||||||
|
.sort-dropdown-option-content {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sort-dropdown-option-icon {
|
||||||
|
width: 18px;
|
||||||
|
height: 18px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
object-fit: contain;
|
||||||
|
}
|
||||||
|
|
||||||
.sort-dropdown-trigger:hover {
|
.sort-dropdown-trigger:hover {
|
||||||
border-color: rgba(100, 116, 139, 0.36);
|
border-color: rgba(100, 116, 139, 0.36);
|
||||||
}
|
}
|
||||||
@@ -848,14 +897,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 720px) {
|
@media (max-width: 720px) {
|
||||||
.config-form-layout {
|
.config-inline-row {
|
||||||
grid-template-columns: 1fr;
|
grid-template-columns: 1fr;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon-option-grid {
|
|
||||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
||||||
}
|
|
||||||
|
|
||||||
.sort-bar {
|
.sort-bar {
|
||||||
justify-content: stretch;
|
justify-content: stretch;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user