Skip to content

Commit ed50bb5

Browse files
authored
Merge pull request #1741 from IFRCGo/project/sdt-url
Add sdt url in the tools section under learn menu
2 parents c3e23fa + cfb4731 commit ed50bb5

File tree

12 files changed

+125
-54
lines changed

12 files changed

+125
-54
lines changed

.changeset/forty-rivers-tickle.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"go-web-app": minor
3+
---
4+
5+
Add link to SDT in the tools section under learn menu

app/env.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export default defineConfig({
2020
APP_MAPBOX_ACCESS_TOKEN: Schema.string(),
2121
APP_TINY_API_KEY: Schema.string(),
2222
APP_RISK_API_ENDPOINT: Schema.string({ format: 'url', protocol: true }),
23+
APP_SDT_URL: Schema.string.optional({ format: 'url', protocol: true, tld: false }),
2324
APP_SENTRY_DSN: Schema.string.optional(),
2425
APP_SENTRY_TRACES_SAMPLE_RATE: Schema.number.optional(),
2526
APP_SENTRY_REPLAYS_SESSION_SAMPLE_RATE: Schema.number.optional(),

app/src/components/Navbar/i18n.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@
6868
"userMenuPERCatalogueItem":"PER Catalogue of Resources",
6969
"userMenuPERCatalogueItemDescription":"PER Catalogue of Resources contains resource relevant to strengthening resource and capacity.",
7070
"userMenuGoResourcesItem":"GO Resources",
71-
"userMenuGoResourcesItemDescription":"Find all relevant user guides, references videos, IFRC other resources, and GO contacts on this page."
71+
"userMenuGoResourcesItemDescription":"Find all relevant user guides, references videos, IFRC other resources, and GO contacts on this page.",
72+
"userMenuSurveyDesignToolItem":"Survey Design Tool",
73+
"userMenuSurveyDesignToolItemDescription": "Build standardised needs assessment surveys quickly and efficiently and publish them in IFRC KoboToolbox."
7274
}
7375
}

app/src/components/Navbar/index.tsx

Lines changed: 82 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,20 @@ import {
99
Tabs,
1010
} from '@ifrc-go/ui';
1111
import { useTranslation } from '@ifrc-go/ui/hooks';
12-
import { _cs } from '@togglecorp/fujs';
12+
import {
13+
_cs,
14+
isTruthyString,
15+
} from '@togglecorp/fujs';
1316

1417
import goLogo from '#assets/icons/go-logo-2020.svg';
1518
import KeywordSearchSelectInput from '#components/domain/KeywordSearchSelectInput';
1619
import DropdownMenuItem from '#components/DropdownMenuItem';
1720
import Link from '#components/Link';
1821
import NavigationTab from '#components/NavigationTab';
19-
import { environment } from '#config';
22+
import {
23+
environment,
24+
sdtUrl,
25+
} from '#config';
2026
import useAuth from '#hooks/domain/useAuth';
2127

