@autobusal/providers 1.0.8 → 1.0.10
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/Setup/Preload.tsx +11 -0
- package/Setup/Setup.tsx +1 -11
- package/index.ts +3 -1
- package/package.json +1 -1
- package/stores/menu.ts +3 -3
package/Setup/Preload.tsx
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
1
2
|
import { Helmet } from 'react-helmet';
|
|
2
3
|
import { SettingsData } from '../types';
|
|
4
|
+
import { GetMenu } from '../services';
|
|
5
|
+
import { useMenuStore } from '../stores/menu';
|
|
3
6
|
|
|
4
7
|
interface Props {
|
|
5
8
|
data: SettingsData
|
|
@@ -8,6 +11,14 @@ interface Props {
|
|
|
8
11
|
|
|
9
12
|
// @todo: De adaugat din tema Favicons
|
|
10
13
|
const Preload = ({ data, children }: Props): JSX.Element => {
|
|
14
|
+
const { data: MenuData } = GetMenu();
|
|
15
|
+
|
|
16
|
+
const menuStore = useMenuStore();
|
|
17
|
+
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
menuStore.save(MenuData);
|
|
20
|
+
}, []);
|
|
21
|
+
|
|
11
22
|
// we arrange the font family names before inserting them
|
|
12
23
|
const fontTitle = data.theme.fontFamily.title.replace(/\ /g, '+');
|
|
13
24
|
const fontContent = data.theme.fontFamily.content.replace(/\ /g, '+');
|
package/Setup/Setup.tsx
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { useEffect } from 'react';
|
|
2
1
|
import Preload from './Preload';
|
|
3
2
|
import languages from './utilities/languages';
|
|
4
3
|
import analytics from './utilities/analytics';
|
|
5
|
-
import { GetSettings
|
|
6
|
-
import { useMenuStore } from '../stores/menu';
|
|
4
|
+
import { GetSettings } from '../services';
|
|
7
5
|
|
|
8
6
|
interface Props {
|
|
9
7
|
type: 'normal' | 'whitelabel'
|
|
@@ -13,14 +11,6 @@ interface Props {
|
|
|
13
11
|
const Setup = ({ type, children }: Props): JSX.Element => {
|
|
14
12
|
const { data } = GetSettings();
|
|
15
13
|
|
|
16
|
-
const { data: MenuData } = GetMenu();
|
|
17
|
-
|
|
18
|
-
const menuStore = useMenuStore();
|
|
19
|
-
|
|
20
|
-
useEffect(() => {
|
|
21
|
-
menuStore.save(MenuData);
|
|
22
|
-
}, []);
|
|
23
|
-
|
|
24
14
|
languages(type, data.preferences.languages.default);
|
|
25
15
|
|
|
26
16
|
analytics(data.preferences.googleAnalyticsID);
|
package/index.ts
CHANGED
package/package.json
CHANGED
package/stores/menu.ts
CHANGED
|
@@ -2,13 +2,13 @@ import { create } from 'zustand';
|
|
|
2
2
|
import { MenuData } from '../types';
|
|
3
3
|
|
|
4
4
|
export interface MenuStore {
|
|
5
|
-
|
|
5
|
+
menu: MenuData | undefined
|
|
6
6
|
save: (value: MenuData) => void
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
export const useMenuStore = create<MenuStore>((set) => ({
|
|
10
|
-
|
|
10
|
+
menu: undefined,
|
|
11
11
|
save: (value) => set(() => ({
|
|
12
|
-
|
|
12
|
+
menu: value
|
|
13
13
|
}))
|
|
14
14
|
}));
|