@triptease/tt-navbar 0.0.40 → 0.0.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/NavbarController.d.ts +2 -1
- package/dist/src/NavbarController.js +6 -5
- package/dist/src/NavbarController.js.map +1 -1
- package/dist/src/TtNavbar.js +20 -19
- package/dist/src/TtNavbar.js.map +1 -1
- package/dist/test/tt-navbar.test.js +1 -0
- package/dist/test/tt-navbar.test.js.map +1 -1
- package/dist/web/NavbarController.js +7 -6
- package/dist/web/NavbarController.js.map +2 -2
- package/dist/web/Routes.js +1 -1
- package/dist/web/TtNavbar.js +23 -23
- package/dist/web/TtNavbar.js.map +2 -2
- package/dist/web/global.d.js +1 -1
- package/dist/web/index.js +23 -23
- package/dist/web/index.js.map +2 -2
- package/dist/web/styles.js +1 -1
- package/dist/web/triptease-logo.js +1 -1
- package/dist/web/tt-navbar.js +23 -23
- package/dist/web/tt-navbar.js.map +2 -2
- package/dist/web/urlMappings.js +1 -1
- package/package.json +1 -1
- package/src/NavbarController.ts +7 -5
- package/src/TtNavbar.ts +23 -22
- package/test/tt-navbar.test.ts +1 -0
package/dist/web/urlMappings.js
CHANGED
package/package.json
CHANGED
package/src/NavbarController.ts
CHANGED
|
@@ -5,6 +5,8 @@ export class NavbarController implements ReactiveController {
|
|
|
5
5
|
|
|
6
6
|
private _isOpen = true;
|
|
7
7
|
|
|
8
|
+
private _hasInitialized = false;
|
|
9
|
+
|
|
8
10
|
constructor(host: ReactiveControllerHost) {
|
|
9
11
|
(this.host = host).addController(this);
|
|
10
12
|
}
|
|
@@ -13,21 +15,21 @@ export class NavbarController implements ReactiveController {
|
|
|
13
15
|
return this._isOpen;
|
|
14
16
|
}
|
|
15
17
|
|
|
16
|
-
|
|
17
|
-
if (window.Clerk) {
|
|
18
|
+
hostUpdate() {
|
|
19
|
+
if (!this._hasInitialized && window.Clerk) {
|
|
18
20
|
const userSetting =
|
|
19
21
|
window.Clerk.user?.unsafeMetadata?.preferences?.ui?.navigationOpen;
|
|
20
22
|
|
|
21
23
|
if (userSetting !== undefined) {
|
|
22
24
|
this._isOpen = userSetting;
|
|
25
|
+
this._hasInitialized = true;
|
|
23
26
|
this.host.requestUpdate();
|
|
24
27
|
}
|
|
25
28
|
}
|
|
26
29
|
}
|
|
27
30
|
|
|
28
31
|
async toggle() {
|
|
29
|
-
|
|
30
|
-
this._isOpen = newState;
|
|
32
|
+
this._isOpen = !this._isOpen;
|
|
31
33
|
|
|
32
34
|
if (window.Clerk) {
|
|
33
35
|
await window.Clerk.user?.update({
|
|
@@ -37,7 +39,7 @@ export class NavbarController implements ReactiveController {
|
|
|
37
39
|
...window.Clerk.user?.unsafeMetadata?.preferences,
|
|
38
40
|
ui: {
|
|
39
41
|
...window.Clerk.user?.unsafeMetadata?.preferences?.ui,
|
|
40
|
-
navigationOpen:
|
|
42
|
+
navigationOpen: this.isOpen,
|
|
41
43
|
},
|
|
42
44
|
},
|
|
43
45
|
},
|
package/src/TtNavbar.ts
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
logout,
|
|
13
13
|
sidebarCollapsed,
|
|
14
14
|
user,
|
|
15
|
-
wallet
|
|
15
|
+
wallet,
|
|
16
16
|
} from '@triptease/icons';
|
|
17
17
|
import '@triptease/tt-combobox';
|
|
18
18
|
import { styles } from './styles.js';
|
|
@@ -121,10 +121,11 @@ export class TtNavbar extends LitElement {
|
|
|
121
121
|
const parsedPath = currentPath.replace(this.clientKey, '$CLIENT_KEY');
|
|
122
122
|
const mappedUrl = urlMappings[parsedPath];
|
|
123
123
|
if (mappedUrl) {
|
|
124
|
-
const clientSpecificUrl = mappedUrl.includes('$CLIENT_KEY')
|
|
124
|
+
const clientSpecificUrl = mappedUrl.includes('$CLIENT_KEY')
|
|
125
|
+
? mappedUrl.replace('$CLIENT_KEY', this.clientKey)
|
|
126
|
+
: mappedUrl;
|
|
125
127
|
const links = Object.values(this.allNavLinks);
|
|
126
128
|
bestMatch = links.find(link => link.href.includes(clientSpecificUrl));
|
|
127
|
-
console.log({ mappedUrl, clientSpecificUrl, bestMatch });
|
|
128
129
|
}
|
|
129
130
|
}
|
|
130
131
|
|
|
@@ -392,26 +393,26 @@ export class TtNavbar extends LitElement {
|
|
|
392
393
|
${
|
|
393
394
|
this.clients.length > 1
|
|
394
395
|
? html`
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
396
|
+
<tt-combobox
|
|
397
|
+
.openUpward=${true}
|
|
398
|
+
.value=${this.clientKey ? [this.clientKey] : []}
|
|
399
|
+
@change=${this.handleClientChange}
|
|
400
|
+
>
|
|
401
|
+
${this.clients.map(
|
|
402
|
+
client => html`
|
|
403
|
+
<option slot="option" value=${client.clientKey}>
|
|
404
|
+
${client.displayName}
|
|
405
|
+
</option>
|
|
406
|
+
`,
|
|
407
|
+
)}
|
|
408
|
+
</tt-combobox>
|
|
409
|
+
`
|
|
409
410
|
: html`
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
411
|
+
<div class="single-client-name">
|
|
412
|
+
${this.clients.find(m => m.clientKey === this.clientKey)
|
|
413
|
+
?.displayName}
|
|
414
|
+
</div>
|
|
415
|
+
`
|
|
415
416
|
}
|
|
416
417
|
</div>
|
|
417
418
|
<a
|