2228
import AuthenticatedUserDropdown from './AuthenticatedUserDropdown';
@@ -441,68 +447,94 @@ function Navbar(props: Props) {
441447
name="operational-learning"
442448
className={styles.optionDetail}
443449
>
444-
<DropdownMenuItem
445-
type="link"
446-
to="operationalLearning"
447-
variant="tertiary"
448-
>
449-
{strings.userMenuOperationalLearning}
450-
</DropdownMenuItem>
451-
<div className={styles.description}>
452-
{strings.userMenuOperationalLearningDescription}
450+
<div className={styles.menuItemWithDescription}>
451+
<DropdownMenuItem
452+
type="link"
453+
to="operationalLearning"
454+
variant="tertiary"
455+
>
456+
{strings.userMenuOperationalLearning}
457+
</DropdownMenuItem>
458+
<div className={styles.description}>
459+
{strings.userMenuOperationalLearningDescription}
460+
</div>
453461
</div>
454462
</TabPanel>
455463
<TabPanel
456464
name="tools"
457465
className={styles.optionDetail}
458466
>
459-
<DropdownMenuItem
460-
type="link"
461-
to="surgeOperationalToolbox"
462-
variant="tertiary"
463-
>
464-
{strings.userMenuOperationalToolboxItem}
465-
</DropdownMenuItem>
466-
<div className={styles.description}>
467-
{strings.userMenuOperationalToolboxItemDescription}
467+
<div className={styles.menuItemWithDescription}>
468+
<DropdownMenuItem
469+
type="link"
470+
to="surgeOperationalToolbox"
471+
variant="tertiary"
472+
>
473+
{strings.userMenuOperationalToolboxItem}
474+
</DropdownMenuItem>
475+
<div className={styles.description}>
476+
{strings.userMenuOperationalToolboxItemDescription}
477+
</div>
468478
</div>
479+
{isTruthyString(sdtUrl) && (
480+
<div className={styles.menuItemWithDescription}>
481+
<DropdownMenuItem
482+
type="link"
483+
external
484+
href={sdtUrl}
485+
variant="tertiary"
486+
withLinkIcon
487+
>
488+
{strings.userMenuSurveyDesignToolItem}
489+
</DropdownMenuItem>
490+
<div className={styles.description}>
491+
{strings.userMenuSurveyDesignToolItemDescription}
492+
</div>
493+
</div>
494+
)}
469495
</TabPanel>
470496
<TabPanel
471497
name="resources"
472498
className={styles.optionDetail}
473499
>
474-
<DropdownMenuItem
475-
type="link"
476-
to="surgeCatalogueLayout"
477-
variant="tertiary"
478-
state={{ earlyWarning: true }}
479-
>
480-
{strings.userMenuCatalogueSurgeServicesItem}
481-
</DropdownMenuItem>
482-
<div className={styles.description}>
483-
{strings.userMenuCatalogueSurgeServicesItem}
500+
<div className={styles.menuItemWithDescription}>
501+
<DropdownMenuItem
502+
type="link"
503+
to="surgeCatalogueLayout"
504+
variant="tertiary"
505+
state={{ earlyWarning: true }}
506+
>
507+
{strings.userMenuCatalogueSurgeServicesItem}
508+
</DropdownMenuItem>
509+
<div className={styles.description}>
510+
{strings.userMenuCatalogueSurgeServicesItem}
511+
</div>
484512
</div>
485-
<DropdownMenuItem
486-
type="link"
487-
to="preparednessGlobalCatalogue"
488-
variant="tertiary"
489-
state={{ earlyWarning: true }}
490-
>
491-
{strings.userMenuPERCatalogueItem}
492-
</DropdownMenuItem>
493-
<div className={styles.description}>
494-
{strings.userMenuPERCatalogueItemDescription}
513+
<div className={styles.menuItemWithDescription}>
514+
<DropdownMenuItem
515+
type="link"
516+
to="preparednessGlobalCatalogue"
517+
variant="tertiary"
518+
state={{ earlyWarning: true }}
519+
>
520+
{strings.userMenuPERCatalogueItem}
521+
</DropdownMenuItem>
522+
<div className={styles.description}>
523+
{strings.userMenuPERCatalogueItemDescription}
524+
</div>
495525
</div>
496-
<DropdownMenuItem
497-
type="link"
498-
to="resources"
499-
variant="tertiary"
500-
state={{ earlyWarning: true }}
501-
>
502-
{strings.userMenuGoResourcesItem}
503-
</DropdownMenuItem>
504-
<div className={styles.description}>
505-
{strings.userMenuGoResourcesItemDescription}
526+
<div className={styles.menuItemWithDescription}>
527+
<DropdownMenuItem
528+
type="link"
529+
to="resources"
530+
variant="tertiary"
531+
state={{ earlyWarning: true }}
532+
>
533+
{strings.userMenuGoResourcesItem}
534+
</DropdownMenuItem>
535+
<div className={styles.description}>
536+
{strings.userMenuGoResourcesItemDescription}
537+
</div>
506538
</div>
507539
</TabPanel>
508540
</Tabs>

app/src/components/Navbar/styles.module.css

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,15 @@
2929
overflow: auto;
3030
gap: var(--go-ui-spacing-sm);
3131

32-
.description {
33-
color: var(--go-ui-color-text-light);
34-
font-size: var(--go-ui-font-size-sm);
32+
.menu-item-with-description {
33+
display: flex;
34+
flex-direction: column;
35+
gap: var(--go-ui-spacing-2xs);
36+
37+
.description {
38+
color: var(--go-ui-color-text-light);
39+
font-size: var(--go-ui-font-size-sm);
40+
}
3541
}
3642
}
3743

app/src/config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const {
66
APP_MAPBOX_ACCESS_TOKEN,
77
APP_TINY_API_KEY,
88
APP_RISK_API_ENDPOINT,
9+
APP_SDT_URL,
910
APP_SENTRY_DSN,
1011
APP_SENTRY_TRACES_SAMPLE_RATE,
1112
APP_SENTRY_REPLAYS_SESSION_SAMPLE_RATE,
@@ -28,6 +29,8 @@ export const api = APP_API_ENDPOINT;
2829
export const adminUrl = APP_ADMIN_URL ?? `${api}admin/`;
2930
export const mbtoken = APP_MAPBOX_ACCESS_TOKEN;
3031
export const riskApi = APP_RISK_API_ENDPOINT;
32+
export const sdtUrl = APP_SDT_URL;
33+
3134
export const tinyApiKey = APP_TINY_API_KEY;
3235
export const sentryAppDsn = APP_SENTRY_DSN;
3336
export const sentryTracesSampleRate = APP_SENTRY_TRACES_SAMPLE_RATE;

nginx-serve/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ ENV APP_MAPBOX_ACCESS_TOKEN=APP_MAPBOX_ACCESS_TOKEN_PLACEHOLDER
3636
ENV APP_TINY_API_KEY=APP_TINY_API_KEY_PLACEHOLDER
3737
ENV APP_API_ENDPOINT=https://APP-API-ENDPOINT-PLACEHOLDER.COM/
3838
ENV APP_RISK_API_ENDPOINT=https://APP-RISK-API-ENDPOINT-PLACEHOLDER.COM/
39+
ENV APP_SDT_URL=https://APP-SDT-URL-PLACEHOLDER.COM/
3940
ENV APP_SENTRY_DSN=https://APP-SENTRY-DSN-PLACEHOLDER.COM
4041

4142
# Static configs (Configured when building docker image)

nginx-serve/apply-config.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ find "$DESTINATION_DIRECTORY" -type f -exec sed -i "s|\<APP_TINY_API_KEY_PLACEHO
3232
find "$DESTINATION_DIRECTORY" -type f -exec sed -i "s|\<https://APP-API-ENDPOINT-PLACEHOLDER.COM/|$APP_API_ENDPOINT|g" {} +
3333
# NOTE: We don't need a word boundary at end as we already have a trailing slash
3434
find "$DESTINATION_DIRECTORY" -type f -exec sed -i "s|\<https://APP-RISK-API-ENDPOINT-PLACEHOLDER.COM/|$APP_RISK_API_ENDPOINT|g" {} +
35+
find "$DESTINATION_DIRECTORY" -type f -exec sed -i "s|\<https://APP-SDT-URL-PLACEHOLDER.COM/|$APP_SDT_URL|g" {} +
3536
find "$DESTINATION_DIRECTORY" -type f -exec sed -i "s|\<https://APP-SENTRY-DSN-PLACEHOLDER.COM\>|$APP_SENTRY_DSN|g" {} +
3637

3738
# Show diffs (Useful to debug issues)

nginx-serve/helm/templates/configmap.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ data:
1313
APP_MAPBOX_ACCESS_TOKEN: {{ required "env.APP_MAPBOX_ACCESS_TOKEN" .Values.env.APP_MAPBOX_ACCESS_TOKEN | quote }}
1414
APP_TINY_API_KEY: {{ required "env.APP_TINY_API_KEY" .Values.env.APP_TINY_API_KEY | quote }}
1515
APP_RISK_API_ENDPOINT: {{ required "env.APP_RISK_API_ENDPOINT" .Values.env.APP_RISK_API_ENDPOINT | quote }}
16+
APP_SDT_URL: {{ required "env.APP_SDT_URL" .Values.env.APP_SDT_URL | quote }}
1617
APP_SENTRY_DSN: {{ required "env.APP_SENTRY_DSN" .Values.env.APP_SENTRY_DSN | quote }}

nginx-serve/helm/values-test.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ env:
1414
APP_TINY_API_KEY: RANDOM_DUMMY_TOKEN
1515
APP_RISK_API_ENDPOINT: https://risk-1-api.test.com
1616
APP_SENTRY_DSN: https://random-token@[email protected]/10000
17+
APP_SDT_URL: https://alpha-1-sdt.test.com

0 commit comments

Comments
 (0)