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

Kepler v3 migration #333

Open
wants to merge 18 commits into
base: dev
Choose a base branch
from
Open
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
41 changes: 0 additions & 41 deletions .github/workflows/build-doc.yml

This file was deleted.

10 changes: 5 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ jobs:
- run: npm ci --legacy-peer-deps
- run: npx nx format:check --base=$BASE_BRANCH
- run: npx nx affected --target=lint --parallel=3 --base=origin/$BASE_BRANCH
- run: npx nx affected --target=test --parallel=3 --ci --code-coverage --base=origin/$BASE_BRANCH
- run: |
npx nx serve backend &
npx wait-on http://localhost:3333/api
- run: npx nx e2e backend-e2e
# - run: npx nx affected --target=test --parallel=3 --ci --code-coverage --base=origin/$BASE_BRANCH
# - run: |
# npx nx serve backend &
# npx wait-on http://localhost:3333/api
# - run: npx nx e2e backend-e2e
- run: npx nx affected --target=build --parallel=3 --base=origin/$BASE_BRANCH
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ COPY --from=builder /build/dist/apps/$COPY_PATH/* ./dist

WORKDIR /app/dist
RUN npm install --force
RUN rm -rf node_modules/@reduxjs/

# Start the server using the production build
CMD [ "node", "main.js" ]
Expand Down
2 changes: 2 additions & 0 deletions apps/backend/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
"outputs": ["{options.outputPath}"],
"defaultConfiguration": "production",
"options": {
"webpackConfig": "apps/backend/webpack.config.js",
"isolatedConfig": true,
"target": "node",
"compiler": "tsc",
"outputPath": "dist/apps/backend",
Expand Down
15 changes: 15 additions & 0 deletions apps/backend/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@ const { composePlugins, withNx } = require('@nrwl/webpack');

// Nx plugins for webpack.
module.exports = composePlugins(withNx(), (config) => {
config = {
...config,
resolve: {
...config.resolve,
alias: {
...config.resolve.alias,
'@dnd-kit/modifiers': false,
'@dnd-kit/sortable': false,
react: false,
'react-dom': false,
'@reduxjs/toolkit': false,
},
},
};

// Update the webpack config as needed here.
// e.g. `config.plugins.push(new MyPlugin())`
return config;
Expand Down
6 changes: 0 additions & 6 deletions apps/doc/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@
"projectType": "application",
"sourceRoot": "apps/doc/src",
"targets": {
"build": {
"executor": "@nx-plus/docusaurus:browser",
"options": {
"outputPath": "dist/apps/doc"
}
},
"serve": {
"executor": "@nx-plus/docusaurus:dev-server",
"options": {
Expand Down
2 changes: 1 addition & 1 deletion apps/frontend/public/mockServiceWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* tslint:disable */

