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

[FEATURE BRANCH] 902 Add E&A #4

Merged
merged 12 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"jsx-quotes": [2, "prefer-single"],
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-require-imports": "off",
"no-useless-escape": "off"
},
"settings": {
Expand Down
67 changes: 67 additions & 0 deletions app/(datasets)/exploration/exploration.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
'use client';
import React, { useState } from 'react';
import Link from 'next/link';
import {
ExplorationAndAnalysis,
DatasetSelectorModal,
useTimelineDatasetAtom,
} from 'app/lib';

export default function ExplorationAnalysis({ datasets }: { datasets: any }) {
const [timelineDatasets, setTimelineDatasets] = useTimelineDatasetAtom();
const [datasetModalRevealed, setDatasetModalRevealed] = useState(
!timelineDatasets.length,
);

const openModal = () => {
setDatasetModalRevealed(true);
};
const closeModal = () => {
setDatasetModalRevealed(false);
};
const transformData = () => {
const data = datasets?.map((post) => ({
...post.metadata,
}));

const result = data?.map((d) => {
const updatedTax = d.taxonomy.map((t) => {
const updatedVals = t.values.map((v) => {
return {
id: v.replace(/ /g, '_').toLowerCase(),
name: v,
};
});
return { ...t, values: updatedVals };
});
return { ...d, taxonomy: updatedTax };
});

return result;
};

const transformed = transformData();

return (
<>
<DatasetSelectorModal
revealed={datasetModalRevealed}
close={closeModal}
linkProperties={{
LinkElement: Link,
pathAttributeKeyName: 'href',
}}
timelineDatasets={timelineDatasets}
setTimelineDatasets={setTimelineDatasets}
datasetPathName={'data-catalog'}
datasets={transformed}
/>

<ExplorationAndAnalysis
datasets={timelineDatasets}
setDatasets={setTimelineDatasets}
openDatasetsSelectionModal={openModal}
/>
</>
);
}
19 changes: 19 additions & 0 deletions app/(datasets)/exploration/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React from 'react';
import { Suspense } from 'react';
import { getDatasets } from 'app/blog/utils/mdx';
import ExplorationAnalysis from './exploration';
import { PageHero } from 'app/lib';

export default function Page() {
const datasets: any[] = getDatasets();
// @TODO: Investigate why we need to set 100vh
return (
<section style={{ height: '100vh' }}>
<h1 className='font-semibold text-2xl mb-8 tracking-tighter'>Datasets</h1>
<Suspense fallback={<>Loading...</>}>
<PageHero title='Exploration' isHidden />
<ExplorationAnalysis datasets={datasets} />
</Suspense>
</section>
);
}
2 changes: 1 addition & 1 deletion app/blog/datasets/no2.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ layers:
stacCol: no2-monthly
name: No2 PT
media:
src: ::file ./img-placeholder-3.jpg
src: /images/dataset/no2--dataset-cover.jpg
alt: Placeholder Image
type: raster
projection:
Expand Down
5 changes: 5 additions & 0 deletions app/components/nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ const navItems: NavItem[] = [
to: '/data-catalog',
type: 'internalLink',
},
{
title: 'Exploration',
to: '/exploration',
type: 'internalLink',
},
{
title: 'Stories',
to: '/stories',
Expand Down
11 changes: 11 additions & 0 deletions app/lib/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
'use client';

import {
CatalogView,
PageHero,
Expand All @@ -18,6 +19,10 @@ import {
NavItem,
InternalNavLink,
NavItemType,
ExplorationAndAnalysis,
DatasetSelectorModal,
timelineDatasetsAtom,
useTimelineDatasetAtom,
} from '@developmentseed/veda-ui';

/**
Expand All @@ -37,6 +42,8 @@ export {
PageMainContent,
PageHeader,
LogoContainer,
ExplorationAndAnalysis,
DatasetSelectorModal,

// MDX Components
Block,
Expand All @@ -50,6 +57,10 @@ export {

// Hooks
useFiltersWithQS,

// State
timelineDatasetsAtom,
useTimelineDatasetAtom,
};

export type { NavItem, InternalNavLink };
35 changes: 35 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const path = require('path');

module.exports = {
typescript: {
// !! WARN !!
Expand All @@ -6,4 +8,37 @@ module.exports = {
// !! WARN !!
ignoreBuildErrors: true,
},
async rewrites() {
return [
{
source: '/public/:path*',
destination: '/:path*',
},
];
},
reactStrictMode: false,
webpack: (config) => {
config.resolve.alias = {
...(config.resolve.alias || {}),
// The following aliases are added to ensure that both the Next.js instance and
// the `veda-ui` library use the same instances of Jotai for state management.
// This resolves the issue of "Detected multiple Jotai instances," which can cause
// unexpected behavior due to multiple instances of Jotai's default store.
// For more details, refer to the GitHub discussion:
// https://github.com/pmndrs/jotai/discussions/2044
jotai: path.resolve(__dirname, 'node_modules', 'jotai'),
'jotai-devtools': path.resolve(
__dirname,
'node_modules',
'jotai-devtools',
),
'jotai-location': path.resolve(
__dirname,
'node_modules',
'jotai-location',
),
'jotai-optics': path.resolve(__dirname, 'node_modules', 'jotai-optics'),
};
return config;
},
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"lint:fix": "eslint . --fix"
},
"dependencies": {
"@developmentseed/veda-ui": "v5.9.1-alpha.1",
"@developmentseed/veda-ui": "v5.9.1-ea.1",
"@devseed-ui/theme-provider": "^4.1.0",
"@tailwindcss/postcss": "4.0.0-alpha.13",
"@types/node": "20.11.17",
Expand Down
1 change: 1 addition & 0 deletions public/geo-data/states/Alabama.geojson
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type": "FeatureCollection", "features": [{"type": "Feature", "properties": {}, "geometry": {"type": "Polygon", "coordinates": [[[-88.46866168669334, 31.89385317399238], [-88.46865920241633, 31.933170576310733], [-88.43114436686193, 32.22763463196482], [-88.42827698418424, 32.250141459941815], [-88.42131129306412, 32.30867767303572], [-88.38924795287043, 32.57812123398054], [-88.37333735943909, 32.71182377640523], [-88.34748978179405, 32.929033352714434], [-88.34008460181684, 32.99126283124968], [-88.31713469455964, 33.18412133197481], [-88.30444259083467, 33.288318325815496], [-88.2745165474868, 33.534000167772966], [-88.25444461198654, 33.698777630159185], [-88.24838694282865, 33.7449062065245], [-88.20722875623257, 34.05833087247609], [-88.20358340443866, 34.086525588743214], [-88.17326241400085, 34.32103735741064], [-88.15490277637316, 34.46303225308384], [-88.1395598842786, 34.58169470693446], [-88.13426338038309, 34.6226579538098], [-88.09788831425054, 34.892199834746584], [-88.15461735379944, 34.92238973932681], [-88.2000643142902, 34.99563395700627], [-88.20295931006918, 35.00802794331506], [-88.00003248830959, 35.005938766348514], [-87.98491653223535, 35.005909873632255], [-87.8518864901609, 35.00565559929407], [-87.68870603727633, 35.00427155132183], [-87.62502538587923, 35.00373147070445], [-87.60609823760473, 35.003518994795556], [-87.22405392076908, 34.999230173005245], [-87.21668327924873, 34.99914742707215], [-87.21075885950805, 34.999048604931076], [-86.8362867127442, 34.99280257794508], [-86.78364843087435, 34.99192465689206], [-86.78362844805642, 34.99192457891524], [-86.46779800936257, 34.990691974949605], [-86.31876077223656, 34.991078443996635], [-86.31127400664408, 34.991097857952724], [-85.86394612421654, 34.987030740157756], [-85.60516501577332, 34.98467800221], [-85.59516555915452, 34.924170577054014], [-85.58281282716214, 34.86043506643982], [-85.56142442411722, 34.750078623435186], [-85.53440587049866, 34.623789827963535], [-85.52689548606261, 34.58868515511463], [-85.51304500216044, 34.523945895178095], [-85.50247174023023, 34.474525412486706], [-85.46314096616099, 34.286190289416595], [-85.42949923034482, 34.1250941769194], [-85.42107346842074, 34.0808118090152], [-85.3988715370056, 33.96412716496118], [-85.38667132976519, 33.90170068564563], [-85.36053318730316, 33.76795617396427], [-85.33811762287395, 33.65311344874203], [-85.31404942094436, 33.529803921272446], [-85.30494526777983, 33.48275520768563], [-85.29434827487117, 33.427991960100975], [-85.23659661642024, 33.12954269645145], [-85.23244221706756, 33.108073686361784], [-85.18611826979271, 32.87013701274417], [-85.18440085454789, 32.86131573795174], [-85.16096378227854, 32.82667077310872], [-85.12453386243115, 32.751628398992665], [-85.11425057482137, 32.730445848312094], [-85.08853335073964, 32.657956998330185], [-85.07607257143788, 32.608066544005496], [-85.06984812165665, 32.58314509869087], [-85.00709984702928, 32.523867178985526], [-85.001130635614, 32.51015397083613], [-84.99978654193777, 32.507066152127145], [-84.97183108591824, 32.442842265387775], [-84.98115072565669, 32.37903934812171], [-84.98346652130796, 32.36318527323646], [-85.00809670631193, 32.336676245991065], [-84.95570474245655, 32.30590934724683], [-84.89184168498939, 32.263397475680925], [-84.91994310661184, 32.230847590834166], [-84.93012807437859, 32.21905034219372], [-84.99776666047504, 32.18544407492317], [-85.05875091156013, 32.136016827868254], [-85.04706526988313, 32.08738767386973], [-85.05141355966413, 32.0622546649714], [-85.06359332985446, 31.991855366068016], [-85.06783167167742, 31.96735640825708], [-85.11403330716034, 31.893358423130998], [-85.14183311695813, 31.83925939443458], [-85.1291612498006, 31.780276773389566], [-85.12544245301237, 31.762967245276556], [-85.11893172137928, 31.732662567830047], [-85.1255314987769, 31.6949634932744], [-85.05817008014218, 31.620225673504148], [-85.05796082765504, 31.570838594187542], [-85.04188172027865, 31.544682606708125], [-85.05168200737626, 31.519538860437027], [-85.07162139644818, 31.468382439512432], [-85.06600536925231, 31.43136145759301], [-85.09248719377122, 31.36287940228733], [-85.08792915468983, 31.32164642025267], [-85.0888300967431, 31.30864617655417], [-85.08977411045, 31.295024422064134], [-85.10819197239478, 31.258589401151443], [-85.10751588461497, 31.18644941329383], [-85.03561498586777, 31.10819045722663], [-85.02110750560303, 31.07546232041761], [-85.01139190673845, 31.05354443821238], [-85.00249877605994, 31.000680406185577], [-85.0312847435387, 31.000645414826554], [-85.14595861440417, 31.000691449316932], [-85.3333182343919, 30.9995535867273], [-85.48829703291239, 30.99796340689892], [-85.49800029856284, 30.997863845507197], [-85.74971426850475, 30.995280241318206], [-85.89363156279192, 30.99345248313637], [-86.03503774463648, 30.993746665075285], [-86.13271989641088, 30.993950541594998], [-86.18724704351855, 30.994064347999984], [-86.36497305739927, 30.994434930434494], [-86.38864378722364, 30.99452616074318], [-86.56349333272723, 30.995199370557163], [-86.6882400757186, 30.996197992634908], [-86.78569092959634, 30.996978433901038], [-86.80995806163894, 30.9971729211558], [-86.83197789224461, 30.997349397542614], [-86.92784976644913, 30.99767330714599], [-87.16264267388274, 30.999021138242913], [-87.163643982357, 30.999016973343267], [-87.31220472848946, 30.99839885419812], [-87.4257898258662, 30.998052439346385], [-87.51953185403575, 30.997546150659876], [-87.59882765604817, 30.99741625308721], [-87.59893570958957, 30.997416076080423], [-87.59206275578497, 30.951454125692347], [-87.63494176777827, 30.86585116392876], [-87.54226692588269, 30.76747534886002], [-87.52361995011823, 30.73827939229858], [-87.44228996116833, 30.69265550236818], [-87.40018799392259, 30.657195559072225], [-87.40118806994435, 30.604377587954822], [-87.43144911804616, 30.5502466002907], [-87.44472114788748, 30.507478620020308], [-87.41468413942101, 30.45728364059038], [-87.36660019223612, 30.436637678028294], [-87.43178303151927, 30.40318762584887], [-87.45228090251491, 30.344091598561945], [-87.51832265843764, 30.2804294896437], [-87.65688631493556, 30.24970325141161], [-87.81886551936462, 30.228307760518874], [-87.8931998738454, 30.239230380380402], [-87.80646444090252, 30.279791831342123], [-87.79671545086318, 30.324191906605634], [-87.86501571627892, 30.383443722928458], [-87.91413480364614, 30.446137707929], [-87.9333537895038, 30.487350768860214], [-87.90170971031772, 30.550872945097073], [-87.91495468196996, 30.58588699923618], [-87.93106860930537, 30.652688129643575], [-88.00839452935675, 30.684950228248614], [-88.06199676227901, 30.644885157091984], [-88.0648968723953, 30.588285989591828], [-88.08161599942282, 30.546310873360035], [-88.10376715067441, 30.500896745799245], [-88.10569839971717, 30.40185846467738], [-88.13617270270248, 30.320722283436226], [-88.19566390331651, 30.321235381487682], [-88.25776414415185, 30.318926517532624], [-88.31160829473214, 30.368901979306983], [-88.36402248229973, 30.388000374757066], [-88.3950237442365, 30.36941954662892], [-88.40393084123424, 30.543354002259633], [-88.41226905207897, 30.73176655778682], [-88.41246646691596, 30.73559302828947], [-88.42601951150728, 30.998277433247004], [-88.43200584141799, 31.114294254633784], [-88.44865979042673, 31.421273803185244], [-88.449445913615, 31.43583369330502], [-88.45947766875939, 31.62164899844101], [-88.4636246990535, 31.69793939197266], [-88.46866820323011, 31.790719163520833], [-88.46866168669334, 31.89385317399238]]]}}]}
1 change: 1 addition & 0 deletions public/geo-data/states/Alaska.geojson

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions public/geo-data/states/Arizona.geojson
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type": "FeatureCollection", "features": [{"type": "Feature", "properties": {}, "geometry": {"type": "Polygon", "coordinates": [[[-114.79968049507946, 32.593617038382725], [-114.80939055353772, 32.61711508454391], [-114.76494756986516, 32.64938716114304], [-114.719630727165, 32.718759493048154], [-114.70571476645888, 32.74157761811038], [-114.6674907685223, 32.73422281888855], [-114.61572265941669, 32.74127628619236], [-114.57067278121927, 32.747414381776544], [-114.54025820267232, 32.77482682109624], [-114.53174388523249, 32.78250071491071], [-114.468969059555, 32.84515331528765], [-114.46312521083684, 32.90188254039722], [-114.47663825651051, 32.92362654094441], [-114.48131337950633, 32.97206268591537], [-114.51134141869896, 33.02345378226296], [-114.51749051332934, 33.02471472066436], [-114.57515967231916, 33.036540398511725], [-114.62829194782573, 33.031049971672914], [-114.67080211245317, 33.03798169290049], [-114.70617388693672, 33.10533274235738], [-114.67935748681043, 33.15951723476831], [-114.67809509622276, 33.23029859996053], [-114.67448900522413, 33.255595767637224], [-114.72325724133972, 33.288077517247885], [-114.70796035940903, 33.3234198946759], [-114.70734658131093, 33.37662725851748], [-114.72528072692432, 33.40504734268596], [-114.67389970839447, 33.418298728474134], [-114.6351816731904, 33.42272596865667], [-114.62914523173961, 33.43354505289043], [-114.59728193551867, 33.490653440907906], [-114.52459783302486, 33.55223159519706], [-114.52918476478888, 33.60665044217473], [-114.5251996927051, 33.66158330733132], [-114.5049916573795, 33.693022249231184], [-114.49656362573951, 33.71915518317458], [-114.50486158100705, 33.76046510507448], [-114.52046349595389, 33.827778196751815], [-114.50563647004458, 33.86427628845206], [-114.50870642804908, 33.90064034350373], [-114.53498536774498, 33.92849929885891], [-114.50956636625116, 33.95726443744126], [-114.45480534877537, 34.0109684394551], [-114.43550237234861, 34.04261534168273], [-114.43008953474069, 34.07893167207326], [-114.4280244052976, 34.09278723781606], [-114.40593942051581, 34.11154018122659], [-114.34805044330967, 34.134458097964604], [-114.29280447046477, 34.16672503610401], [-114.22971341889753, 34.186928004754115], [-114.17804828873248, 34.239968940742564], [-114.13905312390197, 34.259537890573895], [-114.14081504820906, 34.30312739190122], [-114.14092788228322, 34.305918877242476], [-114.17284271089454, 34.34497891133534], [-114.26431441368602, 34.4013290100958], [-114.33536934712852, 34.45003783785245], [-114.37884952319659, 34.45037572979956], [-114.37822032563018, 34.51652061773978], [-114.4223796963633, 34.58071024989787], [-114.46524406582022, 34.69120068097285], [-114.49096917632626, 34.72484644493427], [-114.57645007537248, 34.81529790196165], [-114.63438021401147, 34.872887603918926], [-114.62976789334928, 34.943037639400174], [-114.63348643384882, 35.00185463728985], [-114.62506905212982, 35.068475952224716], [-114.61990552654062, 35.12163019009067], [-114.59912050090037, 35.12104827151869], [-114.57274761090396, 35.138723441775575], [-114.58713055852209, 35.26237488999287], [-114.62713906682681, 35.4095038417272], [-114.66450229203548, 35.44949706104509], [-114.66310748485502, 35.52449158457802], [-114.65597016541906, 35.58799892808662], [-114.6534087618416, 35.610790109202036], [-114.68941002422906, 35.65141332475635], [-114.69731234165624, 35.733687828196956], [-114.70371329099326, 35.81458721149992], [-114.66969008715714, 35.865086423337644], [-114.70027410695423, 35.90177459206899], [-114.73116211433158, 35.943918792192385], [-114.74278206195555, 36.00996612073642], [-114.74330246289087, 36.065938690073054], [-114.74334522975607, 36.07053854890358], [-114.73616829911674, 36.10437075909998], [-114.6665411037572, 36.117346541357925], [-114.62785803084711, 36.14101545175686], [-114.57203386387509, 36.15161318169238], [-114.5117236555182, 36.15095885109797], [-114.4870365213571, 36.129398747862524], [-114.4486563566883, 36.12641259343605], [-114.4169522713007, 36.14576344780412], [-114.37210808386054, 36.14311626537668], [-114.33727484359031, 36.10802215877995], [-114.3161106207348, 36.063111123071224], [-114.27064632722723, 36.035721978442076], [-114.21369110059722, 36.01561492630623], [-114.15172600541173, 36.02456492199527], [-114.13820401004192, 36.05316290194179], [-114.09987093496024, 36.121655879525626], [-114.04683867143814, 36.194070886258324], [-114.04822664274671, 36.26887585533595], [-114.04758466164829, 36.325574814275804], [-114.04949367837561, 36.60406046514888], [-114.05016115251365, 36.843142548478994], [-114.0506000275006, 37.00039676502365], [-113.96590707809193, 37.000025895355535], [-112.96647064012362, 37.00022033029617], [-112.89919075222966, 37.00030239753214], [-112.82950202105441, 37.00038740301284], [-112.5450947443048, 37.00073456165598], [-112.53857175748671, 37.00074468261358], [-112.35769051712774, 37.00102506229384], [-111.41301343446115, 37.00147918365635], [-111.40586844707802, 37.001482621357525], [-111.27828544516788, 37.00046688510211], [-111.25076146941052, 37.000716982140865], [-111.06649622943971, 37.002390522537205], [-110.75069032629202, 37.00319791711757], [-110.47019009588625, 36.99799752948285], [-110.00067683223675, 36.99796872139528], [-109.49533709707025, 36.99910636192628], [-109.0452220229491, 36.99908516713863], [-109.04543159342644, 36.87459030706912], [-109.04572942164799, 36.11702741506394], [-109.04587170087144, 36.00270047287411], [-109.04602433899116, 35.879799064918046], [-109.04629594797814, 35.61425065565696], [-109.04679587614086, 35.363606288056936], [-109.04635580174114, 35.17550796314418], [-109.04585078515446, 34.95981956514763], [-109.0458505492812, 34.95971904884345], [-109.04613697334015, 34.57929096240392], [-109.04618001486813, 34.5223929072541], [-109.0464250908658, 33.87505232805716], [-109.04660843894702, 33.777407157801875], [-109.0472980596231, 33.409783550663235], [-109.04723722609376, 33.208965661144006], [-109.04723720659476, 33.20889566199532], [-109.04711694897496, 32.777795460941064], [-109.04711688640391, 32.77757146036835], [-109.04761247148485, 32.42637845273027], [-109.04829670066489, 32.08409372269792], [-109.04919751204066, 31.796551080147328], [-109.05004812742739, 31.332501237912357], [-109.49449376386781, 31.3333946318122], [-109.82969265910826, 31.33406852544659], [-110.45975431753436, 31.333145006768376], [-111.07482582764027, 31.332242367553818], [-111.36678310454226, 31.424767967188668], [-112.36504301072623, 31.74113225938428], [-113.33376866910554, 32.04025641411806], [-113.75074609375687, 32.169010138628856], [-114.813613, 32.494277], [-114.811536, 32.522834], [-114.79563240395275, 32.550951951448134], [-114.81418245844493, 32.564783980689064], [-114.79968049507946, 32.593617038382725]]]}}]}
Loading