Skip to content

Commit a53cef3

Browse files
tnagorrafrozenhelium
authored andcommitted
Use mobile preview on information pages
- Refactor - Fix issue with zoom on url change - Remove SINERGISE key from environment
1 parent d1f66ef commit a53cef3

File tree

17 files changed

+228
-221
lines changed

17 files changed

+228
-221
lines changed

manager-dashboard/.env.example

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,5 @@ REACT_APP_COMMUNITY_DASHBOARD_URL=
1414
REACT_APP_IMAGE_BING_API_KEY=
1515
REACT_APP_IMAGE_MAPBOX_API_KEY=
1616
REACT_APP_IMAGE_MAXAR_PREMIUM_API_KEY=
17-
REACT_APP_IMAGE_SINERGISE_API_KEY=
1817
# -- NOTE: not used and seems to be discontinued
1918
REACT_APP_IMAGE_MAXAR_STANDARD_API_KEY=

manager-dashboard/app/components/ExpandableContainer/index.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,12 @@ function ExpandableContainer(props: Props) {
4848
name={!isExpanded}
4949
onClick={setIsExpanded}
5050
variant="action"
51+
title={isExpanded ? 'Collapse' : 'Expand'}
5152
>
5253
{isExpanded ? (
53-
<IoIosArrowUp className={styles.icon} />
54+
<IoIosArrowUp />
5455
) : (
55-
<IoIosArrowDown className={styles.icon} />
56+
<IoIosArrowDown />
5657
)}
5758
</Button>
5859
</div>

manager-dashboard/app/components/ExpandableContainer/styles.css

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,22 @@
1313
flex-grow: 1;
1414
}
1515

16+
.icons {
17+
display: flex;
18+
gap: var(--spacing-medium);
19+
flex-shrink: 0;
20+
21+
>* {
22+
font-size: 1.2rem;
23+
}
24+
}
25+
1626
.actions {
27+
display: flex;
28+
gap: var(--spacing-medium);
1729
flex-shrink: 0;
1830

19-
.icon {
31+
>* {
2032
font-size: 1.2rem;
2133
}
2234
}

manager-dashboard/app/components/GeoJsonPreview/index.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ function GeoJsonPreview(props: Props) {
8484
const layer = new Layer(
8585
finalUrl,
8686
{
87-
attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>',
87+
// attribution: '',
8888
// subdomains: ['a', 'b', 'c'],
8989
},
9090
);
@@ -131,7 +131,8 @@ function GeoJsonPreview(props: Props) {
131131
newGeoJson.remove();
132132
};
133133
},
134-
[geoJson],
134+
// NOTE: adding url as dependency as url will re-create the map
135+
[geoJson, url],
135136
);
136137

137138
return (

manager-dashboard/app/components/MarkdownEditor/styles.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
}
55

66
.text-area {
7-
height: 70px !important;
7+
background-color: transparent;
88
}
99

1010
.toolbar {
11-
border-bottom: 0;
12-
}
11+
background-color: transparent;
12+
}

manager-dashboard/app/components/MobilePreview/index.tsx

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,21 @@ function MobilePreview(props: Props) {
4848
)}
4949
</div>
5050
<div className={_cs(styles.content, contentClassName)}>
51-
<div className={styles.popup}>
52-
<div className={styles.details}>
53-
<div className={styles.title}>
54-
{popupTitle}
51+
{(popupTitle || popupDescription || popupIcons) && (
52+
<div className={styles.popup}>
53+
<div className={styles.details}>
54+
<div>
55+
{popupTitle}
56+
</div>
57+
<div>
58+
{popupDescription}
59+
</div>
5560
</div>
56-
<div className={styles.description}>
57-
{popupDescription}
61+
<div className={styles.icons}>
62+
{popupIcons}
5863
</div>
5964
</div>
60-
<div className={styles.icons}>
61-
{popupIcons}
62-
</div>
63-
</div>
65+
)}
6466
{children}
6567
</div>
6668
</div>

manager-dashboard/app/components/MobilePreview/styles.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131

