@apptegy/nuxt-navigation 0.1.24 → 0.1.25
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/module.json +1 -1
- package/dist/module.mjs +1 -2
- package/dist/runtime/api/brand.d.ts +3 -0
- package/dist/runtime/api/brand.js +8 -0
- package/dist/runtime/components/Nav/Sidebar.vue +36 -13
- package/dist/runtime/composables/useBranding.d.ts +22 -4
- package/dist/runtime/composables/useBranding.js +15 -4
- package/package.json +1 -1
- package/dist/runtime/plugins/branding.d.ts +0 -2
- package/dist/runtime/plugins/branding.js +0 -12
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineNuxtModule, createResolver, addComponentsDir, addImportsDir
|
|
1
|
+
import { defineNuxtModule, createResolver, addComponentsDir, addImportsDir } from '@nuxt/kit';
|
|
2
2
|
|
|
3
3
|
const module = defineNuxtModule({
|
|
4
4
|
meta: {
|
|
@@ -8,7 +8,6 @@ const module = defineNuxtModule({
|
|
|
8
8
|
const resolver = createResolver(import.meta.url);
|
|
9
9
|
addComponentsDir({ path: resolver.resolve("runtime/components") });
|
|
10
10
|
addImportsDir(resolver.resolve("runtime/composables"));
|
|
11
|
-
addPlugin({ src: resolver.resolve("runtime/plugins/branding") });
|
|
12
11
|
nuxt.hook("nitro:config", async (nitroConfig) => {
|
|
13
12
|
nitroConfig.publicAssets ||= [];
|
|
14
13
|
nitroConfig.publicAssets.push({
|
|
@@ -17,10 +17,14 @@
|
|
|
17
17
|
</a>
|
|
18
18
|
<div class="navbar--header">
|
|
19
19
|
<div class="header-actions">
|
|
20
|
-
<NuxtLink v-if="expanded" :to="homepageUrl">
|
|
20
|
+
<NuxtLink v-if="expanded" class="no-link-style" :to="homepageUrl">
|
|
21
21
|
<slot name="logo">
|
|
22
22
|
<div class="navbar--logo">
|
|
23
23
|
<img :src="brandLogo">
|
|
24
|
+
<div v-if="!brand?.hide_school_name">
|
|
25
|
+
<div class="school-name"> {{ brand?.school_name }} </div>
|
|
26
|
+
<div v-if="brand?.school_tag_line" class="school-tag">{{ brand.school_tag_line }}</div>
|
|
27
|
+
</div>
|
|
24
28
|
</div>
|
|
25
29
|
</slot>
|
|
26
30
|
</NuxtLink>
|
|
@@ -70,12 +74,6 @@ import { useSidebar, useBranding, ref } from '#imports';
|
|
|
70
74
|
import type { IApplication, IUser } from "../../types";
|
|
71
75
|
import tsBrandLogo from '../../assets/thrillshare-logo-white.svg';
|
|
72
76
|
|
|
73
|
-
|
|
74
|
-
const { state: expanded } = useSidebar();
|
|
75
|
-
const { brand, getBrandingStyles } = useBranding();
|
|
76
|
-
|
|
77
|
-
const brandLogo = ref(brand?.logo_light || tsBrandLogo);
|
|
78
|
-
|
|
79
77
|
interface ILogo {
|
|
80
78
|
alt: string;
|
|
81
79
|
src: string;
|
|
@@ -83,6 +81,7 @@ interface ILogo {
|
|
|
83
81
|
}
|
|
84
82
|
|
|
85
83
|
interface ISidebarProps {
|
|
84
|
+
clientId: number;
|
|
86
85
|
applications: Array<IApplication>;
|
|
87
86
|
currentApplication?: IApplication['text'];
|
|
88
87
|
homepageUrl?: string;
|
|
@@ -93,7 +92,7 @@ interface ISidebarProps {
|
|
|
93
92
|
skipToContent: string;
|
|
94
93
|
}
|
|
95
94
|
|
|
96
|
-
withDefaults(defineProps<ISidebarProps>(), {
|
|
95
|
+
const props = withDefaults(defineProps<ISidebarProps>(), {
|
|
97
96
|
applications: () => [],
|
|
98
97
|
currentApplication: 'media',
|
|
99
98
|
homepageUrl: '/',
|
|
@@ -102,7 +101,7 @@ withDefaults(defineProps<ISidebarProps>(), {
|
|
|
102
101
|
impersonatedUser: () => ({
|
|
103
102
|
show: false,
|
|
104
103
|
email: "staff3@lms.com",
|
|
105
|
-
phone_number
|
|
104
|
+
phone_number: '',
|
|
106
105
|
client: "Sales Demo",
|
|
107
106
|
admin_email: '',
|
|
108
107
|
}),
|
|
@@ -112,7 +111,14 @@ withDefaults(defineProps<ISidebarProps>(), {
|
|
|
112
111
|
iconSrc: 'poweredby-icon.svg',
|
|
113
112
|
}),
|
|
114
113
|
skipToContent: '#main-content-section',
|
|
115
|
-
|
|
114
|
+
clientId: undefined,
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
const { state: expanded } = useSidebar();
|
|
118
|
+
const { brand, getBrandingStyles } = await useBranding(props.clientId);
|
|
119
|
+
|
|
120
|
+
const brandLogo = ref(brand.value?.logo_light || tsBrandLogo);
|
|
121
|
+
|
|
116
122
|
|
|
117
123
|
// Debounced Expand on Hover
|
|
118
124
|
let expandedTimer = null;
|
|
@@ -169,12 +175,29 @@ function onHoverLeave() {
|
|
|
169
175
|
height: 64px;
|
|
170
176
|
justify-content: space-between;
|
|
171
177
|
}
|
|
178
|
+
.navbar .no-link-style {
|
|
179
|
+
text-decoration: none;
|
|
180
|
+
color: inherit;
|
|
181
|
+
}
|
|
172
182
|
.navbar--logo {
|
|
173
|
-
|
|
183
|
+
display: flex;
|
|
184
|
+
align-items: center;
|
|
185
|
+
gap: 8px;
|
|
186
|
+
}
|
|
187
|
+
.navbar--logo .school-name {
|
|
188
|
+
font-size: 16px;
|
|
189
|
+
font-style: normal;
|
|
190
|
+
font-weight: 700;
|
|
191
|
+
}
|
|
192
|
+
.navbar--logo .school-tag {
|
|
193
|
+
font-size: 14px;
|
|
194
|
+
font-style: normal;
|
|
195
|
+
font-weight: 400;
|
|
174
196
|
}
|
|
175
197
|
.navbar--logo img {
|
|
176
|
-
|
|
177
|
-
|
|
198
|
+
display: inline;
|
|
199
|
+
max-height: 36px;
|
|
200
|
+
max-width: 180px;
|
|
178
201
|
}
|
|
179
202
|
.navbar--content {
|
|
180
203
|
display: flex;
|
|
@@ -1,4 +1,22 @@
|
|
|
1
|
-
export declare function useBranding(): {
|
|
2
|
-
brand:
|
|
3
|
-
getBrandingStyles:
|
|
4
|
-
|
|
1
|
+
export declare function useBranding(clientId?: number): Promise<{
|
|
2
|
+
brand: import("vue").Ref<null>;
|
|
3
|
+
getBrandingStyles: import("vue").ComputedRef<{
|
|
4
|
+
'--brand-color'?: undefined;
|
|
5
|
+
'--nav-background-color'?: undefined;
|
|
6
|
+
'--nav-text-color'?: undefined;
|
|
7
|
+
'--nav-border-colors'?: undefined;
|
|
8
|
+
'--nav-icon-background'?: undefined;
|
|
9
|
+
'--nav-icon-color'?: undefined;
|
|
10
|
+
'--nav-active-icon-background'?: undefined;
|
|
11
|
+
'--nav-active-icon-color'?: undefined;
|
|
12
|
+
} | {
|
|
13
|
+
'--brand-color': any;
|
|
14
|
+
'--nav-background-color': string;
|
|
15
|
+
'--nav-text-color': string;
|
|
16
|
+
'--nav-border-colors': string;
|
|
17
|
+
'--nav-icon-background': string;
|
|
18
|
+
'--nav-icon-color': string;
|
|
19
|
+
'--nav-active-icon-background': string;
|
|
20
|
+
'--nav-active-icon-color': string;
|
|
21
|
+
}>;
|
|
22
|
+
}>;
|
|
@@ -1,8 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { computed, ref, useRuntimeConfig } from "#imports";
|
|
2
|
+
let brand = ref(null);
|
|
3
|
+
export async function useBranding(clientId) {
|
|
4
|
+
if (clientId !== void 0) {
|
|
5
|
+
const config = useRuntimeConfig();
|
|
6
|
+
try {
|
|
7
|
+
const oidcUrl = config.public.APPTEGY_OIDC_URL || config.public.apptegyOIDCUrl;
|
|
8
|
+
const { data } = await $fetch(oidcUrl + "/api/v2/public/brand_settings/" + clientId);
|
|
9
|
+
brand.value = data;
|
|
10
|
+
} catch (e) {
|
|
11
|
+
console.error("Error fetching brand settings:", e);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
const brandPrimaryColor = computed(() => brand.value?.colors?.primary_color.hex || "#000000");
|
|
4
15
|
const getBrandingStyles = computed(() => {
|
|
5
|
-
if (!brand) return {};
|
|
16
|
+
if (!brand.value) return {};
|
|
6
17
|
return {
|
|
7
18
|
"--brand-color": brandPrimaryColor.value,
|
|
8
19
|
"--nav-background-color": "#f6f6f6",
|
package/package.json
CHANGED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { defineNuxtPlugin, useAppConfig, useRuntimeConfig } from "#imports";
|
|
2
|
-
export default defineNuxtPlugin(async (_nuxtApp) => {
|
|
3
|
-
const appConfig = useAppConfig();
|
|
4
|
-
if (!appConfig?.navigation?.branding) return;
|
|
5
|
-
const config = useRuntimeConfig();
|
|
6
|
-
const { data: brandData } = await $fetch(config.public.authUrl + "/v2/public/brand_settings");
|
|
7
|
-
return {
|
|
8
|
-
provide: {
|
|
9
|
-
branding: brandData
|
|
10
|
-
}
|
|
11
|
-
};
|
|
12
|
-
});
|