From 16dbf9378b1b8e6cb7aa831f69347d61b897beaa Mon Sep 17 00:00:00 2001 From: Gustav Date: Tue, 7 Jan 2025 16:05:07 -0500 Subject: [PATCH] feat: add theme selection and pathfinder theme --- assets/css/app.css | 2 + assets/js/hooks/Mapper/MapRoot.tsx | 2 +- .../Mapper/components/map/Map.module.scss | 2 +- assets/js/hooks/Mapper/components/map/Map.tsx | 10 +- .../ContextMenuConnection.module.scss | 10 +- .../SolarSystemEdge.module.scss | 12 +- .../SolarSystemNode.module.scss | 114 ++--- .../SolarSystemNode/SolarSystemNode.tsx | 59 ++- .../UnsplashedSignature.module.scss | 2 +- .../components/map/hooks/useBackgroundVars.ts | 42 ++ .../map/styles/eve-common-variables.scss | 180 ++++--- .../components/map/styles/eve-common.scss | 465 +++++++----------- .../Mapper/components/map/styles/index.scss | 2 + .../components/map/styles/neon-theme.scss | 135 ++--- .../components/map/styles/neon-variables.scss | 7 - .../map/styles/pathfinder-theme.scss | 197 ++++++++ .../mapRootContent/MapRootContent.tsx | 44 +- .../components/MapSettings/MapSettings.tsx | 86 +++- .../components/mapWrapper/MapWrapper.tsx | 2 + .../mapRootProvider/MapRootProvider.tsx | 5 +- lib/wanderer_app_web/router.ex | 3 +- 21 files changed, 816 insertions(+), 565 deletions(-) create mode 100644 assets/js/hooks/Mapper/components/map/hooks/useBackgroundVars.ts create mode 100644 assets/js/hooks/Mapper/components/map/styles/index.scss delete mode 100644 assets/js/hooks/Mapper/components/map/styles/neon-variables.scss create mode 100644 assets/js/hooks/Mapper/components/map/styles/pathfinder-theme.scss diff --git a/assets/css/app.css b/assets/css/app.css index 979a28b7..be18e0e1 100644 --- a/assets/css/app.css +++ b/assets/css/app.css @@ -3,6 +3,8 @@ @import 'primereact/resources/themes/arya-blue/theme.css' layer(primereact); /*@import 'primereact/resources/themes/bootstrap4-dark-blue/theme.css' layer(primereact);*/ +@import '../js/hooks/Mapper/components/map/styles/index.scss'; + @layer tailwind-base { @tailwind base; } diff --git a/assets/js/hooks/Mapper/MapRoot.tsx b/assets/js/hooks/Mapper/MapRoot.tsx index 509b3717..3b249c12 100644 --- a/assets/js/hooks/Mapper/MapRoot.tsx +++ b/assets/js/hooks/Mapper/MapRoot.tsx @@ -7,7 +7,7 @@ import { ErrorInfo, useCallback, useEffect, useRef } from 'react'; import { useMapperHandlers } from './useMapperHandlers'; import './common-styles/main.scss'; -import { MapRootProvider } from '@/hooks/Mapper/mapRootProvider'; +import { MapRootProvider, useMapRootState } from '@/hooks/Mapper/mapRootProvider'; import { MapRootContent } from '@/hooks/Mapper/components/mapRootContent/MapRootContent.tsx'; const ErrorFallback = () => { diff --git a/assets/js/hooks/Mapper/components/map/Map.module.scss b/assets/js/hooks/Mapper/components/map/Map.module.scss index acd46898..c0ce4e3e 100644 --- a/assets/js/hooks/Mapper/components/map/Map.module.scss +++ b/assets/js/hooks/Mapper/components/map/Map.module.scss @@ -4,5 +4,5 @@ } .BackgroundAlternateColor { - + background-color: var(--rf-soft-bg-color, #2f2f2f); } diff --git a/assets/js/hooks/Mapper/components/map/Map.tsx b/assets/js/hooks/Mapper/components/map/Map.tsx index 9e007176..97eefe6e 100644 --- a/assets/js/hooks/Mapper/components/map/Map.tsx +++ b/assets/js/hooks/Mapper/components/map/Map.tsx @@ -16,8 +16,6 @@ import ReactFlow, { } from 'reactflow'; import 'reactflow/dist/style.css'; import classes from './Map.module.scss'; -import './styles/neon-theme.scss'; -import './styles/eve-common.scss'; import { MapProvider, useMapState } from './MapProvider'; import { useNodesState, useEdgesState, useMapHandlers, useUpdateNodes } from './hooks'; import { MapHandlers, OutCommand, OutCommandHandler } from '@/hooks/Mapper/types/mapHandlers.ts'; @@ -35,6 +33,7 @@ import { SolarSystemConnection, SolarSystemRawType } from '@/hooks/Mapper/types' import { ctxManager } from '@/hooks/Mapper/utils/contextManager.ts'; import { NodeSelectionMouseHandler } from '@/hooks/Mapper/components/contexts/types.ts'; import clsx from 'clsx'; +import { useBackgroundVars } from './hooks/useBackgroundVars'; const DEFAULT_VIEW_PORT = { zoom: 1, x: 0, y: 0 }; @@ -101,6 +100,7 @@ interface MapCompProps { isThickConnections?: boolean; isShowBackgroundPattern?: boolean; isSoftBackground?: boolean; + theme?: string; } const MapComp = ({ @@ -117,6 +117,7 @@ const MapComp = ({ isThickConnections, isShowBackgroundPattern, isSoftBackground, + theme, onAddSystem, }: MapCompProps) => { const { getNode, getNodes } = useReactFlow(); @@ -128,6 +129,7 @@ const MapComp = ({ const { handleRootContext, ...rootCtxProps } = useContextMenuRootHandlers({ onAddSystem }); const { handleConnectionContext, ...connectionCtxProps } = useContextMenuConnectionHandlers(); const { update } = useMapState(); + const { variant, gap, size, color } = useBackgroundVars(theme); const onConnect: OnConnect = useCallback( params => { @@ -229,7 +231,7 @@ const MapComp = ({ return ( <> -
+
{isShowMinimap && } - {isShowBackgroundPattern && } + {isShowBackgroundPattern && } {/*