@ampath/esm-login-app 8.0.0-next.6 → 8.0.0-next.8

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/routes.json CHANGED
@@ -1 +1 @@
1
- {"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"webservices.rest":">=2.2.0"},"pages":[{"component":"root","route":"login","online":true,"offline":true},{"component":"root","route":"logout","online":true,"offline":true},{"component":"root","route":"change-password","online":true,"offline":true}],"extensions":[{"name":"location-picker","slot":"location-picker","component":"locationPicker","online":true,"offline":true},{"name":"logout-button","slot":"user-panel-bottom-slot","component":"logoutButton","online":true,"offline":true},{"name":"password-changer","slot":"user-panel-slot","component":"changePasswordLink","online":true,"offline":true},{"name":"location-changer","slot":"top-nav-info-slot","component":"changeLocationLink","online":true,"offline":true,"order":1}],"modals":[{"name":"change-password-modal","component":"changePasswordModal"}],"version":"8.0.0-next.6"}
1
+ {"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"webservices.rest":">=2.2.0"},"pages":[{"component":"root","route":"login","online":true,"offline":true},{"component":"root","route":"logout","online":true,"offline":true},{"component":"root","route":"change-password","online":true,"offline":true}],"extensions":[{"name":"location-picker","slot":"location-picker","component":"locationPicker","online":true,"offline":true},{"name":"logout-button","slot":"user-panel-bottom-slot","component":"logoutButton","online":true,"offline":true},{"name":"password-changer","slot":"user-panel-slot","component":"changePasswordLink","online":true,"offline":true},{"name":"location-changer","slot":"top-nav-info-slot","component":"changeLocationLink","online":true,"offline":true,"order":1}],"modals":[{"name":"change-password-modal","component":"changePasswordModal"}],"version":"8.0.0-next.8"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ampath/esm-login-app",
3
- "version": "8.0.0-next.6",
3
+ "version": "8.0.0-next.8",
4
4
  "license": "MPL-2.0",
5
5
  "description": "The login microfrontend for the OpenMRS SPA",
6
6
  "browser": "dist/esm-login-app.js",
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -17,6 +17,9 @@ import styles from './login.scss';
17
17
  import { getEmail, getOtp } from '../resources/otp.resource';
18
18
  import { getOtpEnabledStatus } from '../utils/get-base-url';
19
19
  import image from '../assets/medicine.jpg';
20
+ import openmrsLogo from '../assets/openmrs.jpg';
21
+ import dhaLogo from '../assets/dha.png';
22
+ import gokLogo from '../assets/gok.png';
20
23
 
21
24
  export interface LoginReferrer {
22
25
  referrer?: string;
@@ -102,7 +105,7 @@ const Login: React.FC = () => {
102
105
  const session = sessionStore.session;
103
106
  const authenticated = sessionStore?.session?.authenticated;
104
107
 
105
- if (isOtpEnabled !== true) {
108
+ if (isOtpEnabled === true) {
106
109
  if (authenticated) {
107
110
  if (session.sessionLocation) {
108
111
  let to = loginLinks?.loginSuccess || '/home';
@@ -212,38 +215,89 @@ const Login: React.FC = () => {
212
215
  return (
213
216
  <>
214
217
  <div className={styles.wrapperContainer}>
215
- <div className={styles.container}>
216
- <Tile className={styles.loginCard}>
217
- {errorMessage && (
218
- <div className={styles.errorMessage}>
219
- <InlineNotification
220
- kind="error"
221
- subtitle={errorMessage}
222
- title={getCoreTranslation('error')}
223
- onClick={() => setErrorMessage('')}
224
- />
218
+ <div className={styles.logoContainer}>
219
+ <div className={styles.container}>
220
+ <Tile className={styles.loginCard}>
221
+ {errorMessage && (
222
+ <div className={styles.errorMessage}>
223
+ <InlineNotification
224
+ kind="error"
225
+ subtitle={errorMessage}
226
+ title={getCoreTranslation('error')}
227
+ onClick={() => setErrorMessage('')}
228
+ />
229
+ </div>
230
+ )}
231
+ <div className={styles.center}>
232
+ <Logo t={t} />
225
233
  </div>
226
- )}
227
- <div className={styles.center}>
228
- <Logo t={t} />
229
- </div>
230
- <form onSubmit={handleSubmit}>
231
- <div className={styles.inputGroup}>
232
- <TextInput
233
- id="username"
234
- type="text"
235
- name="username"
236
- autoComplete="username"
237
- labelText={t('username', 'Username')}
238
- value={username}
239
- onChange={changeUsername}
240
- ref={usernameInputRef}
241
- required
242
- autoFocus
243
- />
244
- {showPasswordOnSeparateScreen ? (
245
- <>
246
- <div className={showPasswordField ? undefined : styles.hiddenPasswordField}>
234
+ <form onSubmit={handleSubmit}>
235
+ <div className={styles.inputGroup}>
236
+ <TextInput
237
+ id="username"
238
+ type="text"
239
+ name="username"
240
+ autoComplete="username"
241
+ labelText={t('username', 'Username')}
242
+ value={username}
243
+ onChange={changeUsername}
244
+ ref={usernameInputRef}
245
+ required
246
+ autoFocus
247
+ />
248
+ {showPasswordOnSeparateScreen ? (
249
+ <>
250
+ <div className={showPasswordField ? undefined : styles.hiddenPasswordField}>
251
+ <PasswordInput
252
+ id="password"
253
+ labelText={t('password', 'Password')}
254
+ name="password"
255
+ autoComplete="current-password"
256
+ onChange={changePassword}
257
+ ref={passwordInputRef}
258
+ required
259
+ value={password}
260
+ showPasswordLabel={t('showPassword', 'Show password')}
261
+ invalidText={t('validValueRequired', 'A valid value is required')}
262
+ aria-hidden={!showPasswordField}
263
+ tabIndex={showPasswordField ? 0 : -1}
264
+ />
265
+ </div>
266
+ {showPasswordField ? (
267
+ <Button
268
+ type="submit"
269
+ className={styles.continueButton}
270
+ renderIcon={(props) => <ArrowRightIcon size={24} {...props} />}
271
+ iconDescription={t('loginButtonIconDescription', 'Log in button')}
272
+ disabled={!isLoginEnabled || isLoggingIn}
273
+ >
274
+ {isLoggingIn ? (
275
+ <InlineLoading
276
+ className={styles.loader}
277
+ description={t('loggingIn', 'Logging in') + '...'}
278
+ />
279
+ ) : (
280
+ t('login', 'Log in')
281
+ )}
282
+ </Button>
283
+ ) : (
284
+ <Button
285
+ type="submit"
286
+ className={styles.continueButton}
287
+ renderIcon={(props) => <ArrowRightIcon size={24} {...props} />}
288
+ iconDescription="Continue to password"
289
+ onClick={(evt) => {
290
+ evt.preventDefault();
291
+ continueLogin();
292
+ }}
293
+ disabled={!isLoginEnabled}
294
+ >
295
+ {t('continue', 'Continue')}
296
+ </Button>
297
+ )}
298
+ </>
299
+ ) : (
300
+ <>
247
301
  <PasswordInput
248
302
  id="password"
249
303
  labelText={t('password', 'Password')}
@@ -255,16 +309,12 @@ const Login: React.FC = () => {
255
309
  value={password}
256
310
  showPasswordLabel={t('showPassword', 'Show password')}
257
311
  invalidText={t('validValueRequired', 'A valid value is required')}
258
- aria-hidden={!showPasswordField}
259
- tabIndex={showPasswordField ? 0 : -1}
260
312
  />
261
- </div>
262
- {showPasswordField ? (
263
313
  <Button
264
314
  type="submit"
265
315
  className={styles.continueButton}
266
316
  renderIcon={(props) => <ArrowRightIcon size={24} {...props} />}
267
- iconDescription={t('loginButtonIconDescription', 'Log in button')}
317
+ iconDescription="Log in"
268
318
  disabled={!isLoginEnabled || isLoggingIn}
269
319
  >
270
320
  {isLoggingIn ? (
@@ -276,54 +326,19 @@ const Login: React.FC = () => {
276
326
  t('login', 'Log in')
277
327
  )}
278
328
  </Button>
279
- ) : (
280
- <Button
281
- type="submit"
282
- className={styles.continueButton}
283
- renderIcon={(props) => <ArrowRightIcon size={24} {...props} />}
284
- iconDescription="Continue to password"
285
- onClick={(evt) => {
286
- evt.preventDefault();
287
- continueLogin();
288
- }}
289
- disabled={!isLoginEnabled}
290
- >
291
- {t('continue', 'Continue')}
292
- </Button>
293
- )}
294
- </>
295
- ) : (
296
- <>
297
- <PasswordInput
298
- id="password"
299
- labelText={t('password', 'Password')}
300
- name="password"
301
- autoComplete="current-password"
302
- onChange={changePassword}
303
- ref={passwordInputRef}
304
- required
305
- value={password}
306
- showPasswordLabel={t('showPassword', 'Show password')}
307
- invalidText={t('validValueRequired', 'A valid value is required')}
308
- />
309
- <Button
310
- type="submit"
311
- className={styles.continueButton}
312
- renderIcon={(props) => <ArrowRightIcon size={24} {...props} />}
313
- iconDescription="Log in"
314
- disabled={!isLoginEnabled || isLoggingIn}
315
- >
316
- {isLoggingIn ? (
317
- <InlineLoading className={styles.loader} description={t('loggingIn', 'Logging in') + '...'} />
318
- ) : (
319
- t('login', 'Log in')
320
- )}
321
- </Button>
322
- </>
323
- )}
324
- </div>
325
- </form>
326
- </Tile>
329
+ </>
330
+ )}
331
+ </div>
332
+ </form>
333
+ </Tile>
334
+ </div>
335
+ <div className={styles.logoSection}>
336
+ <div className={styles.leftLogos}>
337
+ <img src={gokLogo} alt="GOK logo" className={styles.supportingLogos} />
338
+ <img src={dhaLogo} alt="DHA logo" className={styles.dhaLogo} />
339
+ </div>
340
+ <img src={openmrsLogo} alt="OpenMRS logo" className={styles.openmsrsLogo} />
341
+ </div>
327
342
  </div>
328
343
  <img className={styles.image} src={image} alt="TAIFA CARE" />
329
344
  </div>
@@ -46,13 +46,13 @@
46
46
  }
47
47
 
48
48
  .logo {
49
- margin-bottom: layout.$spacing-08;
49
+ // margin-bottom: layout.$spacing-08;
50
50
  height: layout.$spacing-11;
51
51
  width: 16rem;
52
52
  }
53
53
 
54
54
  .logoImg {
55
- margin-bottom: layout.$spacing-09;
55
+ // margin-bottom: layout.$spacing-03;
56
56
  max-width: 100%;
57
57
  }
58
58
 
@@ -179,3 +179,69 @@
179
179
  max-height: 60rem;
180
180
  object-fit: cover;
181
181
  }
182
+
183
+ .poweredBy {
184
+ display: flex;
185
+ align-items: center;
186
+ justify-self: flex-end;
187
+ font-size: 0.75rem;
188
+ color: $color-gray-70;
189
+ color: $text-02;
190
+ opacity: 0.85;
191
+ white-space: nowrap;
192
+ font-weight: bold;
193
+ margin-bottom: layout.$spacing-08;
194
+ }
195
+
196
+ .poweredByLogo {
197
+ margin-left: 0.5rem;
198
+ width: 2rem;
199
+ height: auto;
200
+ object-fit: contain;
201
+ border-radius: 0.5rem;
202
+ }
203
+
204
+ .logoContainer {
205
+ display: flex;
206
+ flex-direction: column;
207
+ }
208
+
209
+ .logoSection {
210
+ position: absolute;
211
+ bottom: layout.$spacing-06;
212
+ display: flex;
213
+ justify-content: space-between;
214
+ align-items: center;
215
+ padding: 0 layout.$spacing-06;
216
+ gap: 20rem;
217
+ }
218
+
219
+ .leftLogos {
220
+ display: flex;
221
+ flex-direction: row;
222
+ gap: 1rem;
223
+ border: 2px solid lightgray;
224
+ border-radius: 0.5rem;
225
+ }
226
+
227
+ .supportingLogos {
228
+ margin-left: 0.5rem;
229
+ width: 3rem;
230
+ height: auto;
231
+ object-fit: contain;
232
+ border-radius: 0.5rem;
233
+ }
234
+ .dhaLogo {
235
+ margin-left: 0.5rem;
236
+ width: 4rem;
237
+ height: auto;
238
+ object-fit: contain;
239
+ border-radius: 0.5rem;
240
+ }
241
+ .openmsrsLogo {
242
+ margin-left: 0.5rem;
243
+ width: 6rem;
244
+ height: auto;
245
+ object-fit: contain;
246
+ border-radius: 0.5rem;
247
+ }
@@ -3,20 +3,19 @@ import { interpolateUrl, useConfig } from '@openmrs/esm-framework';
3
3
  import { type TFunction } from 'i18next';
4
4
  import { type ConfigSchema } from './config-schema';
5
5
  import styles from './login/login.scss';
6
+ import taifaCare from './assets/Taifa-Care.png';
7
+ import amrsLogo from './assets/ampath-logo.png';
6
8
 
7
9
  const Logo: React.FC<{ t: TFunction }> = ({ t }) => {
8
10
  const { logo } = useConfig<ConfigSchema>();
9
- return logo.src ? (
10
- <img
11
- alt={logo.alt ? t(logo.alt) : t('openmrsLogo', 'OpenMRS logo')}
12
- className={styles.logoImg}
13
- src={interpolateUrl(logo.src)}
14
- />
15
- ) : (
16
- <svg role="img" className={styles.logo}>
17
- <title>{t('openmrsLogo', 'OpenMRS logo')}</title>
18
- <use href="#omrs-logo-full-color"></use>
19
- </svg>
11
+ return (
12
+ <>
13
+ <img alt={logo.alt ? t(logo.alt) : t('openmrsLogo', 'OpenMRS logo')} className={styles.logoImg} src={taifaCare} />
14
+ <span className={styles.poweredBy}>
15
+ {t('poweredBy', 'Powered by AMRS')}{' '}
16
+ <img src={amrsLogo} alt={t('taifaCare', 'TAIFA CARE logo')} className={styles.poweredByLogo} />
17
+ </span>
18
+ </>
20
19
  );
21
20
  };
22
21