Skip to content

Commit 508edf8

Browse files
authored
Merge pull request #987 from mapswipe/feature/manager-dashboard/street
Create Street project drafts with the Manager Dashboard
2 parents 2a25bd8 + 8593cc8 commit 508edf8

File tree

13 files changed

+1334
-16
lines changed

13 files changed

+1334
-16
lines changed

manager-dashboard/app/Base/configs/projectTypes.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {
33
PROJECT_TYPE_BUILD_AREA,
44
PROJECT_TYPE_FOOTPRINT,
55
PROJECT_TYPE_CHANGE_DETECTION,
6+
PROJECT_TYPE_STREET,
67
PROJECT_TYPE_COMPLETENESS,
78
} from '#utils/common';
89

@@ -15,6 +16,7 @@ const mapswipeProjectTypeOptions: {
1516
{ value: PROJECT_TYPE_BUILD_AREA, label: 'Find' },
1617
{ value: PROJECT_TYPE_FOOTPRINT, label: 'Validate' },
1718
{ value: PROJECT_TYPE_CHANGE_DETECTION, label: 'Compare' },
19+
{ value: PROJECT_TYPE_STREET, label: 'Street' },
1820
{ value: PROJECT_TYPE_COMPLETENESS, label: 'Completeness' },
1921
];
2022

manager-dashboard/app/Base/styles.css

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,14 @@ p {
122122
--line-height-relaxed: 1.625;
123123
--line-height-loose: 2;
124124

125-
126125
--shadow-card: 0 2px 4px -2px var(--color-shadow);
127126

128127
--duration-transition-medium: .2s;
129128

129+
--color-background-hover-light: rgba(0, 0, 0, .04);
130+
--width-calendar-date: 2.4rem;
131+
132+
--opacity-watermark: 0.3;
133+
--color-text-disabled: rgba(0, 0, 0, .3);
134+
130135
}
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
import React from 'react';
2+
import { _cs } from '@togglecorp/fujs';
3+
4+
import RawButton, { Props as RawButtonProps } from '../../RawButton';
5+
import { ymdToDateString, typedMemo } from '../../../utils/common.tsx';
6+
7+
import styles from './styles.css';
8+
9+
export interface Props {
10+
className?: string;
11+
year: number;
12+
month: number;
13+
date: number;
14+
currentYear: number;
15+
currentMonth: number;
16+
activeDate?: string;
17+
currentDate: number;
18+
onClick?: (year: number, month: number, date: number) => void;
19+
elementRef?: RawButtonProps<undefined>['elementRef'];
20+
ghost?: boolean;
21+
}
22+
23+
function CalendarDate(props: Props) {
24+
const {
25+
className,
26+
year,
27+
month,
28+
date,
29+
currentYear,
30+
currentMonth,
31+
currentDate,
32+
onClick,
33+
elementRef,
34+
activeDate,
35+
ghost,
36+
} = props;
37+
38+
const handleClick = React.useCallback(() => {
39+
if (onClick) {
40+
onClick(year, month, date);
41+
}
42+
}, [year, month, date, onClick]);
43+
44+
const dateString = ymdToDateString(year, month, date);
45+
46+
return (
47+
<RawButton
48+
elementRef={elementRef}
49+
name={date}
50+
className={_cs(
51+
styles.date,
52+
year === currentYear
53+
&& month === currentMonth
54+
&& currentDate === date
55+
&& styles.today,
56+
dateString === activeDate && styles.active,
57+
ghost && styles.ghost,
58+
className,
59+
)}
60+
onClick={handleClick}
61+
>
62+
{date}
63+
</RawButton>
64+
65+
);
66+
}
67+
68+
export default typedMemo(CalendarDate);
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
.date {
2+
border-radius: 50%;
3+
width: var(--width-calendar-date);
4+
height: var(--width-calendar-date);
5+
6+
&.today {
7+
color: var(--color-accent);
8+
font-weight: var(--font-weight-bold);
9+
}
10+
11+
&:hover {
12+
background-color: var(--color-background-hover-light);
13+
}
14+
15+
&.active {
16+
background-color: var(--color-accent);
17+
color: var(--color-text-on-dark);
18+
pointer-events: none;
19+
}
20+
21+
&.ghost {
22+
opacity: 0.5;
23+
}
24+
}
25+

0 commit comments

Comments
 (0)