Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REFACTOR] Import fixes needed for the Next.js instance #1222

Merged
merged 2 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/scripts/components/common/card/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { lazy, MouseEventHandler } from 'react';
import styled, { css } from 'styled-components';
import { format } from 'date-fns';
import format from 'date-fns/format';
import { CollecticonExpandTopRight } from '@devseed-ui/collecticons';
import {
glsp,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import {
VectorSourceImpl
} from 'mapbox-gl';
import { useTheme } from 'styled-components';
import { endOfDay, startOfDay } from 'date-fns';
import endOfDay from 'date-fns/endOfDay';
import startOfDay from 'date-fns/startOfDay';

import centroid from '@turf/centroid';
import { LngLatLike } from 'react-map-gl';
import { Feature } from 'geojson';
Expand Down
2 changes: 1 addition & 1 deletion app/scripts/components/common/page-footer.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import T from 'prop-types';
import styled from 'styled-components';
import { format } from 'date-fns';
import format from 'date-fns/format';

import {
glsp,
Expand Down
4 changes: 2 additions & 2 deletions app/scripts/components/common/page-hero.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { format } from 'date-fns';
import format from 'date-fns/format';
import styled, { css } from 'styled-components';

import {
Expand Down Expand Up @@ -67,7 +67,7 @@ const PageHeroInner = styled(Constrainer)`
padding-top: ${variableGlsp(4)};
padding-bottom: ${variableGlsp(2)};
align-items: end;

/** The constrainer's padding was going over the imagine attribution icon
* causing it not to work. We remove the pointer events from it and add them
* again to the descendants. */
Expand Down
2 changes: 1 addition & 1 deletion app/scripts/components/common/pub-date.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { format } from 'date-fns';
import format from 'date-fns/format';

function PublishedDate(props: { date: Date }) {
const { date } = props;
Expand Down
3 changes: 2 additions & 1 deletion app/scripts/components/exploration/atoms/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { extent } from 'd3';
import { PrimitiveAtom, useAtom, useAtomValue, useSetAtom } from 'jotai';

import { focusAtom } from 'jotai-optics';
import { add, max } from 'date-fns';
import add from 'date-fns/add';
import max from 'date-fns/max';

import { DAY_SIZE_MAX } from '../constants';
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import React, {
useMemo
} from 'react';
import { createPortal } from 'react-dom';
import styled, {css} from 'styled-components';
import styled, { css } from 'styled-components';
import {
useFloating,
autoUpdate,
Expand All @@ -15,7 +15,7 @@ import {
shift
} from '@floating-ui/react';
import { bisector, ScaleTime, sort } from 'd3';
import { format } from 'date-fns';
import format from 'date-fns/format';
import { glsp, themeVal } from '@devseed-ui/theme-provider';

import { AnalysisTimeseriesEntry, TimeDensity, TimelineDatasetSuccess } from '../types.d.ts';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import {
endOfDay,
endOfMonth,
endOfYear,
startOfDay,
startOfMonth,
startOfYear,
} from 'date-fns';
import endOfDay from 'date-fns/endOfDay';
import endOfMonth from 'date-fns/endOfMonth';
import endOfYear from 'date-fns/endOfYear';
import startOfDay from 'date-fns/startOfDay';
import startOfMonth from 'date-fns/startOfMonth';
import startOfYear from 'date-fns/startOfYear';
import { TimeDensity } from '$components/exploration/types.d.ts';

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import React, { useCallback, useMemo } from 'react';
import { useAtomValue } from 'jotai';
import { Reorder, useDragControls } from 'framer-motion';
import styled, { useTheme } from 'styled-components';
import { addDays, subDays, areIntervalsOverlapping } from 'date-fns';
import addDays from 'date-fns/addDays';
import subDays from 'date-fns/subDays';
import areIntervalsOverlapping from 'date-fns/areIntervalsOverlapping';
import { useQueryClient } from '@tanstack/react-query';
import { ScaleTime } from 'd3';
import { glsp, themeVal } from '@devseed-ui/theme-provider';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import React, { forwardRef, useEffect, useRef } from 'react';
import styled, { css, useTheme } from 'styled-components';
import { drag, ScaleTime, select } from 'd3';
import { clamp, format, startOfDay } from 'date-fns';
import clamp from 'date-fns/clamp';
import format from 'date-fns/format';
import startOfDay from 'date-fns/startOfDay';
import { glsp, themeVal } from '@devseed-ui/theme-provider';

import { TIMELINE_PLAYHEAD_COLOR_LABEL, TIMELINE_PLAYHEAD_COLOR_PRIMARY, TIMELINE_PLAYHEAD_COLOR_SECONDARY, TIMELINE_PLAYHEAD_COLOR_TEXT } from './timeline-controls';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@ import {
import { glsp, themeVal } from '@devseed-ui/theme-provider';
import { Heading } from '@devseed-ui/typography';
import { select, zoom } from 'd3';
import {
add,
isAfter,
isBefore,
isWithinInterval,
max,
sub
} from 'date-fns';
import add from 'date-fns/add';
import isAfter from 'date-fns/isAfter';
import isBefore from 'date-fns/isBefore';
import max from 'date-fns/max';
import sub from 'date-fns/sub';
import startOfDay from 'date-fns/startOfDay';
import isWithinInterval from 'date-fns/isWithinInterval';
import { useAtom, useAtomValue, useSetAtom } from 'jotai';
import React, {
useCallback,
Expand Down
12 changes: 5 additions & 7 deletions app/scripts/components/exploration/data-utils.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import {
eachDayOfInterval,
eachYearOfInterval,
format,
startOfDay,
startOfYear
} from 'date-fns';
import eachDayOfInterval from 'date-fns/eachDayOfInterval';
import eachYearOfInterval from 'date-fns/eachYearOfInterval';
import format from 'date-fns/format';
import startOfDay from 'date-fns/startOfDay';
import startOfYear from 'date-fns/startOfYear';
import startOfMonth from 'date-fns/startOfMonth';
import eachMonthOfInterval from 'date-fns/eachMonthOfInterval';
import {
Expand Down
2 changes: 1 addition & 1 deletion app/scripts/components/exploration/hooks/scales-hooks.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useMemo } from 'react';
import { scaleTime } from 'd3';
import { useAtomValue } from 'jotai';
import { differenceInCalendarDays } from 'date-fns';
import differenceInCalendarDays from 'date-fns/differenceInCalendarDays';

import { timelineSizesAtom, zoomTransformAtom } from '../atoms/timeline';
import { DAY_SIZE_MAX } from '../constants';
Expand Down
14 changes: 6 additions & 8 deletions app/scripts/utils/date.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import {
format,
isSameMonth,
isSameYear,
parse,
startOfYear,
sub
} from 'date-fns';
import format from 'date-fns/format';
import isSameMonth from 'date-fns/isSameMonth';
import isSameYear from 'date-fns/isSameYear';
import parse from 'date-fns/parse';
import startOfYear from 'date-fns/startOfYear';
import sub from 'date-fns/sub';

/**
* Create a date which matches the input date offsetting the timezone to match
Expand Down
Loading