Skip to content

Commit 24ca25c

Browse files
committed
Split dropdown of versions
1 parent 1a8dfb3 commit 24ca25c

3 files changed

Lines changed: 69 additions & 10 deletions

File tree

src-svelte/Dropdown.svelte

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,16 @@
122122
<div class="dropdown-menu">
123123
<div class="dropdown-content">
124124
{#each items as item}
125-
<button
126-
class="dropdown-item"
127-
onclick={() => handleSelect(item)}
128-
>
129-
{item}
130-
</button>
125+
{#if item === '---'}
126+
<div class="dropdown-divider"></div>
127+
{:else}
128+
<button
129+
class="dropdown-item"
130+
onclick={() => handleSelect(item)}
131+
>
132+
{item}
133+
</button>
134+
{/if}
131135
{/each}
132136
</div>
133137
</div>
@@ -231,6 +235,12 @@
231235
opacity: 0.8;
232236
}
233237
238+
.dropdown-divider {
239+
height: 1px;
240+
margin: 6px 0;
241+
background-color: #e4e7ed;
242+
}
243+
234244
/* Custom scrollbar styling */
235245
.dropdown-content::-webkit-scrollbar {
236246
width: 6px;

src/components/HeaderNav.vue

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,27 @@ const loginUsername = ref('')
5151
const logoffurl = ref('')
5252
const obpApiVersions = ref(inject(obpApiActiveVersionsKey)!)
5353
const obpMessageDocs = ref(Object.keys(inject(obpGroupedMessageDocsKey)!))
54+
55+
// Split versions into main and other
56+
const mainVersions = ['BGv1.3', 'OBPv5.1.0', 'OBPv6.0.0', 'UKv3.1', 'dynamic-endpoints', 'dynamic-entities', 'OBPdynamic-endpoint', 'OBPdynamic-entity']
57+
const sortedVersions = computed(() => {
58+
const all = obpApiVersions.value || []
59+
console.log('All available versions:', all)
60+
const main = mainVersions.filter(v => all.includes(v))
61+
console.log('Main versions found:', main)
62+
const others = all.filter(v => !mainVersions.includes(v)).sort()
63+
console.log('Other versions:', others)
64+
65+
// Only add divider if we have both main and other versions
66+
if (main.length > 0 && others.length > 0) {
67+
return [...main, '---', ...others]
68+
} else if (main.length > 0) {
69+
return main
70+
} else {
71+
return others
72+
}
73+
})
74+
5475
const isShowLoginButton = ref(true)
5576
const isShowLogOffButton = ref(false)
5677
const logo = ref(logoSource)
@@ -78,6 +99,12 @@ const setActive = (target: HTMLElement | null) => {
7899
79100
const handleMore = (command: string) => {
80101
console.log('handleMore called with command:', command)
102+
103+
// Ignore divider
104+
if (command === '---') {
105+
return
106+
}
107+
81108
let element = document.getElementById("selected-api-version")
82109
if (element !== null) {
83110
element.textContent = command;
@@ -153,7 +180,7 @@ const getCurrentPath = () => {
153180
class="menu-right"
154181
id="header-nav-versions"
155182
label="Versions"
156-
:items="obpApiVersions"
183+
:items="sortedVersions"
157184
:hover-color="headerLinksHoverColor"
158185
:background-color="headerLinksBackgroundColor"
159186
@select="handleMore"

src/views/MessageDocsView.vue

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,13 @@ function showDependentEndpoints(value: any) {
7777
<el-main class="message-docs-content">
7878
<el-scrollbar>
7979
<el-backtop :right="100" :bottom="100" />
80+
<div class="message-docs-header">
81+
<h1>{{ connector }}</h1>
82+
<p class="connector-subtitle">Message Docs</p>
83+
</div>
8084
<div v-for="(group, key) of messageDocs" :key="key">
8185
<div v-for="(value, key) of group" :key="value">
8286
<el-divider></el-divider>
83-
<header>
84-
85-
</header>
8687
<a v-bind:href="`#${value.process}`" :id="value.process">
8788
<h2>{{ value.process }}</h2>
8889
</a>
@@ -251,4 +252,25 @@ div {
251252
.content :deep(a):hover {
252253
background-color: #39455f;
253254
}
255+
256+
.message-docs-header {
257+
padding: 20px 0;
258+
border-bottom: 2px solid #e4e7ed;
259+
margin-bottom: 20px;
260+
}
261+
262+
.message-docs-header h1 {
263+
font-size: 1.75rem;
264+
font-weight: 600;
265+
color: #303133;
266+
margin: 0 0 0.5rem 0;
267+
word-wrap: break-word;
268+
overflow-wrap: break-word;
269+
}
270+
271+
.connector-subtitle {
272+
font-size: 1rem;
273+
color: #909399;
274+
margin: 0;
275+
}
254276
</style>

0 commit comments

Comments
 (0)