Unify the web UI on shared controls and let pipeline columns be managed on the board.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-10 01:22:24 +03:30
co-authored by Cursor
parent f1aba1b386
commit b8ad4037b6
40 changed files with 2334 additions and 788 deletions
@@ -1,5 +1,8 @@
<script setup lang="ts">
import UiFilterBar from '@/components/ui/UiFilterBar.vue';
import UiIcon from '@/components/UiIcon.vue';
import UiSegmented from '@/components/ui/UiSegmented.vue';
import UiSelect from '@/components/ui/UiSelect.vue';
export type PipelineViewMode = 'kanban' | 'list';
@@ -7,28 +10,32 @@ withDefaults(
defineProps<{
pipelineName: string;
pipelineOptions: Array<{ id: string; name: string }>;
selectedPipelineId: string;
viewMode: PipelineViewMode;
search: string;
canCreate?: boolean;
}>(),
{ canCreate: false },
);
const emit = defineEmits<{
'update:viewMode': [PipelineViewMode];
'update:search': [string];
'update:selectedPipelineId': [string];
filter: [];
create: [];
}>();
const viewMode = defineModel<PipelineViewMode>('viewMode', { required: true });
const search = defineModel<string>('search', { default: '' });
const selectedPipelineId = defineModel<string>('selectedPipelineId', { required: true });
const amountMin = defineModel<string>('amountMin', { default: '' });
const amountMax = defineModel<string>('amountMax', { default: '' });
const viewOptions = [
{ value: 'kanban' as const, label: 'نمای کاریز', icon: 'grid' as const },
{ value: 'list' as const, label: 'نمای لیست', icon: 'list' as const },
];
function onPick(value: string) {
if (value === '__create__') {
emit('create');
return;
}
emit('update:selectedPipelineId', value);
selectedPipelineId.value = value;
}
</script>
@@ -41,62 +48,37 @@ function onPick(value: string) {
<h1>{{ pipelineName }}</h1>
</div>
<div class="view-toggle" role="group" aria-label="نوع نمایش">
<button
type="button"
class="seg"
:class="{ on: viewMode === 'kanban' }"
:aria-pressed="viewMode === 'kanban'"
@click="emit('update:viewMode', 'kanban')"
>
<UiIcon name="grid" :size="16" />
<span class="seg-label">نمای کاریز</span>
</button>
<button
type="button"
class="seg"
:class="{ on: viewMode === 'list' }"
:aria-pressed="viewMode === 'list'"
@click="emit('update:viewMode', 'list')"
>
<UiIcon name="list" :size="16" />
<span class="seg-label">نمای لیست</span>
</button>
</div>
<UiSegmented v-model="viewMode" :options="viewOptions">
<template #icon="{ option }">
<UiIcon :name="option.icon ?? 'grid'" :size="16" />
</template>
</UiSegmented>
<label class="pipeline-pick">
<span class="sr">انتخاب کاریز</span>
<select
:value="selectedPipelineId"
@change="onPick(($event.target as HTMLSelectElement).value)"
<UiSelect
class="pipeline-pick"
:model-value="selectedPipelineId"
@update:model-value="onPick"
>
<option
v-for="opt in pipelineOptions"
:key="opt.id"
:value="opt.id"
>
<option
v-for="opt in pipelineOptions"
:key="opt.id"
:value="opt.id"
>
{{ opt.name }}
</option>
<option v-if="canCreate" value="__create__">کاریز جدید…</option>
</select>
<UiIcon class="chev" name="chevron" :size="16" />
</label>
{{ opt.name }}
</option>
<option v-if="canCreate" value="__create__">کاریز جدید…</option>
</UiSelect>
<label class="search">
<UiIcon name="search" :size="16" />
<span class="sr">جستجو</span>
<input
:value="search"
type="search"
placeholder="جستجو..."
@input="emit('update:search', ($event.target as HTMLInputElement).value)"
/>
</label>
<button type="button" class="filter-btn" aria-label="فیلترها" @click="emit('filter')">
<UiIcon name="filter" :size="16" />
فیلترها
</button>
<UiFilterBar v-model:search="search" class="filters">
<label class="field">
<span>حداقل مبلغ</span>
<input v-model="amountMin" type="number" min="0" placeholder="۰" />
</label>
<label class="field">
<span>حداکثر مبلغ</span>
<input v-model="amountMax" type="number" min="0" placeholder="—" />
</label>
</UiFilterBar>
</header>
</template>
@@ -120,19 +102,19 @@ function onPick(value: string) {
}
.brand-ico {
width: 2.15rem;
height: 2.15rem;
border-radius: 10px;
width: var(--control-h);
height: var(--control-h);
border-radius: var(--radius);
display: grid;
place-items: center;
background: #0f766e;
background: var(--accent-deep);
color: #fff;
flex: 0 0 auto;
}
h1 {
margin: 0;
font-size: 1.2rem;
font-size: 1.15rem;
font-weight: 800;
color: var(--ink);
overflow: hidden;
@@ -140,127 +122,25 @@ h1 {
white-space: nowrap;
}
.view-toggle {
display: inline-flex;
background: #e8eef1;
border-radius: 12px;
padding: 0.18rem;
gap: 0.12rem;
flex: 0 0 auto;
}
.seg {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 0.35rem;
border: 0;
background: transparent;
color: #7b8794;
font-weight: 700;
font-size: 0.82rem;
padding: 0.42rem 0.7rem;
border-radius: 10px;
cursor: pointer;
white-space: nowrap;
}
.seg.on {
background: #fff;
color: var(--accent);
box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}
.seg:focus-visible {
outline: 2px solid var(--accent);
outline-offset: 1px;
}
.pipeline-pick {
position: relative;
display: inline-flex;
align-items: center;
min-width: 8.5rem;
flex: 0 1 13rem;
min-width: 8.5rem;
}
.pipeline-pick select {
appearance: none;
border: 1px solid var(--line);
background: #fff;
border-radius: 12px;
padding: 0.52rem 2rem 0.52rem 0.85rem;
font: inherit;
font-weight: 600;
color: var(--ink);
width: 100%;
.filters {
flex: 1 1 12rem;
min-width: 0;
cursor: pointer;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.pipeline-pick .chev {
position: absolute;
left: 0.65rem;
pointer-events: none;
.field {
display: grid;
gap: 0.3rem;
}
.field span {
font-size: 0.8rem;
color: var(--muted);
transform: rotate(-90deg);
}
.search {
display: flex;
align-items: center;
gap: 0.45rem;
flex: 1 1 8rem;
min-width: 6.5rem;
background: #fff;
border: 1px solid var(--line);
border-radius: 12px;
padding: 0.45rem 0.75rem;
color: var(--muted);
}
.search input {
border: 0;
outline: none;
background: transparent;
width: 100%;
min-width: 0;
color: var(--ink);
font: inherit;
}
.filter-btn {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 0.35rem;
border: 0;
border-radius: 12px;
padding: 0.52rem 0.95rem;
background: var(--accent);
color: #fff;
font-weight: 700;
cursor: pointer;
white-space: nowrap;
flex: 0 0 auto;
}
.filter-btn:focus-visible,
.pipeline-pick select:focus-visible,
.search:focus-within {
outline: 2px solid var(--accent-soft);
outline-offset: 1px;
}
.sr {
position: absolute;
width: 1px;
height: 1px;
overflow: hidden;
clip: rect(0 0 0 0);
}
@container pipeline (max-width: 720px) {
@@ -272,37 +152,9 @@ h1 {
width: 100%;
}
.view-toggle {
width: 100%;
}
.seg {
flex: 1 1 0;
}
.pipeline-pick {
flex: 1 1 auto;
min-width: 0;
}
.search {
flex: 1 1 12rem;
}
}
@container pipeline (max-width: 520px) {
.seg-label {
display: none;
}
.filter-btn,
.pipeline-pick {
width: 100%;
.pipeline-pick,
.filters {
flex: 1 1 100%;
}
.filter-btn {
justify-content: center;
}
}
</style>