Skip to content
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: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
"next": "15.3.1",
"next-themes": "^0.4.6",
"quick-lru": "^7.0.1",
"r3f-perf": "^7.2.3",
"random-words": "^2.0.1",
"rc-slider": "^11.1.8",
"react": "^19.0.0",
Expand Down
2 changes: 1 addition & 1 deletion src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type { Metadata } from "next";
import { ThemeProvider } from 'next-themes'
import { Navbar, Footer, Overlays} from "@/components/ui";

import "./globals.css";

export const metadata: Metadata = {
Expand All @@ -14,6 +13,7 @@ export default function RootLayout({
}: Readonly<{
children: React.ReactNode;
}>) {

return (
<html suppressHydrationWarning lang="en">
<body className="antialiased">
Expand Down
16 changes: 13 additions & 3 deletions src/components/LandingHome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { useEffect, useMemo } from 'react';
import { Analysis, PlotArea, Plot } from '@/components/plots';
import { GetColorMapTexture } from '@/components/textures';
import { MiddleSlider } from '@/components/ui';
import { Metadata, ShowAnalysis, Loading } from '@/components/ui';
import { Metadata, ShowAnalysis, Loading, Navbar } from '@/components/ui';
import { useGlobalStore } from '@/utils/GlobalStates';
import { useShallow, shallow } from 'zustand/shallow';
import { PaneStore } from '@/components/zarr/PaneStore';
Expand Down Expand Up @@ -40,14 +40,16 @@ export function LandingHome() {
}, [initStore]);

const { title, description } = titleDescription;
const { setColormap, setVariables, colormap, timeSeries, variable, metadata } = useGlobalStore(
const { setColormap, setVariables, setPlotOn, colormap, timeSeries, variable, metadata, plotOn } = useGlobalStore(
useShallow(state => ({
setColormap: state.setColormap,
setVariables: state.setVariables,
setPlotOn: state.setPlotOn,
colormap: state.colormap,
timeSeries: state.timeSeries,
variable: state.variable,
metadata: state.metadata,
plotOn: state.plotOn
}))
);
const [showLoading, setShowLoading] = useState<boolean>(false);
Expand Down Expand Up @@ -77,13 +79,21 @@ export function LandingHome() {
canvasWidth,
}
}), [ZarrDS, canvasWidth]);

useEffect(()=>{
if (variable === "Default"){
setCanvasWidth(0);
setPlotOn(false)
}
},[variable])

