From 6fb904f2c9677d17d3667e01572d333dab8b4662 Mon Sep 17 00:00:00 2001 From: Elijah Date: Fri, 6 Sep 2024 17:40:51 +0000 Subject: [PATCH] Get reflex tests to pass --- pyproject.toml | 2 +- reflex_chakra/components/base.py | 16 +++++++++++----- reflex_chakra/constants.py | 4 ++-- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 13e6f4d..1d59e17 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "reflex-chakra" -version = "0.6.0a2" +version = "0.6.0a4" description = "reflex using chakra components" authors = [ "Elijah Ahianyo " diff --git a/reflex_chakra/components/base.py b/reflex_chakra/components/base.py index 7c33814..33c0dd3 100644 --- a/reflex_chakra/components/base.py +++ b/reflex_chakra/components/base.py @@ -56,15 +56,21 @@ def _get_dependencies_imports(cls) -> ImportDict: } @classmethod - def create(cls, *children, **props) -> rx.Component: + def create(cls, *children, **props) -> Component: # copy color mode provider file to client's asset dir if it doesnt exist. + client_asset_dir = Path.cwd() / constants.ASSETS_DIR_NAME if not ( - color_mode_provider := ( - constants.ASSETS_DIR / constants.COLOR_MODE_PROVIDER_FILENAME + client_color_mode_provider := ( + Path.cwd() + / constants.ASSETS_DIR_NAME + / constants.COLOR_MODE_PROVIDER_FILENAME ) ).exists(): - shutil.copy(color_mode_provider, (Path.cwd() / "assets")) - + client_asset_dir.mkdir(exist_ok=True) + shutil.copy( + constants.ASSETS_DIR / constants.COLOR_MODE_PROVIDER_FILENAME, + client_color_mode_provider.parent, + ) return super().create(*children, **props) diff --git a/reflex_chakra/constants.py b/reflex_chakra/constants.py index 15e9fee..a63de53 100644 --- a/reflex_chakra/constants.py +++ b/reflex_chakra/constants.py @@ -1,6 +1,6 @@ from pathlib import Path -ASSET_DIR_NAME = "assets" -ASSETS_DIR = (Path(__file__).parent / ASSET_DIR_NAME).resolve() +ASSETS_DIR_NAME = "assets" +ASSETS_DIR = (Path(__file__).parent / ASSETS_DIR_NAME).resolve() COLOR_MODE_PROVIDER_FILENAME = "chakra_color_mode_provider.js"