3232
.content {
3333
position: relative;
34+
flex-grow: 1;
3435
z-index: 0;
3536
background-color: var(--color-primary);
3637

manager-dashboard/app/views/NewTutorial/InformationPageInput/Block/index.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ interface Props {
1818
onChange: (value: SetValueArg<PartialBlockType>, index: number) => void;
1919
index: number;
2020
error: Error<PartialBlockType> | undefined;
21+
disabled: boolean;
2122
}
2223

2324
export default function Block(props: Props) {
@@ -26,6 +27,7 @@ export default function Block(props: Props) {
2627
onChange,
2728
index,
2829
error: riskyError,
30+
disabled,
2931
} = props;
3032

3133
const onBlockChange = useFormObject(index, onChange, { blockNumber: 1, blockType: 'text' });
@@ -37,21 +39,23 @@ export default function Block(props: Props) {
3739
<MarkdownEditor
3840
name={'textDescription' as const}
3941
value={value?.textDescription}
40-
label="Description"
42+
label={`Block ${index + 1}`}
4143
onChange={onBlockChange}
4244
error={error?.textDescription}
45+
disabled={disabled}
4346
/>
4447
)}
4548
{value.blockType === 'image' && (
4649
<FileInput
4750
name={'imageFile' as const}
4851
value={value?.imageFile}
4952
onChange={onBlockChange}
50-
label="Upload Image"
53+
label={`Block ${index + 1}`}
5154
hint="Make sure you have the rights to
5255
use this image. It should end with .jpg or .png."
5356
accept="image/png, image/jpeg"
5457
error={error?.imageFile}
58+
disabled={disabled}
5559
/>
5660
)}
5761
</div>
Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,51 @@
11
import React from 'react';
22

33
import { PartialTutorialFormType } from '#views/NewTutorial/utils';
4+
import MobilePreview from '#components/MobilePreview';
45
import Preview from '#components/Preview';
56

67
import styles from './styles.css';
78
import MarkdownPreview from '#components/MarkdownPreview';
89

910
interface Props {
10-
value: NonNullable<PartialTutorialFormType['informationPages']>[number]
11+
value: NonNullable<PartialTutorialFormType['informationPages']>[number];
12+
index: number;
1113
}
1214

1315
export default function InformationPagePreview(props: Props) {
1416
const {
1517
value,
18+
index,
1619
} = props;
1720

1821
return (
19-
<div className={styles.informationPreview}>
20-
{value?.title && (
21-
<MarkdownPreview
22-
markdown={value.title}
23-
/>
24-
)}
22+
<MobilePreview
23+
className={styles.informationPreview}
24+
// FIXME: get this from 'look for'
25+
heading="You are looking for: mobile homes"
26+
contentClassName={styles.content}
27+
>
28+
{value?.title || `Intro ${index + 1}`}
2529
{value?.blocks?.map((preview) => {
26-
if (preview.blockType === 'text' && preview.textDescription) {
30+
if (preview.blockType === 'text' && !!preview.textDescription) {
2731
return (
28-
<div key={preview.blockNumber}>
29-
{preview.textDescription}
30-
</div>
32+
<MarkdownPreview
33+
key={preview.blockNumber}
34+
markdown={preview.textDescription}
35+
/>
3136
);
3237
}
33-
3438
if (preview.blockType === 'image') {
3539
return (
3640
<Preview
37-
className={styles.imagePreview}
3841
key={preview.blockNumber}
42+
className={styles.imagePreview}
3943
file={preview.imageFile}
4044
/>
4145
);
4246
}
43-
4447
return null;
4548
})}
46-
</div>
49+
</MobilePreview>
4750
);
4851
}

manager-dashboard/app/views/NewTutorial/InformationPageInput/InformationPagePreview/styles.css

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
.information-preview {
2-
display: flex;
3-
flex-direction: column;
4-
gap: var(--spacing-large);
2+
.content {
3+
display: flex;
4+
gap: var(--spacing-large);
5+
flex-direction: column;
6+
padding: var(--spacing-large);
7+
}
58
background-color: var(--color-primary);
6-
padding: var(--spacing-large);
79
width: var(--width-mobile-preview);
810
height: var(--height-mobile-preview);
911
overflow: auto;

0 commit comments

Comments
 (0)