diff --git a/.gitignore b/.gitignore index 2481d170f..53c8e2ae8 100644 --- a/.gitignore +++ b/.gitignore @@ -17,7 +17,7 @@ # to fit your needs! ################################################ -app/scripts/time.json +packages/veda-ui/src/time.json node_modules bower_components diff --git a/.stylelintrc.json b/.stylelintrc.json index e75e13932..28e377ed3 100644 --- a/.stylelintrc.json +++ b/.stylelintrc.json @@ -13,9 +13,9 @@ ] }, "ignoreFiles": [ - "app/scripts/styles/variable-utils.ts", - "app/scripts/styles/hug/index.ts", - "app/scripts/styles/continuum/utils.ts", + "packages/veda-ui/src/styles/variable-utils.ts", + "packages/veda-ui/src/styles/hug/index.ts", + "packages/veda-ui/src/styles/continuum/utils.ts", "**/*.d.ts" ] } \ No newline at end of file diff --git a/app/index.html b/app/index.html index 47bb63229..72b696217 100644 --- a/app/index.html +++ b/app/index.html @@ -134,7 +134,7 @@

{{appTitle}}

} - + \ No newline at end of file diff --git a/docs/development/ARCHITECTURE.md b/docs/development/ARCHITECTURE.md index 0cd80defa..dce060a1a 100644 --- a/docs/development/ARCHITECTURE.md +++ b/docs/development/ARCHITECTURE.md @@ -83,10 +83,10 @@ To simplify file access we use aliases for the most common paths so that they ca For example, to access file inside the `styles` folder you'd use `$styles/filename` instead of having to use a relative path. This get's very handy when we have several nested folders. Currently the following aliases exist: -- `$components/` => `app/scripts/components` -- `$styles/` => `app/scripts/styles` -- `$utils/` => `app/scripts/utils` -- `$context/` => `app/scripts/context` +- `$components/` => `packages/veda-ui/src/components` +- `$styles/` => `packages/veda-ui/src/styles` +- `$utils/` => `packages/veda-ui/src/utils` +- `$context/` => `packages/veda-ui/src/context` To add a new alias, add the respecting naming and path under `alias` in the `package.json`. The test runner (Jest) also has to be made aware of the mapping, and this is done through some code in `jest.config.js` under `moduleNameMapper`. You shouldn't need to do anything there, but if things break it is a place to look at. diff --git a/gulpfile.js b/gulpfile.js index 8c5779825..84119fee7 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -29,7 +29,7 @@ process.env.APP_BUILD_TIME = Date.now(); const parcelCli = path.join(__dirname, './node_modules/parcel/lib/cli.js'); const parcelConfig = path.join(__dirname, '.parcelrc'); -const parcelLibConfig = path.join(__dirname, '.parcelrc-lib'); +const parcelLibConfig = path.join(__dirname, 'packages/veda-ui/.parcelrc-lib'); // ///////////////////////////////////////////////////////////////////////////// // ----------------------- Watcher and custom tasks --------------------------// @@ -89,7 +89,7 @@ function copyUswdsImages() { function parcelBuildLib(cb) { const args = [ 'build', - 'app/scripts/libs/index.ts', + 'packages/veda-ui/src/libs/index.ts', '--dist-dir=lib', '--config', parcelLibConfig diff --git a/jest.config.js b/jest.config.js index 551e5e217..922114058 100644 --- a/jest.config.js +++ b/jest.config.js @@ -81,9 +81,9 @@ module.exports = { // To simplify keeping the alias in sync the code below converts the aliases // defined in the package.json to module mappings: // From: - // "$styles": "~/app/scripts/styles" + // "$styles": "~/packages/veda-ui/src/styles" // To: - // '^\\$styles(.*)$': '/app/scripts/styles$1' + // '^\\$styles(.*)$': '/packages/veda-ui/src/styles$1' ...Object.entries(pkg.alias).reduce((acc, [key, value]) => { return value.startsWith('~/') ? { diff --git a/package.json b/package.json index 9896b115f..403b5c6a1 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "url": "https://github.com/NASA-IMPACT/veda-ui.git" }, "license": "Apache-2.0", - "source": "./app/scripts/index.ts", + "source": "./packages/veda-ui/src/index.ts", "main": "lib/main.js", "module": "lib/module.js", "types": "lib/index.d.ts", @@ -27,15 +27,15 @@ "clean": "gulp clean", "lint": "yarn lint:storybook && yarn lint:scripts && yarn lint:css", "lint:storybook": "eslint storybook/src/", - "lint:scripts": "eslint app/scripts/", - "lint:css": "stylelint 'app/styles/**/**' 'app/scripts/**/*.(js|ts|tsx|jsx)'", + "lint:scripts": "eslint packages/veda-ui/src/", + "lint:css": "stylelint 'packages/veda-ui/src/styles/**/**' 'packages/veda-ui/src/**/*.(js|ts|tsx|jsx)'", "ts-check": "yarn tsc --noEmit --skipLibCheck", "test": "TZ=UTC jest", "pretest:e2e": "node test/playwright/generateTestData.js", "test:e2e": "yarn playwright test", "test:e2e:ui": "yarn playwright test --ui", "release": "release-it --", - "watch:buildlib": "chokidar \"app/scripts/**/*\" -c \"yarn buildlib\" --initial", + "watch:buildlib": "chokidar \"packages/veda-ui/src/**/*\" -c \"yarn buildlib\" --initial", "storybook:install": "cd storybook && yarn install", "storybook:run": "cd storybook && yarn run storybook" }, @@ -260,15 +260,17 @@ ".*/meta/" ], "alias": { - "$components": "~/app/scripts/components", - "$styles": "~/app/scripts/styles", - "$utils": "~/app/scripts/utils", - "$types": "~/app/scripts/types", - "$context": "~/app/scripts/context", - "$data-layer": "~/app/scripts/data-layer", - "$uswds": "~/app/scripts/uswds", - "$libs": "~/app/scripts/libs", + "$components": "~/packages/veda-ui/src/components", + "$styles": "~/packages/veda-ui/src/styles", + "$utils": "~/packages/veda-ui/src/utils", + "$types": "~/packages/veda-ui/src/types", + "$context": "~/packages/veda-ui/src/context", + "$data-layer": "~/packages/veda-ui/src/data-layer", + "$uswds": "~/packages/veda-ui/src/uswds", + "$libs": "~/packages/veda-ui/src/libs", + "$graphics": "~/packages/veda-ui/graphics", "$test": "~/test", + "$mock": "~/mock", "$static": "~/static" }, "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e" diff --git a/.parcelrc-lib b/packages/veda-ui/.parcelrc-lib similarity index 60% rename from .parcelrc-lib rename to packages/veda-ui/.parcelrc-lib index d8ad865bf..175a2c015 100644 --- a/.parcelrc-lib +++ b/packages/veda-ui/.parcelrc-lib @@ -1,4 +1,4 @@ { - "extends": ["./.parcelrc"], + "extends": ["../../.parcelrc"], "resolvers": ["parcel-resolver-alias", "..."] } diff --git a/app/graphics/content/tour-analysis.gif b/packages/veda-ui/graphics/content/tour-analysis.gif similarity index 100% rename from app/graphics/content/tour-analysis.gif rename to packages/veda-ui/graphics/content/tour-analysis.gif diff --git a/app/graphics/content/tour-comparison.gif b/packages/veda-ui/graphics/content/tour-comparison.gif similarity index 100% rename from app/graphics/content/tour-comparison.gif rename to packages/veda-ui/graphics/content/tour-comparison.gif diff --git a/app/graphics/layout/root-welcome--cover.jpg b/packages/veda-ui/graphics/layout/root-welcome--cover.jpg similarity index 100% rename from app/graphics/layout/root-welcome--cover.jpg rename to packages/veda-ui/graphics/layout/root-welcome--cover.jpg diff --git a/app/graphics/layout/user-enthusiasts.jpg b/packages/veda-ui/graphics/layout/user-enthusiasts.jpg similarity index 100% rename from app/graphics/layout/user-enthusiasts.jpg rename to packages/veda-ui/graphics/layout/user-enthusiasts.jpg diff --git a/app/graphics/layout/user-researcher.jpg b/packages/veda-ui/graphics/layout/user-researcher.jpg similarity index 100% rename from app/graphics/layout/user-researcher.jpg rename to packages/veda-ui/graphics/layout/user-researcher.jpg diff --git a/app/graphics/layout/user-scientists.jpg b/packages/veda-ui/graphics/layout/user-scientists.jpg similarity index 100% rename from app/graphics/layout/user-scientists.jpg rename to packages/veda-ui/graphics/layout/user-scientists.jpg diff --git a/app/graphics/layout/vp-01-illu.png b/packages/veda-ui/graphics/layout/vp-01-illu.png similarity index 100% rename from app/graphics/layout/vp-01-illu.png rename to packages/veda-ui/graphics/layout/vp-01-illu.png diff --git a/app/graphics/layout/vp-02-illu.png b/packages/veda-ui/graphics/layout/vp-02-illu.png similarity index 100% rename from app/graphics/layout/vp-02-illu.png rename to packages/veda-ui/graphics/layout/vp-02-illu.png diff --git a/app/graphics/layout/vp-03-illu.png b/packages/veda-ui/graphics/layout/vp-03-illu.png similarity index 100% rename from app/graphics/layout/vp-03-illu.png rename to packages/veda-ui/graphics/layout/vp-03-illu.png diff --git a/app/scripts/components/about/index.tsx b/packages/veda-ui/src/components/about/index.tsx similarity index 100% rename from app/scripts/components/about/index.tsx rename to packages/veda-ui/src/components/about/index.tsx diff --git a/app/scripts/components/common/banner/banner.scss b/packages/veda-ui/src/components/common/banner/banner.scss similarity index 100% rename from app/scripts/components/common/banner/banner.scss rename to packages/veda-ui/src/components/common/banner/banner.scss diff --git a/app/scripts/components/common/banner/index.tsx b/packages/veda-ui/src/components/common/banner/index.tsx similarity index 100% rename from app/scripts/components/common/banner/index.tsx rename to packages/veda-ui/src/components/common/banner/index.tsx diff --git a/app/scripts/components/common/blocks/block-constant.js b/packages/veda-ui/src/components/common/blocks/block-constant.js similarity index 100% rename from app/scripts/components/common/blocks/block-constant.js rename to packages/veda-ui/src/components/common/blocks/block-constant.js diff --git a/app/scripts/components/common/blocks/block-map.tsx b/packages/veda-ui/src/components/common/blocks/block-map.tsx similarity index 100% rename from app/scripts/components/common/blocks/block-map.tsx rename to packages/veda-ui/src/components/common/blocks/block-map.tsx diff --git a/app/scripts/components/common/blocks/embed.tsx b/packages/veda-ui/src/components/common/blocks/embed.tsx similarity index 100% rename from app/scripts/components/common/blocks/embed.tsx rename to packages/veda-ui/src/components/common/blocks/embed.tsx diff --git a/app/scripts/components/common/blocks/figure.jsx b/packages/veda-ui/src/components/common/blocks/figure.js similarity index 100% rename from app/scripts/components/common/blocks/figure.jsx rename to packages/veda-ui/src/components/common/blocks/figure.js diff --git a/packages/veda-ui/src/components/common/blocks/figure.jsx b/packages/veda-ui/src/components/common/blocks/figure.jsx new file mode 100644 index 000000000..c7674bb5d --- /dev/null +++ b/packages/veda-ui/src/components/common/blocks/figure.jsx @@ -0,0 +1,31 @@ +import React from 'react'; +import styled from 'styled-components'; +import T from 'prop-types'; +import { figureDisplayName, captionDisplayName } from './block-constant'; +import { Figure } from '$components/common/figure'; + +const ContentBlockFigure = (props) => { + const { children } = props; + // Figure can be empty + if (children && children.length) { + const captionChild = children.filter( + (e) => e.type.displayName === captionDisplayName + ); + if (captionChild.length > 1) + throw Error('More than one caption for a figure'); + } + return
; +}; + +ContentBlockFigure.propTypes = { + children: T.node +}; + +const StyledContentBlockFigure = styled(ContentBlockFigure)` + img { + width: 100%; + } +`; +StyledContentBlockFigure.displayName = figureDisplayName; + +export default StyledContentBlockFigure; diff --git a/app/scripts/components/common/blocks/images/compare.jsx b/packages/veda-ui/src/components/common/blocks/images/compare.js similarity index 100% rename from app/scripts/components/common/blocks/images/compare.jsx rename to packages/veda-ui/src/components/common/blocks/images/compare.js diff --git a/packages/veda-ui/src/components/common/blocks/images/compare.jsx b/packages/veda-ui/src/components/common/blocks/images/compare.jsx new file mode 100644 index 000000000..0d5f8c15c --- /dev/null +++ b/packages/veda-ui/src/components/common/blocks/images/compare.jsx @@ -0,0 +1,61 @@ +import React from 'react'; +import styled from 'styled-components'; +import ReactCompareImage from 'react-compare-image'; +import T from 'prop-types'; + +import { glsp, themeVal } from '@devseed-ui/theme-provider'; + +export const MediaCompare = styled.figure` + /* Style for plugin (react compare image) */ + /* handle */ + > div { + > div:nth-child(3) > div:nth-child(2) { + background-color: ${themeVal('color.primary')}; + width: 3rem; + height: 3rem; + } + /* label */ + > div:nth-child(4) > div:nth-child(1), + > div:nth-child(5) > div:nth-child(1) { + border-radius: ${themeVal('shape.rounded')}; + } + } + + /* stylelint-disable-next-line */ + > *:not(:last-child) { + margin-bottom: ${glsp()}; + } +`; + +function CompareImage({ + leftImageSrc, + leftImageAlt, + leftImageLabel, + rightImageSrc, + rightImageAlt, + rightImageLabel +}) { + return ( + + + + ); +} + +CompareImage.propTypes = { + leftImageSrc: T.string.isRequired, + leftImageAlt: T.string.isRequired, + leftImageLabel: T.string, + rightImageSrc: T.string.isRequired, + rightImageAlt: T.string.isRequired, + rightImageLabel: T.string +}; + +export default CompareImage; diff --git a/app/scripts/components/common/blocks/images/index.jsx b/packages/veda-ui/src/components/common/blocks/images/index.js similarity index 100% rename from app/scripts/components/common/blocks/images/index.jsx rename to packages/veda-ui/src/components/common/blocks/images/index.js diff --git a/packages/veda-ui/src/components/common/blocks/images/index.jsx b/packages/veda-ui/src/components/common/blocks/images/index.jsx new file mode 100644 index 000000000..612546f53 --- /dev/null +++ b/packages/veda-ui/src/components/common/blocks/images/index.jsx @@ -0,0 +1,62 @@ +import React from 'react'; +import T from 'prop-types'; +import { + Figure, + Figcaption, + FigcaptionInner, + FigureAttribution +} from '$components/common/figure'; + +import { captionDisplayName } from '$components/common/blocks/block-constant'; + +export function Caption({ children, attrAuthor, attrUrl }) { + return ( +
+ {children && {children}} + +
+ ); +} + +Caption.displayName = captionDisplayName; + +Caption.propTypes = { + attrAuthor: T.string, + attrUrl: T.string, + children: T.node +}; + +export default function Image(props) { + // eslint-disable-next-line @typescript-eslint/no-unused-vars + const { align, caption, attrAuthor, ...propsWithoutAttrs } = props; + if (caption || attrAuthor) { + const imageAlign = align ? align : 'center'; + return ( + // if it is an inline image with a caption +
+ + + {caption} + +
+ ); + } + + const imageAlign = align ? align : 'left'; + return ( + + ); +} + +Image.propTypes = { + src: T.string, + alt: T.string, + align: T.string, + caption: T.string, + attrAuthor: T.string, + attrUrl: T.string +}; diff --git a/app/scripts/components/common/blocks/index.test.jsx b/packages/veda-ui/src/components/common/blocks/index.test.js similarity index 100% rename from app/scripts/components/common/blocks/index.test.jsx rename to packages/veda-ui/src/components/common/blocks/index.test.js diff --git a/packages/veda-ui/src/components/common/blocks/index.test.jsx b/packages/veda-ui/src/components/common/blocks/index.test.jsx new file mode 100644 index 000000000..49b9d675f --- /dev/null +++ b/packages/veda-ui/src/components/common/blocks/index.test.jsx @@ -0,0 +1,49 @@ +/** + * set up test environment for jest + * @jest-environment jsdom + */ +import React from 'react'; + +import renderWithTheme from '$test/utils'; +import Block from '$components/common/blocks/'; +import { + generalErrorMessage, + blockTypeErrorMessage, + contentTypeErrorMessage +} from '$components/common/blocks/block-constant'; +import Figure from '$components/common/blocks/figure'; +import { Caption } from '$components/common/blocks/images'; + +describe('Block edge case tests', () => { + it('Throws a content type when not supported content composition is passed', () => { + const { getByText } = renderWithTheme( + +

test

+
+ ); + expect(getByText(new RegExp(contentTypeErrorMessage, 'g'))).toBeDefined(); + }); + + it('Throws an error when a block has two captions', () => { + const { getByText } = renderWithTheme( + +
+ + +
+
+ ); + expect(getByText(new RegExp(generalErrorMessage, 'g'))).toBeDefined(); + }); + + it('Throws an error when a block has wrong type name', () => { + const { getByText } = renderWithTheme( + +
+ +
+
+ ); + expect(getByText(new RegExp(blockTypeErrorMessage, 'g'))).toBeDefined(); + }); +}); diff --git a/app/scripts/components/common/blocks/index.tsx b/packages/veda-ui/src/components/common/blocks/index.tsx similarity index 100% rename from app/scripts/components/common/blocks/index.tsx rename to packages/veda-ui/src/components/common/blocks/index.tsx diff --git a/app/scripts/components/common/blocks/lazy-components.jsx b/packages/veda-ui/src/components/common/blocks/lazy-components.js similarity index 100% rename from app/scripts/components/common/blocks/lazy-components.jsx rename to packages/veda-ui/src/components/common/blocks/lazy-components.js diff --git a/packages/veda-ui/src/components/common/blocks/lazy-components.jsx b/packages/veda-ui/src/components/common/blocks/lazy-components.jsx new file mode 100644 index 000000000..690fd5dcd --- /dev/null +++ b/packages/veda-ui/src/components/common/blocks/lazy-components.jsx @@ -0,0 +1,258 @@ +import React, { useMemo, useState, useEffect } from 'react'; +import T from 'prop-types'; +import LazyLoad from 'react-lazyload'; + +import Chart from '$components/common/chart/block'; +import { chartMaxHeight } from '$components/common/chart/constant'; + +import Table, { tableHeight } from '$components/common/table'; +import CompareImage from '$components/common/blocks/images/compare'; + +import Map, { mapHeight } from '$components/common/blocks/block-map'; +import MultiLayerMapBlock from '$components/common/blocks/multilayer-block-map'; +import Embed from '$components/common/blocks/embed'; +import { + ScrollytellingBlock, + SCROLLY_MAP_HEIGHT +} from '$components/common/blocks/scrollytelling'; + +import { LoadingSkeleton } from '$components/common/loading-skeleton'; +import { veda_faux_module_datasets } from '$data-layer/datasets'; +import { reconcileDatasets } from '$components/exploration/data-utils'; +import { getDatasetLayers } from '$utils/data-utils'; +import { useReconcileWithStacMetadata } from '$components/exploration/hooks/use-stac-metadata-datasets'; +import { DatasetStatus } from '$components/exploration/types.d.ts'; +import { useVedaUI } from '$context/veda-ui-provider'; + +const getDataLayer = (layerIndex, layers) => { + if (!layers || layers.length <= layerIndex) return null; + const layer = layers[layerIndex]; + if (layer.status !== DatasetStatus.SUCCESS) return null; + return { + ...layer, + settings: { + isVisible: true, + opacity: 100 + } + }; +}; + +const getAvailableLayers = (datasetId, datasets) => { + if (!datasetId || !datasets[datasetId]) return []; + return datasets[datasetId]?.data?.layers || []; +}; + +export function useMapLayers( + datasetId, + layerId, + datasets, + includeCompare = true +) { + const { envApiStacEndpoint } = useVedaUI(); + + const datasetLayers = useMemo(() => getDatasetLayers(datasets), [datasets]); + + const fullLayerId = useMemo(() => { + const layers = getAvailableLayers(datasetId, datasets); + const match = layers.find((l) => l.id === layerId); + return match ? match.id : layerId; + }, [datasetId, layerId, datasets]); + + const layersToFetch = useMemo(() => { + const [baseMapStaticData] = reconcileDatasets( + [fullLayerId], + datasetLayers, + [] + ); + let totalLayers = [baseMapStaticData]; + + if (includeCompare) { + const baseMapStaticCompareData = baseMapStaticData.data.compare; + if (baseMapStaticCompareData && 'layerId' in baseMapStaticCompareData) { + const compareLayerId = baseMapStaticCompareData.layerId; + const [compareMapStaticData] = reconcileDatasets( + compareLayerId ? [compareLayerId] : [], + datasetLayers, + [] + ); + totalLayers = [...totalLayers, compareMapStaticData]; + } + } + return totalLayers; + }, [fullLayerId, datasetLayers, includeCompare]); + + const [layers, setLayers] = useState(layersToFetch); + + useEffect(() => { + setLayers(layersToFetch); + }, [layersToFetch]); + + useReconcileWithStacMetadata(layers, setLayers, envApiStacEndpoint); + + const baseDataLayer = useMemo(() => getDataLayer(0, layers), [layers]); + const compareDataLayer = useMemo( + () => (includeCompare ? getDataLayer(1, layers) : null), + [layers, includeCompare] + ); + + return { baseDataLayer, compareDataLayer }; +} + +export function LazyChart(props) { + return ( + } + offset={50} + once + > + + + ); +} + +export function LazyScrollyTelling(props) { + return ( + } + offset={100} + once + > + + + ); +} + +export function LazyMap({ + datasetId, + layerId, + compareDataLayer: compareOverride, + ...otherProps +}) { + const { baseDataLayer, compareDataLayer: derivedCompare } = useMapLayers( + datasetId, + layerId, + veda_faux_module_datasets, + true + ); + + const compareDataLayer = compareOverride ?? derivedCompare; + + return ( + } + offset={100} + once + > + + + ); +} + +export function LazyMultilayerMap({ + datasetId, + defaultLayerId, + defaultDateTime, + ...otherProps +}) { + const [selectedLayerId, setSelectedLayerId] = useState(defaultLayerId); + const [selectedDateTime, setSelectedDateTime] = useState(defaultDateTime); + + useEffect(() => { + setSelectedLayerId(defaultLayerId); + }, [defaultLayerId]); + + useEffect(() => { + setSelectedDateTime(defaultDateTime); + }, [defaultDateTime]); + + const { baseDataLayer } = useMapLayers( + datasetId, + selectedLayerId, + veda_faux_module_datasets, + false + ); + + const availableLayers = useMemo( + () => getAvailableLayers(datasetId, veda_faux_module_datasets), + [datasetId] + ); + + const handleLayerChange = (newLayerId) => { + setSelectedLayerId(newLayerId); + }; + + const handleDateChange = (newDate) => { + setSelectedDateTime(newDate); + }; + + return ( + } + offset={100} + once + > + + + ); +} + +export function LazyCompareImage(props) { + return ( + } offset={50} once> + + + ); +} + +export function LazyTable(props) { + return ( + } + offset={50} + once + > + + + ); +} + +export function LazyEmbed(props) { + return ( + } + offset={50} + once + > + + + ); +} + +LazyEmbed.propTypes = { + src: T.string, + height: T.number +}; + +LazyMap.propTypes = { + datasetId: T.string.isRequired, + layerId: T.string.isRequired, + compareDataLayer: T.object +}; + +LazyMultilayerMap.propTypes = { + datasetId: T.string.isRequired, + defaultLayerId: T.string.isRequired, + defaultDateTime: T.string +}; diff --git a/app/scripts/components/common/blocks/multilayer-block-map.tsx b/packages/veda-ui/src/components/common/blocks/multilayer-block-map.tsx similarity index 100% rename from app/scripts/components/common/blocks/multilayer-block-map.tsx rename to packages/veda-ui/src/components/common/blocks/multilayer-block-map.tsx diff --git a/app/scripts/components/common/blocks/multilayer-map.scss b/packages/veda-ui/src/components/common/blocks/multilayer-map.scss similarity index 100% rename from app/scripts/components/common/blocks/multilayer-map.scss rename to packages/veda-ui/src/components/common/blocks/multilayer-map.scss diff --git a/app/scripts/components/common/blocks/scrollytelling/chapter.tsx b/packages/veda-ui/src/components/common/blocks/scrollytelling/chapter.tsx similarity index 100% rename from app/scripts/components/common/blocks/scrollytelling/chapter.tsx rename to packages/veda-ui/src/components/common/blocks/scrollytelling/chapter.tsx diff --git a/app/scripts/components/common/blocks/scrollytelling/index.tsx b/packages/veda-ui/src/components/common/blocks/scrollytelling/index.tsx similarity index 100% rename from app/scripts/components/common/blocks/scrollytelling/index.tsx rename to packages/veda-ui/src/components/common/blocks/scrollytelling/index.tsx diff --git a/app/scripts/components/common/blocks/scrollytelling/map-error-message.tsx b/packages/veda-ui/src/components/common/blocks/scrollytelling/map-error-message.tsx similarity index 100% rename from app/scripts/components/common/blocks/scrollytelling/map-error-message.tsx rename to packages/veda-ui/src/components/common/blocks/scrollytelling/map-error-message.tsx diff --git a/app/scripts/components/common/bounds-fieldset.jsx b/packages/veda-ui/src/components/common/bounds-fieldset.js similarity index 100% rename from app/scripts/components/common/bounds-fieldset.jsx rename to packages/veda-ui/src/components/common/bounds-fieldset.js diff --git a/packages/veda-ui/src/components/common/bounds-fieldset.jsx b/packages/veda-ui/src/components/common/bounds-fieldset.jsx new file mode 100644 index 000000000..113349476 --- /dev/null +++ b/packages/veda-ui/src/components/common/bounds-fieldset.jsx @@ -0,0 +1,54 @@ +import React from 'react'; +import T from 'prop-types'; +import { FormFieldsetHeader, FormLegend } from '@devseed-ui/form'; + +import StressedFormGroupInput from './stressed-form-group-input'; +import { validateRangeNum } from '$utils/utils'; +import { FormFieldsetCompact, FormFieldsetBodyColumns } from '$styles/fieldset'; + +export default function BoundsFieldset(props) { + const validateLon = validateRangeNum(-180, 180); + const validateLat = validateRangeNum(-90, 90); + + const { id, title, placeholders, value, onChange } = props; + + return ( + + + {title} + + + onChange([Number(v), value[1]])} + placeholder={placeholders[0]} + /> + onChange([value[0], Number(v)])} + placeholder={placeholders[1]} + /> + + + ); +} + +BoundsFieldset.propTypes = { + id: T.string, + title: T.string, + placeholders: T.array, + value: T.array, + onChange: T.func +}; diff --git a/app/scripts/components/common/browse-controls/constants.js b/packages/veda-ui/src/components/common/browse-controls/constants.js similarity index 100% rename from app/scripts/components/common/browse-controls/constants.js rename to packages/veda-ui/src/components/common/browse-controls/constants.js diff --git a/app/scripts/components/common/browse-controls/index.tsx b/packages/veda-ui/src/components/common/browse-controls/index.tsx similarity index 100% rename from app/scripts/components/common/browse-controls/index.tsx rename to packages/veda-ui/src/components/common/browse-controls/index.tsx diff --git a/app/scripts/components/common/browse-controls/use-browse-controls.ts b/packages/veda-ui/src/components/common/browse-controls/use-browse-controls.ts similarity index 100% rename from app/scripts/components/common/browse-controls/use-browse-controls.ts rename to packages/veda-ui/src/components/common/browse-controls/use-browse-controls.ts diff --git a/app/scripts/components/common/card-sources-list.tsx b/packages/veda-ui/src/components/common/card-sources-list.tsx similarity index 100% rename from app/scripts/components/common/card-sources-list.tsx rename to packages/veda-ui/src/components/common/card-sources-list.tsx diff --git a/app/scripts/components/common/card/classic.tsx b/packages/veda-ui/src/components/common/card/classic.tsx similarity index 100% rename from app/scripts/components/common/card/classic.tsx rename to packages/veda-ui/src/components/common/card/classic.tsx diff --git a/app/scripts/components/common/card/cover.tsx b/packages/veda-ui/src/components/common/card/cover.tsx similarity index 100% rename from app/scripts/components/common/card/cover.tsx rename to packages/veda-ui/src/components/common/card/cover.tsx diff --git a/app/scripts/components/common/card/featured.tsx b/packages/veda-ui/src/components/common/card/featured.tsx similarity index 100% rename from app/scripts/components/common/card/featured.tsx rename to packages/veda-ui/src/components/common/card/featured.tsx diff --git a/app/scripts/components/common/card/horizontal-info.tsx b/packages/veda-ui/src/components/common/card/horizontal-info.tsx similarity index 100% rename from app/scripts/components/common/card/horizontal-info.tsx rename to packages/veda-ui/src/components/common/card/horizontal-info.tsx diff --git a/app/scripts/components/common/card/index.tsx b/packages/veda-ui/src/components/common/card/index.tsx similarity index 100% rename from app/scripts/components/common/card/index.tsx rename to packages/veda-ui/src/components/common/card/index.tsx diff --git a/app/scripts/components/common/card/styles.scss b/packages/veda-ui/src/components/common/card/styles.scss similarity index 100% rename from app/scripts/components/common/card/styles.scss rename to packages/veda-ui/src/components/common/card/styles.scss diff --git a/app/scripts/components/common/card/styles.tsx b/packages/veda-ui/src/components/common/card/styles.tsx similarity index 100% rename from app/scripts/components/common/card/styles.tsx rename to packages/veda-ui/src/components/common/card/styles.tsx diff --git a/app/scripts/components/common/card/uswds-cards/base-card.tsx b/packages/veda-ui/src/components/common/card/uswds-cards/base-card.tsx similarity index 100% rename from app/scripts/components/common/card/uswds-cards/base-card.tsx rename to packages/veda-ui/src/components/common/card/uswds-cards/base-card.tsx diff --git a/app/scripts/components/common/card/uswds-cards/default-card.tsx b/packages/veda-ui/src/components/common/card/uswds-cards/default-card.tsx similarity index 100% rename from app/scripts/components/common/card/uswds-cards/default-card.tsx rename to packages/veda-ui/src/components/common/card/uswds-cards/default-card.tsx diff --git a/app/scripts/components/common/card/uswds-cards/flag-card.tsx b/packages/veda-ui/src/components/common/card/uswds-cards/flag-card.tsx similarity index 100% rename from app/scripts/components/common/card/uswds-cards/flag-card.tsx rename to packages/veda-ui/src/components/common/card/uswds-cards/flag-card.tsx diff --git a/app/scripts/components/common/card/uswds-cards/styles.scss b/packages/veda-ui/src/components/common/card/uswds-cards/styles.scss similarity index 100% rename from app/scripts/components/common/card/uswds-cards/styles.scss rename to packages/veda-ui/src/components/common/card/uswds-cards/styles.scss diff --git a/app/scripts/components/common/card/uswds-cards/topic-card.tsx b/packages/veda-ui/src/components/common/card/uswds-cards/topic-card.tsx similarity index 100% rename from app/scripts/components/common/card/uswds-cards/topic-card.tsx rename to packages/veda-ui/src/components/common/card/uswds-cards/topic-card.tsx diff --git a/app/scripts/components/common/card/uswds-cards/types.ts b/packages/veda-ui/src/components/common/card/uswds-cards/types.ts similarity index 100% rename from app/scripts/components/common/card/uswds-cards/types.ts rename to packages/veda-ui/src/components/common/card/uswds-cards/types.ts diff --git a/app/scripts/components/common/card/uswds-cards/utils.tsx b/packages/veda-ui/src/components/common/card/uswds-cards/utils.tsx similarity index 100% rename from app/scripts/components/common/card/uswds-cards/utils.tsx rename to packages/veda-ui/src/components/common/card/uswds-cards/utils.tsx diff --git a/app/scripts/components/common/catalog/catalog-card.tsx b/packages/veda-ui/src/components/common/catalog/catalog-card.tsx similarity index 100% rename from app/scripts/components/common/catalog/catalog-card.tsx rename to packages/veda-ui/src/components/common/catalog/catalog-card.tsx diff --git a/app/scripts/components/common/catalog/catalog-content.tsx b/packages/veda-ui/src/components/common/catalog/catalog-content.tsx similarity index 100% rename from app/scripts/components/common/catalog/catalog-content.tsx rename to packages/veda-ui/src/components/common/catalog/catalog-content.tsx diff --git a/app/scripts/components/common/catalog/catalog-legacy/catalog-content.tsx b/packages/veda-ui/src/components/common/catalog/catalog-legacy/catalog-content.tsx similarity index 100% rename from app/scripts/components/common/catalog/catalog-legacy/catalog-content.tsx rename to packages/veda-ui/src/components/common/catalog/catalog-legacy/catalog-content.tsx diff --git a/app/scripts/components/common/catalog/catalog-legacy/catalog-tags.tsx b/packages/veda-ui/src/components/common/catalog/catalog-legacy/catalog-tags.tsx similarity index 100% rename from app/scripts/components/common/catalog/catalog-legacy/catalog-tags.tsx rename to packages/veda-ui/src/components/common/catalog/catalog-legacy/catalog-tags.tsx diff --git a/app/scripts/components/common/catalog/catalog-legacy/filter-tag.tsx b/packages/veda-ui/src/components/common/catalog/catalog-legacy/filter-tag.tsx similarity index 100% rename from app/scripts/components/common/catalog/catalog-legacy/filter-tag.tsx rename to packages/veda-ui/src/components/common/catalog/catalog-legacy/filter-tag.tsx diff --git a/app/scripts/components/common/catalog/catalog-legacy/filters-control.tsx b/packages/veda-ui/src/components/common/catalog/catalog-legacy/filters-control.tsx similarity index 100% rename from app/scripts/components/common/catalog/catalog-legacy/filters-control.tsx rename to packages/veda-ui/src/components/common/catalog/catalog-legacy/filters-control.tsx diff --git a/app/scripts/components/common/catalog/catalog-tags.tsx b/packages/veda-ui/src/components/common/catalog/catalog-tags.tsx similarity index 100% rename from app/scripts/components/common/catalog/catalog-tags.tsx rename to packages/veda-ui/src/components/common/catalog/catalog-tags.tsx diff --git a/app/scripts/components/common/catalog/controls/atoms/search-atom.ts b/packages/veda-ui/src/components/common/catalog/controls/atoms/search-atom.ts similarity index 100% rename from app/scripts/components/common/catalog/controls/atoms/search-atom.ts rename to packages/veda-ui/src/components/common/catalog/controls/atoms/search-atom.ts diff --git a/app/scripts/components/common/catalog/controls/atoms/taxonomy-atom.ts b/packages/veda-ui/src/components/common/catalog/controls/atoms/taxonomy-atom.ts similarity index 100% rename from app/scripts/components/common/catalog/controls/atoms/taxonomy-atom.ts rename to packages/veda-ui/src/components/common/catalog/controls/atoms/taxonomy-atom.ts diff --git a/app/scripts/components/common/catalog/controls/hooks/use-filters-with-query.ts b/packages/veda-ui/src/components/common/catalog/controls/hooks/use-filters-with-query.ts similarity index 100% rename from app/scripts/components/common/catalog/controls/hooks/use-filters-with-query.ts rename to packages/veda-ui/src/components/common/catalog/controls/hooks/use-filters-with-query.ts diff --git a/app/scripts/components/common/catalog/filter-tag.tsx b/packages/veda-ui/src/components/common/catalog/filter-tag.tsx similarity index 100% rename from app/scripts/components/common/catalog/filter-tag.tsx rename to packages/veda-ui/src/components/common/catalog/filter-tag.tsx diff --git a/app/scripts/components/common/catalog/filters-controls/filter-controls.scss b/packages/veda-ui/src/components/common/catalog/filters-controls/filter-controls.scss similarity index 100% rename from app/scripts/components/common/catalog/filters-controls/filter-controls.scss rename to packages/veda-ui/src/components/common/catalog/filters-controls/filter-controls.scss diff --git a/app/scripts/components/common/catalog/filters-controls/filters-control.tsx b/packages/veda-ui/src/components/common/catalog/filters-controls/filters-control.tsx similarity index 100% rename from app/scripts/components/common/catalog/filters-controls/filters-control.tsx rename to packages/veda-ui/src/components/common/catalog/filters-controls/filters-control.tsx diff --git a/app/scripts/components/common/catalog/index.tsx b/packages/veda-ui/src/components/common/catalog/index.tsx similarity index 100% rename from app/scripts/components/common/catalog/index.tsx rename to packages/veda-ui/src/components/common/catalog/index.tsx diff --git a/app/scripts/components/common/catalog/prepare-datasets.ts b/packages/veda-ui/src/components/common/catalog/prepare-datasets.ts similarity index 100% rename from app/scripts/components/common/catalog/prepare-datasets.ts rename to packages/veda-ui/src/components/common/catalog/prepare-datasets.ts diff --git a/app/scripts/components/common/catalog/utils.test.ts b/packages/veda-ui/src/components/common/catalog/utils.test.ts similarity index 100% rename from app/scripts/components/common/catalog/utils.test.ts rename to packages/veda-ui/src/components/common/catalog/utils.test.ts diff --git a/app/scripts/components/common/catalog/utils.ts b/packages/veda-ui/src/components/common/catalog/utils.ts similarity index 100% rename from app/scripts/components/common/catalog/utils.ts rename to packages/veda-ui/src/components/common/catalog/utils.ts diff --git a/app/scripts/components/common/chart/alt-title.tsx b/packages/veda-ui/src/components/common/chart/alt-title.tsx similarity index 100% rename from app/scripts/components/common/chart/alt-title.tsx rename to packages/veda-ui/src/components/common/chart/alt-title.tsx diff --git a/app/scripts/components/common/chart/block.tsx b/packages/veda-ui/src/components/common/chart/block.tsx similarity index 100% rename from app/scripts/components/common/chart/block.tsx rename to packages/veda-ui/src/components/common/chart/block.tsx diff --git a/app/scripts/components/common/chart/brush.tsx b/packages/veda-ui/src/components/common/chart/brush.tsx similarity index 100% rename from app/scripts/components/common/chart/brush.tsx rename to packages/veda-ui/src/components/common/chart/brush.tsx diff --git a/app/scripts/components/common/chart/constant.js b/packages/veda-ui/src/components/common/chart/constant.js similarity index 100% rename from app/scripts/components/common/chart/constant.js rename to packages/veda-ui/src/components/common/chart/constant.js diff --git a/app/scripts/components/common/chart/index.tsx b/packages/veda-ui/src/components/common/chart/index.tsx similarity index 100% rename from app/scripts/components/common/chart/index.tsx rename to packages/veda-ui/src/components/common/chart/index.tsx diff --git a/app/scripts/components/common/chart/legend.tsx b/packages/veda-ui/src/components/common/chart/legend.tsx similarity index 100% rename from app/scripts/components/common/chart/legend.tsx rename to packages/veda-ui/src/components/common/chart/legend.tsx diff --git a/app/scripts/components/common/chart/tooltip.tsx b/packages/veda-ui/src/components/common/chart/tooltip.tsx similarity index 100% rename from app/scripts/components/common/chart/tooltip.tsx rename to packages/veda-ui/src/components/common/chart/tooltip.tsx diff --git a/app/scripts/components/common/chart/useBrush.ts b/packages/veda-ui/src/components/common/chart/useBrush.ts similarity index 100% rename from app/scripts/components/common/chart/useBrush.ts rename to packages/veda-ui/src/components/common/chart/useBrush.ts diff --git a/app/scripts/components/common/chart/utils.test.ts b/packages/veda-ui/src/components/common/chart/utils.test.ts similarity index 100% rename from app/scripts/components/common/chart/utils.test.ts rename to packages/veda-ui/src/components/common/chart/utils.test.ts diff --git a/app/scripts/components/common/chart/utils.ts b/packages/veda-ui/src/components/common/chart/utils.ts similarity index 100% rename from app/scripts/components/common/chart/utils.ts rename to packages/veda-ui/src/components/common/chart/utils.ts diff --git a/app/scripts/components/common/content-taxonomy.tsx b/packages/veda-ui/src/components/common/content-taxonomy.tsx similarity index 100% rename from app/scripts/components/common/content-taxonomy.tsx rename to packages/veda-ui/src/components/common/content-taxonomy.tsx diff --git a/app/scripts/components/common/cookie-consent/cookieConsent.spec.jsx b/packages/veda-ui/src/components/common/cookie-consent/cookieConsent.spec.js similarity index 100% rename from app/scripts/components/common/cookie-consent/cookieConsent.spec.jsx rename to packages/veda-ui/src/components/common/cookie-consent/cookieConsent.spec.js diff --git a/packages/veda-ui/src/components/common/cookie-consent/cookieConsent.spec.jsx b/packages/veda-ui/src/components/common/cookie-consent/cookieConsent.spec.jsx new file mode 100644 index 000000000..2dd81cdac --- /dev/null +++ b/packages/veda-ui/src/components/common/cookie-consent/cookieConsent.spec.jsx @@ -0,0 +1,92 @@ +import React from 'react'; + +import { render, screen, fireEvent } from '@testing-library/react'; +import { MemoryRouter } from 'react-router-dom'; // For testing +import { createMemoryHistory } from 'history'; + +import * as utils from './utils'; +import CookieConsent from './index'; +const lodash = require('lodash'); + +describe('Cookie consent form should render with correct content.', () => { + const setDisplayCookieConsent = jest.fn(); + const setGoogleTagManager = jest.fn(); + const cookieData = { + title: 'Cookie Consent', + copy: '

