@openmrs/esm-primary-navigation-app 8.0.1-pre.3371 → 8.0.1-pre.3385
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/.turbo/turbo-build.log +24 -19
- package/dist/2106.js +1 -0
- package/dist/2106.js.map +1 -0
- package/dist/3629.js +1 -1
- package/dist/3629.js.map +1 -1
- package/dist/4300.js +1 -1
- package/dist/523.js +2 -0
- package/dist/523.js.map +1 -0
- package/dist/7798.js +2 -0
- package/dist/7798.js.map +1 -0
- package/dist/8412.js +1 -0
- package/dist/8412.js.map +1 -0
- package/dist/939.js +1 -0
- package/dist/939.js.map +1 -0
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/openmrs-esm-primary-navigation-app.js +1 -1
- package/dist/openmrs-esm-primary-navigation-app.js.buildmanifest.json +93 -120
- package/dist/openmrs-esm-primary-navigation-app.js.map +1 -1
- package/dist/routes.json +1 -1
- package/package.json +6 -5
- package/src/components/change-language/change-language.modal.tsx +32 -16
- package/src/components/change-language/change-language.resource.ts +13 -11
- package/src/components/change-language/change-language.scss +14 -9
- package/src/components/change-language/change-language.test.tsx +22 -20
- package/src/components/navbar/navbar.component.tsx +0 -2
- package/src/index.ts +13 -20
- package/src/root.component.test.tsx +0 -5
- package/src/root.resource.tsx +2 -20
- package/src/routes.json +0 -8
- package/translations/en.json +2 -0
- package/dist/3047.js +0 -1
- package/dist/3047.js.map +0 -1
- package/dist/6248.js +0 -1
- package/dist/6248.js.map +0 -1
- package/dist/8145.js +0 -2
- package/dist/8145.js.map +0 -1
- package/dist/8577.js +0 -1
- package/dist/8577.js.map +0 -1
- package/dist/9.js +0 -1
- package/dist/9.js.map +0 -1
- package/dist/9287.js +0 -2
- package/dist/9287.js.map +0 -1
- package/src/components/offline-banner/offline-banner.component.tsx +0 -65
- package/src/components/offline-banner/offline-banner.scss +0 -39
- package/src/offline.ts +0 -15
- /package/dist/{8145.js.LICENSE.txt → 523.js.LICENSE.txt} +0 -0
- /package/dist/{9287.js.LICENSE.txt → 7798.js.LICENSE.txt} +0 -0
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ConnectionSignalOff } from '@carbon/react/icons';
|
|
3
|
-
import { subscribeConnectivity } from '@openmrs/esm-framework';
|
|
4
|
-
import styles from './offline-banner.scss';
|
|
5
|
-
|
|
6
|
-
const OfflineBanner: React.FC = () => {
|
|
7
|
-
const lastUpdated = useLastUpdated();
|
|
8
|
-
|
|
9
|
-
return (
|
|
10
|
-
<aside className={styles.offlineBanner}>
|
|
11
|
-
<div className={styles.offlineIconContainer}>
|
|
12
|
-
<ConnectionSignalOff size={16} />
|
|
13
|
-
</div>
|
|
14
|
-
<span className={styles.offlineNote}>Offline</span>
|
|
15
|
-
<div className={styles.offlineLastUpdatedContainer}>
|
|
16
|
-
<span className={styles.lastUpdatedNote}>Last updated: </span>
|
|
17
|
-
<span>{formatLastUpdated(lastUpdated)}</span>
|
|
18
|
-
</div>
|
|
19
|
-
</aside>
|
|
20
|
-
);
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
function formatLastUpdated(lastUpdated: Date) {
|
|
24
|
-
const date = lastUpdated.toLocaleDateString(undefined, {
|
|
25
|
-
day: 'numeric',
|
|
26
|
-
month: 'short',
|
|
27
|
-
year: 'numeric',
|
|
28
|
-
});
|
|
29
|
-
const time = lastUpdated.toLocaleTimeString(undefined, {
|
|
30
|
-
hour: '2-digit',
|
|
31
|
-
minute: '2-digit',
|
|
32
|
-
});
|
|
33
|
-
return `${date} @ ${time}`;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function useLastUpdated() {
|
|
37
|
-
const [lastUpdated, setLastUpdated] = React.useState(new Date());
|
|
38
|
-
|
|
39
|
-
const readAndSetLastUpdated = () => {
|
|
40
|
-
const value = localStorage.getItem('offline-last-updated');
|
|
41
|
-
const date = value ? new Date(value) : new Date();
|
|
42
|
-
setLastUpdated(date);
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
const writeLastUpdated = (date = new Date()) => {
|
|
46
|
-
localStorage.setItem('offline-last-updated', date.toISOString());
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
React.useEffect(() => {
|
|
50
|
-
let wasOnline: boolean | null = null;
|
|
51
|
-
|
|
52
|
-
return subscribeConnectivity(({ online }) => {
|
|
53
|
-
if (!online && wasOnline) {
|
|
54
|
-
writeLastUpdated();
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
wasOnline = online;
|
|
58
|
-
readAndSetLastUpdated();
|
|
59
|
-
});
|
|
60
|
-
}, []);
|
|
61
|
-
|
|
62
|
-
return lastUpdated;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export default OfflineBanner;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
@use '@carbon/layout';
|
|
2
|
-
@use '@openmrs/esm-styleguide/src/vars' as *;
|
|
3
|
-
|
|
4
|
-
.offlineBanner {
|
|
5
|
-
position: fixed;
|
|
6
|
-
top: 0;
|
|
7
|
-
left: 0;
|
|
8
|
-
right: 0;
|
|
9
|
-
height: var(--omrs-offline-banner-height);
|
|
10
|
-
background-color: #022b30;
|
|
11
|
-
color: white;
|
|
12
|
-
font-size: 0.875rem;
|
|
13
|
-
display: flex;
|
|
14
|
-
align-items: center;
|
|
15
|
-
z-index: 3;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.offlineIconContainer {
|
|
19
|
-
width: layout.$spacing-09;
|
|
20
|
-
display: flex;
|
|
21
|
-
justify-content: center;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.offlineNote {
|
|
25
|
-
font-weight: bold;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.offlineLastUpdatedContainer {
|
|
29
|
-
flex: auto;
|
|
30
|
-
display: flex;
|
|
31
|
-
justify-content: flex-end;
|
|
32
|
-
align-items: flex-end;
|
|
33
|
-
padding-right: layout.$spacing-05;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.lastUpdatedNote {
|
|
37
|
-
color: $color-gray-30;
|
|
38
|
-
font-size: layout.$spacing-04;
|
|
39
|
-
}
|
package/src/offline.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { SyncProcessOptions } from '@openmrs/esm-framework/src/internal';
|
|
2
|
-
import { refetchCurrentUser, getLoggedInUser } from '@openmrs/esm-framework/src/internal';
|
|
3
|
-
import { postUserPropertiesOnline } from './components/change-language/change-language.resource';
|
|
4
|
-
|
|
5
|
-
export async function syncUserLanguagePreference(_: any, options: SyncProcessOptions<any>) {
|
|
6
|
-
if (options.index === 0) {
|
|
7
|
-
const loggedInUser = await getLoggedInUser();
|
|
8
|
-
const allChanges = options.items.map(([_, change]) => change);
|
|
9
|
-
const newUserProperties = Object.assign({}, loggedInUser.userProperties, ...allChanges);
|
|
10
|
-
|
|
11
|
-
await postUserPropertiesOnline(loggedInUser.uuid, newUserProperties, options.abort);
|
|
12
|
-
|
|
13
|
-
refetchCurrentUser();
|
|
14
|
-
}
|
|
15
|
-
}
|
|
File without changes
|
|
File without changes
|