Skip to content

Commit

Permalink
Merge pull request #987 from mapswipe/feature/manager-dashboard/street
Browse files Browse the repository at this point in the history
Create Street project drafts with the Manager Dashboard
  • Loading branch information
ofr1tz authored Dec 19, 2024
2 parents 2a25bd8 + 8593cc8 commit 508edf8
Show file tree
Hide file tree
Showing 13 changed files with 1,334 additions and 16 deletions.
2 changes: 2 additions & 0 deletions manager-dashboard/app/Base/configs/projectTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
PROJECT_TYPE_BUILD_AREA,
PROJECT_TYPE_FOOTPRINT,
PROJECT_TYPE_CHANGE_DETECTION,
PROJECT_TYPE_STREET,
PROJECT_TYPE_COMPLETENESS,
} from '#utils/common';

Expand All @@ -15,6 +16,7 @@ const mapswipeProjectTypeOptions: {
{ value: PROJECT_TYPE_BUILD_AREA, label: 'Find' },
{ value: PROJECT_TYPE_FOOTPRINT, label: 'Validate' },
{ value: PROJECT_TYPE_CHANGE_DETECTION, label: 'Compare' },
{ value: PROJECT_TYPE_STREET, label: 'Street' },
{ value: PROJECT_TYPE_COMPLETENESS, label: 'Completeness' },
];

Expand Down
7 changes: 6 additions & 1 deletion manager-dashboard/app/Base/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,14 @@ p {
--line-height-relaxed: 1.625;
--line-height-loose: 2;


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

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

--color-background-hover-light: rgba(0, 0, 0, .04);
--width-calendar-date: 2.4rem;

--opacity-watermark: 0.3;
--color-text-disabled: rgba(0, 0, 0, .3);

}
68 changes: 68 additions & 0 deletions manager-dashboard/app/components/Calendar/CalendarDate/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import React from 'react';
import { _cs } from '@togglecorp/fujs';

import RawButton, { Props as RawButtonProps } from '../../RawButton';
import { ymdToDateString, typedMemo } from '../../../utils/common.tsx';

import styles from './styles.css';

export interface Props {
className?: string;
year: number;
month: number;
date: number;
currentYear: number;
currentMonth: number;
activeDate?: string;
currentDate: number;
onClick?: (year: number, month: number, date: number) => void;
elementRef?: RawButtonProps<undefined>['elementRef'];
ghost?: boolean;
}

function CalendarDate(props: Props) {
const {
className,
year,
month,
date,
currentYear,
currentMonth,
currentDate,
onClick,
elementRef,
activeDate,
ghost,
} = props;

const handleClick = React.useCallback(() => {
if (onClick) {
onClick(year, month, date);
}
}, [year, month, date, onClick]);

const dateString = ymdToDateString(year, month, date);

return (
<RawButton
elementRef={elementRef}
name={date}
className={_cs(
styles.date,
year === currentYear
&& month === currentMonth
&& currentDate === date
&& styles.today,
dateString === activeDate && styles.active,
ghost && styles.ghost,
className,
)}
onClick={handleClick}
>
{date}
</RawButton>

);
}

export default typedMemo(CalendarDate);
25 changes: 25 additions & 0 deletions manager-dashboard/app/components/Calendar/CalendarDate/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
.date {
border-radius: 50%;
width: var(--width-calendar-date);
height: var(--width-calendar-date);

&.today {
color: var(--color-accent);
font-weight: var(--font-weight-bold);
}

&:hover {
background-color: var(--color-background-hover-light);
}

&.active {
background-color: var(--color-accent);
color: var(--color-text-on-dark);
pointer-events: none;
}

&.ghost {
opacity: 0.5;
}
}

Loading

0 comments on commit 508edf8

Please sign in to comment.