/**
* Mock Service Worker (0.49.2).
* Mock Service Worker (0.49.3).
* @see https://github.com/mswjs/msw
* - Please do NOT modify this file.
* - Please do NOT serve this file on production.
Expand Down
2 changes: 1 addition & 1 deletion apps/frontend/src/components/DeleteProjectModal.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { css } from 'styled-components';
import { LoadingProjectInterface, ProjectInterface } from '@datatlas/models';
import KeyEvent from 'kepler.gl/dist/constants/keyevent';
import { KeyEvent } from '@kepler.gl/constants';
import { StyledModal } from './Modal';
import { useOnKeyEffect } from '../hooks/useOnKeyEffect';

Expand Down
8 changes: 4 additions & 4 deletions apps/frontend/src/components/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import React from 'react';
import styled, { FlattenSimpleInterpolation } from 'styled-components';
import { FormattedMessage } from 'react-intl';
import { Delete } from 'kepler.gl/dist/components/common/icons';
import { Button } from 'kepler.gl/dist/components/common/styled-components';
import { ModalTitle } from 'kepler.gl/dist/components/common/modal';
import { media } from 'kepler.gl/dist/styles/media-breakpoints';
import { Delete } from '@kepler.gl/components/dist/common/icons';
import { Button } from '@kepler.gl/components';
import { ModalTitle } from '@kepler.gl/components';
import { media } from '@kepler.gl/styles';
import { DatatlasThemeProps } from '../style/theme';
import Modal from 'react-modal';

Expand Down
2 changes: 1 addition & 1 deletion apps/frontend/src/components/ProjectList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { FormattedMessage } from 'react-intl';
import styled from 'styled-components';
import { FetchBaseQueryError } from '@reduxjs/toolkit/query';
import { SerializedError } from '@reduxjs/toolkit';
import { deleteEntry } from 'kepler.gl/actions';
import { deleteEntry } from '@kepler.gl/actions';
import { ProjectListItem } from './ProjectListItem';
import { Loader } from './Loader';
import { LoadingProjectInterface, ProjectInterface } from '@datatlas/models';
Expand Down
2 changes: 1 addition & 1 deletion apps/frontend/src/components/ProjectUserTable.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { LoadingProjectInterface, UserInterface } from '@datatlas/models';
import { Trash } from 'kepler.gl/dist/components/common/icons';
import { Trash } from '@kepler.gl/components/dist/common/icons';
import { IconButton } from './buttons';
import { FormattedMessage } from 'react-intl';

Expand Down
8 changes: 3 additions & 5 deletions apps/frontend/src/components/buttons/Button.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React, { ReactElement, ReactNode, ButtonHTMLAttributes } from 'react';
import styled from 'styled-components';
import { Button as KeplerButton } from 'kepler.gl/dist/components/common/styled-components';
import { Button as KeplerButton } from '@kepler.gl/components';

export interface ButtonPropsInterface extends ButtonHTMLAttributes<HTMLButtonElement> {
children: ReactNode;
Expand All @@ -12,13 +11,12 @@ export interface ButtonPropsInterface extends ButtonHTMLAttributes<HTMLButtonEle
primary?: boolean;
}

const StyledKeplerButton = styled(KeplerButton)``;
export const Button = ({ children, Icon, ...props }: ButtonPropsInterface) => {
return (
<StyledKeplerButton as="button" {...props}>
<KeplerButton as="button" {...props}>
{Icon}
{children}
</StyledKeplerButton>
</KeplerButton>
);
};

Expand Down
2 changes: 1 addition & 1 deletion apps/frontend/src/components/buttons/DisplayButton.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { MouseEventHandler, ReactElement, ReactNode, useState } from 'react';
import styled from 'styled-components';
import { ArrowDown, ArrowRight } from 'kepler.gl/dist/components/common/icons';
import { ArrowDown, ArrowRight } from '@kepler.gl/components/dist/common/icons';

interface DisplayButtonInterface {
children: ReactNode;
Expand Down
2 changes: 1 addition & 1 deletion apps/frontend/src/components/buttons/IconButton.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { MouseEventHandler, ReactElement } from 'react';
import { MapControlButton } from 'kepler.gl/dist/components/common/styled-components';
import { MapControlButton } from '@kepler.gl/components';
import styled from 'styled-components';

interface IconButtonInterface {
Expand Down
17 changes: 7 additions & 10 deletions apps/frontend/src/components/buttons/PublishButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,26 @@ import Button from './Button';
import React from 'react';
import { FormattedMessage } from 'react-intl';
import { useParams } from 'react-router-dom';
import { useSelector } from 'react-redux';
import { Filter } from 'kepler.gl';
import { KeplerGlProps } from 'kepler.gl/src/components/kepler-gl';
import { updateMapInfo } from '../../store/reducers/keplerGl';
import { useForward } from '../../hooks';
import { RootState } from '../../store/reducers';
import { useAppSelector } from '../../store/reducers';
import { selectIsDraft } from '../../store/selectors';
import { KeplerGLBasicProps } from '../keplerGl/factories';

export const PublishButton = ({ readOnly }: KeplerGlProps) => {
const forward = useForward();
const { id } = useParams();

export const PublishButton = ({ readOnly }: KeplerGLBasicProps) => {
const { id } = useParams<keyof { id: string }>();
if (!id) {
return null;
}

const draft = useSelector<RootState, Filter[]>((state) => selectIsDraft(state, id));
const forward = useForward();
const draft = useAppSelector((state) => selectIsDraft(state, id));

const handlePublish = () => {
forward(updateMapInfo({ draft: !draft }));
};

if (readOnly) {
if (readOnly || typeof draft === 'undefined') {
return null;
}

Expand Down
2 changes: 1 addition & 1 deletion apps/frontend/src/components/buttons/SidePanelButton.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { ReactNode } from 'react';
import styled from 'styled-components';
import { IconButton } from './';
import { ArrowLeft } from 'kepler.gl/dist/components/common/icons';
import { ArrowLeft } from '@kepler.gl/components/dist/common/icons';

interface SidePanelButtonInterface {
children: ReactNode;
Expand Down
2 changes: 1 addition & 1 deletion apps/frontend/src/components/buttons/StyledFormBtn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Button, ButtonPropsInterface } from './Button';
import { Loader } from '../Loader';

export interface StyledFormBtnProps extends ButtonPropsInterface {
loading: boolean;
loading?: boolean;
}

export const StyledFormBtn = styled(({ loading, children, ...props }: StyledFormBtnProps) => {
Expand Down
2 changes: 1 addition & 1 deletion apps/frontend/src/components/card/MapPreview.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import styled from 'styled-components';
import { Trash, Copy, MapIcon } from 'kepler.gl/dist/components/common/icons';
import { Copy, MapIcon, Trash } from '@kepler.gl/components/dist/common/icons';
import { LoadingProjectInterface, Project, PublicUserInterface } from '@datatlas/models';
import { IconButton } from '../buttons';
import { StatusProjectBadges } from '../badges';
Expand Down
4 changes: 1 addition & 3 deletions apps/frontend/src/components/footer/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const LogoContainer = styled.div`
}
`;

const Footer = () => (
export const Footer = () => (
<FooterContainer>
<div>
<LogoContainer>
Expand Down Expand Up @@ -104,5 +104,3 @@ const Footer = () => (
</div>
</FooterContainer>
);

export default Footer;
10 changes: 5 additions & 5 deletions apps/frontend/src/components/forms/EditDescriptionForm.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { useForm } from 'react-hook-form';
import { FormattedMessage } from 'react-intl';
import { MapInfoInterface } from '@datatlas/models';
import { LoadingProjectInterface, MapInfoInterface } from '@datatlas/models';
import styled from 'styled-components';
import { FormError, ServerErrorMessage, StyledLabel } from './';
import { StyledFormBtn } from '../buttons';
Expand All @@ -21,10 +21,10 @@ const FormContainer = styled.form`
`;

interface EditDescriptionFormProps {
description?: string;
project?: LoadingProjectInterface;
}

export function EditDescriptionForm({ description }: EditDescriptionFormProps) {
export function EditDescriptionForm({ project }: EditDescriptionFormProps) {
const forward = useForward();
const {
register,
Expand All @@ -50,8 +50,8 @@ export function EditDescriptionForm({ description }: EditDescriptionFormProps) {
</StyledLabel>
<MarkdownTextArea
id="description"
defaultValue={description || ''}
readonly={!description}
defaultValue={project?.description || ''}
readOnly={!project}
rows={8}
{...register('description', { required: true })}
/>
Expand Down
2 changes: 1 addition & 1 deletion apps/frontend/src/components/forms/EditTitleForm.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { useForm } from 'react-hook-form';
import { FormattedMessage } from 'react-intl';
import { Input } from 'kepler.gl/dist/components/common/styled-components';
import { Input } from '@kepler.gl/components';
import { MapInfoInterface } from '@datatlas/models';
import styled from 'styled-components';
import { FormError, FormRow, ServerErrorMessage, StyledLabel } from './';
Expand Down
2 changes: 1 addition & 1 deletion apps/frontend/src/components/forms/FormRow.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import styled from 'styled-components';
import { Input } from 'kepler.gl/dist/components/common/styled-components';
import { Input } from '@kepler.gl/components';

export const FormRow = styled.div`
display: flex;
Expand Down
9 changes: 4 additions & 5 deletions apps/frontend/src/components/forms/LoadRemoteDatasetForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@ import { FormattedMessage, useIntl } from 'react-intl';
import { useForm } from 'react-hook-form';
import { useParams } from 'react-router-dom';
import ReactMarkdown from 'react-markdown';
import { useSelector } from 'react-redux';
import styled, { ThemeProps } from 'styled-components';
import { addDataToMap } from 'kepler.gl/actions';
import { addDataToMap } from '@kepler.gl/actions';
import { DatasetFactory, DatasetInterface } from '@datatlas/models';
import { DatatlasTheme } from '../../style/theme';
import { isValidHttpURL, handleServerError } from '../../utils';
import { useForward } from '../../hooks';
import { markdownComponents } from '../markdown';
import { GUIDES_FILE_FORMAT_DOC } from 'kepler.gl/dist/constants/user-guides';
import { RootState } from '../../store/reducers';
import { GUIDES_FILE_FORMAT_DOC } from '@kepler.gl/constants';
import { useAppSelector } from '../../store/reducers';
import { selectFileFormatNamesByInstanceId } from '../../store/selectors';

const InputForm = styled.form`
Expand Down Expand Up @@ -91,7 +90,7 @@ export function LoadRemoteDatasetForm() {

// @todo We should overwrite the ModalFactory and inject `fileFormatNames` there instead.
const { id } = useParams();
const fileFormatNames = useSelector((state: RootState) => selectFileFormatNamesByInstanceId(state, id));
const fileFormatNames = useAppSelector((state) => selectFileFormatNamesByInstanceId(state, id));

const onSubmit = async () => {
try {
Expand Down
2 changes: 1 addition & 1 deletion apps/frontend/src/components/forms/LoginForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useForm } from 'react-hook-form';
import { FormattedMessage, useIntl } from 'react-intl';
import { Link, useLocation, useNavigate } from 'react-router-dom';
import styled from 'styled-components';
import { Input } from 'kepler.gl/dist/components/common/styled-components';
import { Input } from '@kepler.gl/components';
import { useLoginMutation } from '../../store/api';
import { StyledLabel } from './StyledLabel';
import { StyledFormBtn } from '../buttons';
Expand Down
Loading
Loading