return (
<>
{!plotOn && <Navbar />}
{canvasWidth < 10 && variable != "Default" && <ShowAnalysis onClick={()=>setCanvasWidth(window.innerWidth*.5)} canvasWidth={canvasWidth} />}
{canvasWidth > 10 && <MiddleSlider canvasWidth={canvasWidth} setCanvasWidth={setCanvasWidth}/>}
<Loading showLoading={showLoading} />
{canvasWidth > 10 && <Analysis values={analysisObj.values} />}
{canvasWidth > 10 && variable != "Default" && <Analysis values={analysisObj.values} />}
{variable === "Default" && <VariableScroller zMeta={zMeta}/>}
{variable != "Default" && <Plot values={plotObj} setShowLoading={setShowLoading} />}
{metadata && <Metadata data={metadata} /> }
Expand Down
8 changes: 5 additions & 3 deletions src/components/plots/Plot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,17 @@ const Plot = ({values,setShowLoading}:PlotParameters) => {
setMetadata,
setDimArrays,
setDimNames,
setDimUnits} = useGlobalStore(
setDimUnits,
setPlotOn} = useGlobalStore(
useShallow(state => ({ //UseShallow for object returns
setShape:state.setShape,
setFlipY:state.setFlipY,
setValueScales:state.setValueScales,
setMetadata: state.setMetadata,
setDimArrays:state.setDimArrays,
setDimNames:state.setDimNames,
setDimUnits:state.setDimUnits}
setDimUnits:state.setDimUnits,
setPlotOn: state.setPlotOn}
)))
const {colormap, variable, isFlat, setIsFlat} = useGlobalStore(useShallow(state=>({
colormap: state.colormap, variable: state.variable, isFlat: state.isFlat, setIsFlat: state.setIsFlat
Expand Down Expand Up @@ -110,6 +112,7 @@ const Plot = ({values,setShowLoading}:PlotParameters) => {
setShape(new THREE.Vector3(2, shapeRatio, 2));
setShowLoading(false)
setShow(true)
setPlotOn(true)
})
//Get Metadata
ZarrDS.GetAttributes(variable).then((result)=>{
Expand Down Expand Up @@ -149,7 +152,6 @@ const Plot = ({values,setShowLoading}:PlotParameters) => {
width: windowWidth - canvasWidth
}}
>
{plotType == "volume" && !isFlat && <PlotLineButton />}
<Nav />

{!isFlat && <>
Expand Down
17 changes: 11 additions & 6 deletions src/components/ui/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { LuChevronsUpDown } from "react-icons/lu";
import { IoIosCheckmark } from "react-icons/io";
import { ZARR_STORES } from "../zarr/ZarrLoaderLRU";
import Image from "next/image";
import { AboutButton, PlotTweaker } from "@/components/ui";
import { AboutButton, PlotTweaker, PlotLineButton } from "@/components/ui";
import ThemeSwitch from "@/components/ui/ThemeSwitch";
import logo from "@/app/logo.png"
import './css/Navbar.css'
Expand Down Expand Up @@ -105,18 +105,20 @@ const ColorMaps = ({cmap, setCmap} : {cmap : string, setCmap : React.Dispatch<Re
}

const Navbar = React.memo(function Navbar(){
const {setInitStore, setVariable, setColormap, setTimeSeries, isFlat, plotOn} = useGlobalStore(
const {setInitStore, setVariable, setColormap, setTimeSeries, isFlat, plotOn, variables} = useGlobalStore(
useShallow(state=>({
setInitStore : state.setInitStore,
setVariable : state.setVariable,
setColormap : state.setColormap,
setTimeSeries: state.setTimeSeries,
isFlat: state.isFlat,
plotOn: state.plotOn
plotOn: state.plotOn,
variables: state.variables
})))

const variables = useGlobalStore(useShallow(state=>state.variables))
const setPlotType = usePlotStore(state=> state.setPlotType)

const {setPlotType} = usePlotStore(useShallow(state=> ({
setPlotType: state.setPlotType})))
const [cmap, setCmap] = useState<string>("Default")
const [flipCmap, setFlipCmap] = useState<boolean>(false)
const colormap = useGlobalStore(useShallow(state=>state.colormap))
Expand Down Expand Up @@ -151,6 +153,7 @@ const Navbar = React.memo(function Navbar(){
</DropdownMenuItem>
</DropdownMenuGroup>
<DropdownMenuSeparator />
{plotOn && <>
<DropdownMenuSub>
<DropdownMenuSubTrigger>Plot Type</DropdownMenuSubTrigger>
<DropdownMenuPortal>
Expand All @@ -166,6 +169,7 @@ const Navbar = React.memo(function Navbar(){
<Button className="w-[100%] h-[20px] cursor-[pointer]" variant="destructive" onClick={()=>setFlipCmap(x=>!x)}>Flip Colormap</Button>
</DropdownMenuSub>
<DropdownMenuSeparator />
</>}
<DropdownMenuItem>
<a href="https://github.com/EarthyScience/Browzarr/" target="_blank" rel="noopener noreferrer">
GitHub
Expand All @@ -189,7 +193,8 @@ const Navbar = React.memo(function Navbar(){
</SelectContent>
</Select>

{!isFlat && <PlotTweaker/>}
{!isFlat && plotOn && <PlotTweaker/>}
{!isFlat && plotOn && <PlotLineButton />}
</div>
<ThemeSwitch />
<AboutButton />
Expand Down
36 changes: 33 additions & 3 deletions src/components/ui/PlotLineButton.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import React from 'react'
import lineIcon from '@/assets/line-graph.svg'
"use client";

import React, {useState} from 'react'
import { IoMdInformationCircleOutline } from "react-icons/io";
import { VscGraphLine } from "react-icons/vsc"; //Use this if you hate the svg
import { usePlotStore } from '@/utils/GlobalStates'
import { useShallow } from 'zustand/shallow';
Expand All @@ -11,14 +13,42 @@ const PlotLineButton = () => {
setSelectTS: state.setSelectTS
})))

const [showInfo, setShowInfo] = useState(false)

return (

<div className='selectTS' onClick={()=> setSelectTS(!selectTS)}>
<VscGraphLine size={40}
style={{
color:selectTS ? "red" : "grey",
filter: selectTS ? "drop-shadow(0px 0px 10px red)" : ""
filter: selectTS ? "drop-shadow(0px 0px 10px red)" : "",
cursor:'pointer'
}}/>
<IoMdInformationCircleOutline
style={{
height:'15px',
position:'absolute',
right:'-10px',
bottom:'0',
zIndex:'3'
}}
onPointerEnter={e=>setShowInfo(true)}
onPointerLeave={e=>setShowInfo(false)}
/>
<div
style={{
position:'absolute',
width:'100px',
top:'100%',
left:'100%',
borderRadius: '6px',
display: showInfo ? '' : 'none',
background: 'rgb(223, 234, 255)',
padding:'2px'
}}
>
While active, Click the volume to view 1D transects through the given dimension
</div>
</div>
)
}
Expand Down
2 changes: 2 additions & 0 deletions src/components/ui/css/Navbar.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
display: flex;
position: absolute;
justify-content: space-between;
align-content: center;
top: 4px;
left: 8px;
right: 4px;
Expand Down Expand Up @@ -44,6 +45,7 @@
.navbar-left {
display: flex;
align-items: center;
align-content: center;
}

.nav-dropdown {
Expand Down
10 changes: 3 additions & 7 deletions src/components/ui/css/PlotLineButton.css
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
.selectTS{
width: 50px;
height: 50px;
position: absolute;
right: 20px;
top: 45%;
z-index: 5;
cursor: pointer;
z-index: 1;
padding-left: 10px;
position: relative;
}