We use cookies to enhance your browsing experience and to help us understand how our website is used. These cookies allow us to collect data on site usage and improve our services based on your interactions. To learn more about it, see our Privacy Policy

We use cookies to enhance your browsing experience and to help us understand how our website is used. These cookies allow us to collect data on site usage and improve our services based on your interactions. To learn more about it, see our [Privacy Policy](https://www.nasa.gov/privacy/#cookies)', + setDisplayCookieConsent, + setGoogleTagManager + }; + + const onFormInteraction = jest.fn(); + + const history = createMemoryHistory({ initialEntries: ['/home'] }); + + jest.mock('react-router-dom', () => ({ + ...jest.requireActual('react-router-dom'), + useLocation: () => ({ + pathname: 'localhost:3000/example/path' + }) + })); + + lodash.debounce = jest.fn((fn) => fn); + + afterEach(() => { + jest.clearAllMocks(); + + // Clear cookies after each test + document.cookie = `${utils.COOKIE_CONSENT_KEY}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`; + }); + + it('Renders correct content', () => { + render( + + + + ); + expect( + screen.getByRole('link', { name: 'Privacy Policy' }) + ).toHaveAttribute('href', 'https://www.nasa.gov/privacy/#cookies'); + expect( + screen.getByRole('button', { name: 'Decline Cookies' }) + ).toBeInTheDocument(); + expect( + screen.getByRole('button', { name: 'Accept Cookies' }) + ).toBeInTheDocument(); + expect(screen.getByText('Cookie Consent')).toBeInTheDocument(); + expect( + screen.getByText( + 'We use cookies to enhance your browsing experience and to help us understand how our website is used. These cookies allow us to collect data on site usage and improve our services based on your interactions. To learn more about it, see our' + ) + ).toBeInTheDocument(); + }); + + it('Check correct cookie content on Decline click', () => { + render( + + + + ); + const button = screen.getByRole('button', { name: 'Decline Cookies' }); + fireEvent.click(button); + const resultCookie = document.cookie; + expect(resultCookie).toBe( + `${utils.COOKIE_CONSENT_KEY}={"responded":true,"answer":false}` + ); + }); + + it('Check correct cookie content on Accept click', () => { + render( + + + + ); + const acceptButton = screen.getByRole('button', { name: 'Accept Cookies' }); + fireEvent.click(acceptButton); + const resultCookie = document.cookie; + + expect(resultCookie).toBe( + `${utils.COOKIE_CONSENT_KEY}={"responded":true,"answer":true}` + ); + }); +}); diff --git a/app/scripts/components/common/cookie-consent/index.scss b/packages/veda-ui/src/components/common/cookie-consent/index.scss similarity index 100% rename from app/scripts/components/common/cookie-consent/index.scss rename to packages/veda-ui/src/components/common/cookie-consent/index.scss diff --git a/app/scripts/components/common/cookie-consent/index.tsx b/packages/veda-ui/src/components/common/cookie-consent/index.tsx similarity index 100% rename from app/scripts/components/common/cookie-consent/index.tsx rename to packages/veda-ui/src/components/common/cookie-consent/index.tsx diff --git a/app/scripts/components/common/cookie-consent/utils.test.ts b/packages/veda-ui/src/components/common/cookie-consent/utils.test.ts similarity index 100% rename from app/scripts/components/common/cookie-consent/utils.test.ts rename to packages/veda-ui/src/components/common/cookie-consent/utils.test.ts diff --git a/app/scripts/components/common/cookie-consent/utils.ts b/packages/veda-ui/src/components/common/cookie-consent/utils.ts similarity index 100% rename from app/scripts/components/common/cookie-consent/utils.ts rename to packages/veda-ui/src/components/common/cookie-consent/utils.ts diff --git a/app/scripts/components/common/copy-field.ts b/packages/veda-ui/src/components/common/copy-field.ts similarity index 100% rename from app/scripts/components/common/copy-field.ts rename to packages/veda-ui/src/components/common/copy-field.ts diff --git a/app/scripts/components/common/custom-icon/README.md b/packages/veda-ui/src/components/common/custom-icon/README.md similarity index 100% rename from app/scripts/components/common/custom-icon/README.md rename to packages/veda-ui/src/components/common/custom-icon/README.md diff --git a/app/scripts/components/common/custom-icon/calendar-minus.tsx b/packages/veda-ui/src/components/common/custom-icon/calendar-minus.tsx similarity index 100% rename from app/scripts/components/common/custom-icon/calendar-minus.tsx rename to packages/veda-ui/src/components/common/custom-icon/calendar-minus.tsx diff --git a/app/scripts/components/common/custom-icon/calendar-plus.tsx b/packages/veda-ui/src/components/common/custom-icon/calendar-plus.tsx similarity index 100% rename from app/scripts/components/common/custom-icon/calendar-plus.tsx rename to packages/veda-ui/src/components/common/custom-icon/calendar-plus.tsx diff --git a/app/scripts/components/common/custom-icon/dataset-layers.tsx b/packages/veda-ui/src/components/common/custom-icon/dataset-layers.tsx similarity index 100% rename from app/scripts/components/common/custom-icon/dataset-layers.tsx rename to packages/veda-ui/src/components/common/custom-icon/dataset-layers.tsx diff --git a/app/scripts/components/common/custom-icon/drop.tsx b/packages/veda-ui/src/components/common/custom-icon/drop.tsx similarity index 100% rename from app/scripts/components/common/custom-icon/drop.tsx rename to packages/veda-ui/src/components/common/custom-icon/drop.tsx diff --git a/app/scripts/components/common/custom-icon/hand-pan.tsx b/packages/veda-ui/src/components/common/custom-icon/hand-pan.tsx similarity index 100% rename from app/scripts/components/common/custom-icon/hand-pan.tsx rename to packages/veda-ui/src/components/common/custom-icon/hand-pan.tsx diff --git a/app/scripts/components/common/custom-icon/hand-swipe-horizontal.tsx b/packages/veda-ui/src/components/common/custom-icon/hand-swipe-horizontal.tsx similarity index 100% rename from app/scripts/components/common/custom-icon/hand-swipe-horizontal.tsx rename to packages/veda-ui/src/components/common/custom-icon/hand-swipe-horizontal.tsx diff --git a/app/scripts/components/common/custom-icon/index.tsx b/packages/veda-ui/src/components/common/custom-icon/index.tsx similarity index 100% rename from app/scripts/components/common/custom-icon/index.tsx rename to packages/veda-ui/src/components/common/custom-icon/index.tsx diff --git a/app/scripts/components/common/custom-icon/progress-tick-high.tsx b/packages/veda-ui/src/components/common/custom-icon/progress-tick-high.tsx similarity index 100% rename from app/scripts/components/common/custom-icon/progress-tick-high.tsx rename to packages/veda-ui/src/components/common/custom-icon/progress-tick-high.tsx diff --git a/app/scripts/components/common/custom-icon/progress-tick-low.tsx b/packages/veda-ui/src/components/common/custom-icon/progress-tick-low.tsx similarity index 100% rename from app/scripts/components/common/custom-icon/progress-tick-low.tsx rename to packages/veda-ui/src/components/common/custom-icon/progress-tick-low.tsx diff --git a/app/scripts/components/common/custom-icon/progress-tick-medium.tsx b/packages/veda-ui/src/components/common/custom-icon/progress-tick-medium.tsx similarity index 100% rename from app/scripts/components/common/custom-icon/progress-tick-medium.tsx rename to packages/veda-ui/src/components/common/custom-icon/progress-tick-medium.tsx diff --git a/app/scripts/components/common/custom-icon/utils.tsx b/packages/veda-ui/src/components/common/custom-icon/utils.tsx similarity index 100% rename from app/scripts/components/common/custom-icon/utils.tsx rename to packages/veda-ui/src/components/common/custom-icon/utils.tsx diff --git a/app/scripts/components/common/dataset-classification.tsx b/packages/veda-ui/src/components/common/dataset-classification.tsx similarity index 100% rename from app/scripts/components/common/dataset-classification.tsx rename to packages/veda-ui/src/components/common/dataset-classification.tsx diff --git a/app/scripts/components/common/dataset-layer-card/color-maps.ts b/packages/veda-ui/src/components/common/dataset-layer-card/color-maps.ts similarity index 100% rename from app/scripts/components/common/dataset-layer-card/color-maps.ts rename to packages/veda-ui/src/components/common/dataset-layer-card/color-maps.ts diff --git a/app/scripts/components/common/dataset-layer-card/color-range-slider/color-range-slider.scss b/packages/veda-ui/src/components/common/dataset-layer-card/color-range-slider/color-range-slider.scss similarity index 100% rename from app/scripts/components/common/dataset-layer-card/color-range-slider/color-range-slider.scss rename to packages/veda-ui/src/components/common/dataset-layer-card/color-range-slider/color-range-slider.scss diff --git a/app/scripts/components/common/dataset-layer-card/color-range-slider/colorRangeSlider.spec.tsx b/packages/veda-ui/src/components/common/dataset-layer-card/color-range-slider/colorRangeSlider.spec.tsx similarity index 100% rename from app/scripts/components/common/dataset-layer-card/color-range-slider/colorRangeSlider.spec.tsx rename to packages/veda-ui/src/components/common/dataset-layer-card/color-range-slider/colorRangeSlider.spec.tsx diff --git a/app/scripts/components/common/dataset-layer-card/color-range-slider/index.tsx b/packages/veda-ui/src/components/common/dataset-layer-card/color-range-slider/index.tsx similarity index 100% rename from app/scripts/components/common/dataset-layer-card/color-range-slider/index.tsx rename to packages/veda-ui/src/components/common/dataset-layer-card/color-range-slider/index.tsx diff --git a/app/scripts/components/common/dataset-layer-card/color-range-slider/utils.tsx b/packages/veda-ui/src/components/common/dataset-layer-card/color-range-slider/utils.tsx similarity index 100% rename from app/scripts/components/common/dataset-layer-card/color-range-slider/utils.tsx rename to packages/veda-ui/src/components/common/dataset-layer-card/color-range-slider/utils.tsx diff --git a/app/scripts/components/common/dataset-layer-card/colormap-options.scss b/packages/veda-ui/src/components/common/dataset-layer-card/colormap-options.scss similarity index 100% rename from app/scripts/components/common/dataset-layer-card/colormap-options.scss rename to packages/veda-ui/src/components/common/dataset-layer-card/colormap-options.scss diff --git a/app/scripts/components/common/dataset-layer-card/colormap-options.tsx b/packages/veda-ui/src/components/common/dataset-layer-card/colormap-options.tsx similarity index 100% rename from app/scripts/components/common/dataset-layer-card/colormap-options.tsx rename to packages/veda-ui/src/components/common/dataset-layer-card/colormap-options.tsx diff --git a/app/scripts/components/common/dataset-layer-card/colormap-section.tsx b/packages/veda-ui/src/components/common/dataset-layer-card/colormap-section.tsx similarity index 100% rename from app/scripts/components/common/dataset-layer-card/colormap-section.tsx rename to packages/veda-ui/src/components/common/dataset-layer-card/colormap-section.tsx diff --git a/app/scripts/components/common/dataset-layer-card/index.tsx b/packages/veda-ui/src/components/common/dataset-layer-card/index.tsx similarity index 100% rename from app/scripts/components/common/dataset-layer-card/index.tsx rename to packages/veda-ui/src/components/common/dataset-layer-card/index.tsx diff --git a/app/scripts/components/common/dataset-layer-card/layer-options-menu.tsx b/packages/veda-ui/src/components/common/dataset-layer-card/layer-options-menu.tsx similarity index 100% rename from app/scripts/components/common/dataset-layer-card/layer-options-menu.tsx rename to packages/veda-ui/src/components/common/dataset-layer-card/layer-options-menu.tsx diff --git a/app/scripts/components/common/datepicker/datepicker.scss b/packages/veda-ui/src/components/common/datepicker/datepicker.scss similarity index 100% rename from app/scripts/components/common/datepicker/datepicker.scss rename to packages/veda-ui/src/components/common/datepicker/datepicker.scss diff --git a/app/scripts/components/common/datepicker/index.tsx b/packages/veda-ui/src/components/common/datepicker/index.tsx similarity index 100% rename from app/scripts/components/common/datepicker/index.tsx rename to packages/veda-ui/src/components/common/datepicker/index.tsx diff --git a/app/scripts/components/common/dropdown-scrollable.tsx b/packages/veda-ui/src/components/common/dropdown-scrollable.tsx similarity index 100% rename from app/scripts/components/common/dropdown-scrollable.tsx rename to packages/veda-ui/src/components/common/dropdown-scrollable.tsx diff --git a/app/scripts/components/common/element-interactive.jsx b/packages/veda-ui/src/components/common/element-interactive.jsx similarity index 100% rename from app/scripts/components/common/element-interactive.jsx rename to packages/veda-ui/src/components/common/element-interactive.jsx diff --git a/app/scripts/components/common/empty-hub.tsx b/packages/veda-ui/src/components/common/empty-hub.tsx similarity index 100% rename from app/scripts/components/common/empty-hub.tsx rename to packages/veda-ui/src/components/common/empty-hub.tsx diff --git a/app/scripts/components/common/external-link-flag.deprecation.test.tsx b/packages/veda-ui/src/components/common/external-link-flag.deprecation.test.tsx similarity index 100% rename from app/scripts/components/common/external-link-flag.deprecation.test.tsx rename to packages/veda-ui/src/components/common/external-link-flag.deprecation.test.tsx diff --git a/app/scripts/components/common/external-link-flag.tsx b/packages/veda-ui/src/components/common/external-link-flag.tsx similarity index 100% rename from app/scripts/components/common/external-link-flag.tsx rename to packages/veda-ui/src/components/common/external-link-flag.tsx diff --git a/app/scripts/components/common/featured-slider-section.tsx b/packages/veda-ui/src/components/common/featured-slider-section.tsx similarity index 100% rename from app/scripts/components/common/featured-slider-section.tsx rename to packages/veda-ui/src/components/common/featured-slider-section.tsx diff --git a/app/scripts/components/common/figure.jsx b/packages/veda-ui/src/components/common/figure.jsx similarity index 100% rename from app/scripts/components/common/figure.jsx rename to packages/veda-ui/src/components/common/figure.jsx diff --git a/app/scripts/components/common/fold.tsx b/packages/veda-ui/src/components/common/fold.tsx similarity index 100% rename from app/scripts/components/common/fold.tsx rename to packages/veda-ui/src/components/common/fold.tsx diff --git a/app/scripts/components/common/form/checkable-filter-legacy/index.tsx b/packages/veda-ui/src/components/common/form/checkable-filter-legacy/index.tsx similarity index 100% rename from app/scripts/components/common/form/checkable-filter-legacy/index.tsx rename to packages/veda-ui/src/components/common/form/checkable-filter-legacy/index.tsx diff --git a/app/scripts/components/common/form/checkable-filter/checkable-filter.scss b/packages/veda-ui/src/components/common/form/checkable-filter/checkable-filter.scss similarity index 100% rename from app/scripts/components/common/form/checkable-filter/checkable-filter.scss rename to packages/veda-ui/src/components/common/form/checkable-filter/checkable-filter.scss diff --git a/app/scripts/components/common/form/checkable-filter/index.tsx b/packages/veda-ui/src/components/common/form/checkable-filter/index.tsx similarity index 100% rename from app/scripts/components/common/form/checkable-filter/index.tsx rename to packages/veda-ui/src/components/common/form/checkable-filter/index.tsx diff --git a/app/scripts/components/common/google-form.tsx b/packages/veda-ui/src/components/common/google-form.tsx similarity index 100% rename from app/scripts/components/common/google-form.tsx rename to packages/veda-ui/src/components/common/google-form.tsx diff --git a/app/scripts/components/common/layout-root/index.tsx b/packages/veda-ui/src/components/common/layout-root/index.tsx similarity index 100% rename from app/scripts/components/common/layout-root/index.tsx rename to packages/veda-ui/src/components/common/layout-root/index.tsx diff --git a/app/scripts/components/common/layout-root/useSlidingStickyHeaderProps.ts b/packages/veda-ui/src/components/common/layout-root/useSlidingStickyHeaderProps.ts similarity index 100% rename from app/scripts/components/common/layout-root/useSlidingStickyHeaderProps.ts rename to packages/veda-ui/src/components/common/layout-root/useSlidingStickyHeaderProps.ts diff --git a/app/scripts/components/common/loading-skeleton.tsx b/packages/veda-ui/src/components/common/loading-skeleton.tsx similarity index 100% rename from app/scripts/components/common/loading-skeleton.tsx rename to packages/veda-ui/src/components/common/loading-skeleton.tsx diff --git a/app/scripts/components/common/map/controls/aoi/aoi-control.tsx b/packages/veda-ui/src/components/common/map/controls/aoi/aoi-control.tsx similarity index 100% rename from app/scripts/components/common/map/controls/aoi/aoi-control.tsx rename to packages/veda-ui/src/components/common/map/controls/aoi/aoi-control.tsx diff --git a/app/scripts/components/common/map/controls/aoi/atoms.ts b/packages/veda-ui/src/components/common/map/controls/aoi/atoms.ts similarity index 100% rename from app/scripts/components/common/map/controls/aoi/atoms.ts rename to packages/veda-ui/src/components/common/map/controls/aoi/atoms.ts diff --git a/app/scripts/components/common/map/controls/aoi/custom-aoi-modal.tsx b/packages/veda-ui/src/components/common/map/controls/aoi/custom-aoi-modal.tsx similarity index 100% rename from app/scripts/components/common/map/controls/aoi/custom-aoi-modal.tsx rename to packages/veda-ui/src/components/common/map/controls/aoi/custom-aoi-modal.tsx diff --git a/app/scripts/components/common/map/controls/aoi/draw-tools.tsx b/packages/veda-ui/src/components/common/map/controls/aoi/draw-tools.tsx similarity index 100% rename from app/scripts/components/common/map/controls/aoi/draw-tools.tsx rename to packages/veda-ui/src/components/common/map/controls/aoi/draw-tools.tsx diff --git a/app/scripts/components/common/map/controls/aoi/preset-selector-container.tsx b/packages/veda-ui/src/components/common/map/controls/aoi/preset-selector-container.tsx similarity index 100% rename from app/scripts/components/common/map/controls/aoi/preset-selector-container.tsx rename to packages/veda-ui/src/components/common/map/controls/aoi/preset-selector-container.tsx diff --git a/app/scripts/components/common/map/controls/aoi/preset-selector.tsx b/packages/veda-ui/src/components/common/map/controls/aoi/preset-selector.tsx similarity index 100% rename from app/scripts/components/common/map/controls/aoi/preset-selector.tsx rename to packages/veda-ui/src/components/common/map/controls/aoi/preset-selector.tsx diff --git a/app/scripts/components/common/map/controls/aoi/style.ts b/packages/veda-ui/src/components/common/map/controls/aoi/style.ts similarity index 100% rename from app/scripts/components/common/map/controls/aoi/style.ts rename to packages/veda-ui/src/components/common/map/controls/aoi/style.ts diff --git a/app/scripts/components/common/map/controls/aoi/types.d.ts b/packages/veda-ui/src/components/common/map/controls/aoi/types.d.ts similarity index 100% rename from app/scripts/components/common/map/controls/aoi/types.d.ts rename to packages/veda-ui/src/components/common/map/controls/aoi/types.d.ts diff --git a/app/scripts/components/common/map/controls/aoi/utils.ts b/packages/veda-ui/src/components/common/map/controls/aoi/utils.ts similarity index 100% rename from app/scripts/components/common/map/controls/aoi/utils.ts rename to packages/veda-ui/src/components/common/map/controls/aoi/utils.ts diff --git a/app/scripts/components/common/map/controls/coords.tsx b/packages/veda-ui/src/components/common/map/controls/coords.tsx similarity index 100% rename from app/scripts/components/common/map/controls/coords.tsx rename to packages/veda-ui/src/components/common/map/controls/coords.tsx diff --git a/app/scripts/components/common/map/controls/geocoder.tsx b/packages/veda-ui/src/components/common/map/controls/geocoder.tsx similarity index 100% rename from app/scripts/components/common/map/controls/geocoder.tsx rename to packages/veda-ui/src/components/common/map/controls/geocoder.tsx diff --git a/app/scripts/components/common/map/controls/hooks/use-aois.ts b/packages/veda-ui/src/components/common/map/controls/hooks/use-aois.ts similarity index 100% rename from app/scripts/components/common/map/controls/hooks/use-aois.ts rename to packages/veda-ui/src/components/common/map/controls/hooks/use-aois.ts diff --git a/app/scripts/components/common/map/controls/hooks/use-basemap.ts b/packages/veda-ui/src/components/common/map/controls/hooks/use-basemap.ts similarity index 100% rename from app/scripts/components/common/map/controls/hooks/use-basemap.ts rename to packages/veda-ui/src/components/common/map/controls/hooks/use-basemap.ts diff --git a/app/scripts/components/common/map/controls/hooks/use-custom-aoi.test.ts b/packages/veda-ui/src/components/common/map/controls/hooks/use-custom-aoi.test.ts similarity index 100% rename from app/scripts/components/common/map/controls/hooks/use-custom-aoi.test.ts rename to packages/veda-ui/src/components/common/map/controls/hooks/use-custom-aoi.test.ts diff --git a/app/scripts/components/common/map/controls/hooks/use-custom-aoi.tsx b/packages/veda-ui/src/components/common/map/controls/hooks/use-custom-aoi.tsx similarity index 100% rename from app/scripts/components/common/map/controls/hooks/use-custom-aoi.tsx rename to packages/veda-ui/src/components/common/map/controls/hooks/use-custom-aoi.tsx diff --git a/app/scripts/components/common/map/controls/hooks/use-draw-control.ts b/packages/veda-ui/src/components/common/map/controls/hooks/use-draw-control.ts similarity index 100% rename from app/scripts/components/common/map/controls/hooks/use-draw-control.ts rename to packages/veda-ui/src/components/common/map/controls/hooks/use-draw-control.ts diff --git a/app/scripts/components/common/map/controls/hooks/use-preset-aoi.tsx b/packages/veda-ui/src/components/common/map/controls/hooks/use-preset-aoi.tsx similarity index 100% rename from app/scripts/components/common/map/controls/hooks/use-preset-aoi.tsx rename to packages/veda-ui/src/components/common/map/controls/hooks/use-preset-aoi.tsx diff --git a/app/scripts/components/common/map/controls/hooks/use-themed-control.tsx b/packages/veda-ui/src/components/common/map/controls/hooks/use-themed-control.tsx similarity index 100% rename from app/scripts/components/common/map/controls/hooks/use-themed-control.tsx rename to packages/veda-ui/src/components/common/map/controls/hooks/use-themed-control.tsx diff --git a/app/scripts/components/common/map/controls/index.tsx b/packages/veda-ui/src/components/common/map/controls/index.tsx similarity index 100% rename from app/scripts/components/common/map/controls/index.tsx rename to packages/veda-ui/src/components/common/map/controls/index.tsx diff --git a/app/scripts/components/common/map/controls/map-options/basemap.ts b/packages/veda-ui/src/components/common/map/controls/map-options/basemap.ts similarity index 100% rename from app/scripts/components/common/map/controls/map-options/basemap.ts rename to packages/veda-ui/src/components/common/map/controls/map-options/basemap.ts diff --git a/app/scripts/components/common/map/controls/map-options/index.tsx b/packages/veda-ui/src/components/common/map/controls/map-options/index.tsx similarity index 100% rename from app/scripts/components/common/map/controls/map-options/index.tsx rename to packages/veda-ui/src/components/common/map/controls/map-options/index.tsx diff --git a/app/scripts/components/common/map/controls/map-options/projection-items.tsx b/packages/veda-ui/src/components/common/map/controls/map-options/projection-items.tsx similarity index 100% rename from app/scripts/components/common/map/controls/map-options/projection-items.tsx rename to packages/veda-ui/src/components/common/map/controls/map-options/projection-items.tsx diff --git a/app/scripts/components/common/map/controls/map-options/projections.ts b/packages/veda-ui/src/components/common/map/controls/map-options/projections.ts similarity index 100% rename from app/scripts/components/common/map/controls/map-options/projections.ts rename to packages/veda-ui/src/components/common/map/controls/map-options/projections.ts diff --git a/app/scripts/components/common/map/controls/map-options/types.ts b/packages/veda-ui/src/components/common/map/controls/map-options/types.ts similarity index 100% rename from app/scripts/components/common/map/controls/map-options/types.ts rename to packages/veda-ui/src/components/common/map/controls/map-options/types.ts diff --git a/app/scripts/components/common/map/hooks/use-custom-marker.ts b/packages/veda-ui/src/components/common/map/hooks/use-custom-marker.ts similarity index 100% rename from app/scripts/components/common/map/hooks/use-custom-marker.ts rename to packages/veda-ui/src/components/common/map/hooks/use-custom-marker.ts diff --git a/app/scripts/components/common/map/hooks/use-fit-bbox.ts b/packages/veda-ui/src/components/common/map/hooks/use-fit-bbox.ts similarity index 100% rename from app/scripts/components/common/map/hooks/use-fit-bbox.ts rename to packages/veda-ui/src/components/common/map/hooks/use-fit-bbox.ts diff --git a/app/scripts/components/common/map/hooks/use-generator-params.ts b/packages/veda-ui/src/components/common/map/hooks/use-generator-params.ts similarity index 100% rename from app/scripts/components/common/map/hooks/use-generator-params.ts rename to packages/veda-ui/src/components/common/map/hooks/use-generator-params.ts diff --git a/app/scripts/components/common/map/hooks/use-layer-interaction.ts b/packages/veda-ui/src/components/common/map/hooks/use-layer-interaction.ts similarity index 100% rename from app/scripts/components/common/map/hooks/use-layer-interaction.ts rename to packages/veda-ui/src/components/common/map/hooks/use-layer-interaction.ts diff --git a/app/scripts/components/common/map/hooks/use-map-compare.ts b/packages/veda-ui/src/components/common/map/hooks/use-map-compare.ts similarity index 100% rename from app/scripts/components/common/map/hooks/use-map-compare.ts rename to packages/veda-ui/src/components/common/map/hooks/use-map-compare.ts diff --git a/app/scripts/components/common/map/hooks/use-map-style.ts b/packages/veda-ui/src/components/common/map/hooks/use-map-style.ts similarity index 100% rename from app/scripts/components/common/map/hooks/use-map-style.ts rename to packages/veda-ui/src/components/common/map/hooks/use-map-style.ts diff --git a/app/scripts/components/common/map/hooks/use-maps.ts b/packages/veda-ui/src/components/common/map/hooks/use-maps.ts similarity index 100% rename from app/scripts/components/common/map/hooks/use-maps.ts rename to packages/veda-ui/src/components/common/map/hooks/use-maps.ts diff --git a/app/scripts/components/common/map/index.tsx b/packages/veda-ui/src/components/common/map/index.tsx similarity index 100% rename from app/scripts/components/common/map/index.tsx rename to packages/veda-ui/src/components/common/map/index.tsx diff --git a/app/scripts/components/common/map/layer-legend.tsx b/packages/veda-ui/src/components/common/map/layer-legend.tsx similarity index 100% rename from app/scripts/components/common/map/layer-legend.tsx rename to packages/veda-ui/src/components/common/map/layer-legend.tsx diff --git a/app/scripts/components/common/map/map-component.tsx b/packages/veda-ui/src/components/common/map/map-component.tsx similarity index 100% rename from app/scripts/components/common/map/map-component.tsx rename to packages/veda-ui/src/components/common/map/map-component.tsx diff --git a/app/scripts/components/common/map/map-message.tsx b/packages/veda-ui/src/components/common/map/map-message.tsx similarity index 100% rename from app/scripts/components/common/map/map-message.tsx rename to packages/veda-ui/src/components/common/map/map-message.tsx diff --git a/app/scripts/components/common/map/mapbox-style-override.ts b/packages/veda-ui/src/components/common/map/mapbox-style-override.ts similarity index 100% rename from app/scripts/components/common/map/mapbox-style-override.ts rename to packages/veda-ui/src/components/common/map/mapbox-style-override.ts diff --git a/app/scripts/components/common/map/maps.tsx b/packages/veda-ui/src/components/common/map/maps.tsx similarity index 100% rename from app/scripts/components/common/map/maps.tsx rename to packages/veda-ui/src/components/common/map/maps.tsx diff --git a/app/scripts/components/common/map/style-generators/README.md b/packages/veda-ui/src/components/common/map/style-generators/README.md similarity index 100% rename from app/scripts/components/common/map/style-generators/README.md rename to packages/veda-ui/src/components/common/map/style-generators/README.md diff --git a/app/scripts/components/common/map/style-generators/basemap.tsx b/packages/veda-ui/src/components/common/map/style-generators/basemap.tsx similarity index 100% rename from app/scripts/components/common/map/style-generators/basemap.tsx rename to packages/veda-ui/src/components/common/map/style-generators/basemap.tsx diff --git a/app/scripts/components/common/map/style-generators/cmr-timeseries.tsx b/packages/veda-ui/src/components/common/map/style-generators/cmr-timeseries.tsx similarity index 100% rename from app/scripts/components/common/map/style-generators/cmr-timeseries.tsx rename to packages/veda-ui/src/components/common/map/style-generators/cmr-timeseries.tsx diff --git a/app/scripts/components/common/map/style-generators/hooks.ts b/packages/veda-ui/src/components/common/map/style-generators/hooks.ts similarity index 100% rename from app/scripts/components/common/map/style-generators/hooks.ts rename to packages/veda-ui/src/components/common/map/style-generators/hooks.ts diff --git a/app/scripts/components/common/map/style-generators/points-layer.tsx b/packages/veda-ui/src/components/common/map/style-generators/points-layer.tsx similarity index 100% rename from app/scripts/components/common/map/style-generators/points-layer.tsx rename to packages/veda-ui/src/components/common/map/style-generators/points-layer.tsx diff --git a/app/scripts/components/common/map/style-generators/raster-paint-layer.tsx b/packages/veda-ui/src/components/common/map/style-generators/raster-paint-layer.tsx similarity index 100% rename from app/scripts/components/common/map/style-generators/raster-paint-layer.tsx rename to packages/veda-ui/src/components/common/map/style-generators/raster-paint-layer.tsx diff --git a/app/scripts/components/common/map/style-generators/raster-timeseries.tsx b/packages/veda-ui/src/components/common/map/style-generators/raster-timeseries.tsx similarity index 100% rename from app/scripts/components/common/map/style-generators/raster-timeseries.tsx rename to packages/veda-ui/src/components/common/map/style-generators/raster-timeseries.tsx diff --git a/app/scripts/components/common/map/style-generators/utils.spec.ts b/packages/veda-ui/src/components/common/map/style-generators/utils.spec.ts similarity index 100% rename from app/scripts/components/common/map/style-generators/utils.spec.ts rename to packages/veda-ui/src/components/common/map/style-generators/utils.spec.ts diff --git a/app/scripts/components/common/map/style-generators/utils.ts b/packages/veda-ui/src/components/common/map/style-generators/utils.ts similarity index 100% rename from app/scripts/components/common/map/style-generators/utils.ts rename to packages/veda-ui/src/components/common/map/style-generators/utils.ts diff --git a/app/scripts/components/common/map/style-generators/vector-timeseries.tsx b/packages/veda-ui/src/components/common/map/style-generators/vector-timeseries.tsx similarity index 100% rename from app/scripts/components/common/map/style-generators/vector-timeseries.tsx rename to packages/veda-ui/src/components/common/map/style-generators/vector-timeseries.tsx diff --git a/app/scripts/components/common/map/style-generators/wms-timeseries.tsx b/packages/veda-ui/src/components/common/map/style-generators/wms-timeseries.tsx similarity index 100% rename from app/scripts/components/common/map/style-generators/wms-timeseries.tsx rename to packages/veda-ui/src/components/common/map/style-generators/wms-timeseries.tsx diff --git a/app/scripts/components/common/map/style-generators/wmts-timeseries.tsx b/packages/veda-ui/src/components/common/map/style-generators/wmts-timeseries.tsx similarity index 100% rename from app/scripts/components/common/map/style-generators/wmts-timeseries.tsx rename to packages/veda-ui/src/components/common/map/style-generators/wmts-timeseries.tsx diff --git a/app/scripts/components/common/map/style-generators/zarr-timeseries.tsx b/packages/veda-ui/src/components/common/map/style-generators/zarr-timeseries.tsx similarity index 100% rename from app/scripts/components/common/map/style-generators/zarr-timeseries.tsx rename to packages/veda-ui/src/components/common/map/style-generators/zarr-timeseries.tsx diff --git a/app/scripts/components/common/map/style/button.tsx b/packages/veda-ui/src/components/common/map/style/button.tsx similarity index 100% rename from app/scripts/components/common/map/style/button.tsx rename to packages/veda-ui/src/components/common/map/style/button.tsx diff --git a/app/scripts/components/common/map/style/marker-sdf.png b/packages/veda-ui/src/components/common/map/style/marker-sdf.png similarity index 100% rename from app/scripts/components/common/map/style/marker-sdf.png rename to packages/veda-ui/src/components/common/map/style/marker-sdf.png diff --git a/app/scripts/components/common/map/styles.tsx b/packages/veda-ui/src/components/common/map/styles.tsx similarity index 100% rename from app/scripts/components/common/map/styles.tsx rename to packages/veda-ui/src/components/common/map/styles.tsx diff --git a/app/scripts/components/common/map/types.d.ts b/packages/veda-ui/src/components/common/map/types.d.ts similarity index 100% rename from app/scripts/components/common/map/types.d.ts rename to packages/veda-ui/src/components/common/map/types.d.ts diff --git a/app/scripts/components/common/map/utils.ts b/packages/veda-ui/src/components/common/map/utils.ts similarity index 100% rename from app/scripts/components/common/map/utils.ts rename to packages/veda-ui/src/components/common/map/utils.ts diff --git a/app/scripts/components/common/mdx-content.jsx b/packages/veda-ui/src/components/common/mdx-content.js similarity index 100% rename from app/scripts/components/common/mdx-content.jsx rename to packages/veda-ui/src/components/common/mdx-content.js diff --git a/packages/veda-ui/src/components/common/mdx-content.jsx b/packages/veda-ui/src/components/common/mdx-content.jsx new file mode 100644 index 000000000..b0b6fcffa --- /dev/null +++ b/packages/veda-ui/src/components/common/mdx-content.jsx @@ -0,0 +1,69 @@ +import React from 'react'; +import T from 'prop-types'; +import { MDXProvider } from '@mdx-js/react'; + +import { useMdxPageLoader } from '$utils/veda-data/mdx'; +import { S_LOADING, S_SUCCEEDED } from '$utils/status'; +import { ContentLoading } from '$components/common/loading-skeleton'; +import Block from '$components/common/blocks'; +import ContentBlockFigure from '$components/common/blocks/figure'; +import { ContentBlockProse } from '$styles/content-block'; +import Image, { Caption } from '$components/common/blocks/images'; +import { Chapter } from '$components/common/blocks/scrollytelling/chapter'; +import { + LazyChart, + LazyCompareImage, + LazyScrollyTelling, + LazyMap, + LazyMultilayerMap, + LazyTable, + LazyEmbed +} from '$components/common/blocks/lazy-components'; +import { NotebookConnectCalloutBlock } from '$components/common/notebook-connect'; +import SmartLink, { CustomLink } from '$components/common/smart-link'; +import { Widget } from '$libs'; + +function MdxContent(props) { + const pageMdx = useMdxPageLoader(props.loader); + + if (pageMdx.status === S_LOADING) { + return ; + } + + if (pageMdx.status === S_SUCCEEDED) { + return ( + + + + ); + } + + return null; +} + +MdxContent.propTypes = { + loader: T.func, + throughProps: T.object +}; + +export default MdxContent; diff --git a/app/scripts/components/common/meta-tags.jsx b/packages/veda-ui/src/components/common/meta-tags.js similarity index 100% rename from app/scripts/components/common/meta-tags.jsx rename to packages/veda-ui/src/components/common/meta-tags.js diff --git a/packages/veda-ui/src/components/common/meta-tags.jsx b/packages/veda-ui/src/components/common/meta-tags.jsx new file mode 100644 index 000000000..24f7afbf5 --- /dev/null +++ b/packages/veda-ui/src/components/common/meta-tags.jsx @@ -0,0 +1,72 @@ +import React from 'react'; +import T from 'prop-types'; +import { Helmet } from 'react-helmet'; +import { useTheme } from 'styled-components'; +import { useLocation } from 'react-router-dom'; + +const appTitle = process.env.APP_TITLE; +const baseUrl = window.location.origin; + +const defaultMetaImage = `${process.env.PUBLIC_URL ?? ''}/meta/meta-image.png`; + +function MetaTags({ title, description, thumbnail, children }) { + const theme = useTheme(); + const location = useLocation(); + + return ( + + {title} + {description ? : null} + + + {/* Twitter */} + + + + {description ? ( + + ) : null} + + + {/* Open Graph */} + + + + + + {description ? ( + + ) : null} + + {/* Additional children */} + {children} + + {/* Additional javascript */} + {/* @NOTE https://github.com/NASA-IMPACT/veda-ui/pull/846 */} + {process.env.CUSTOM_SCRIPT_SRC ? ( +