-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit a7fcc2f
Showing
23 changed files
with
1,576 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,176 @@ | ||
# Created by https://www.toptal.com/developers/gitignore/api/django | ||
# Edit at https://www.toptal.com/developers/gitignore?templates=django | ||
|
||
### Django ### | ||
*.log | ||
*.pot | ||
*.pyc | ||
__pycache__/ | ||
local_settings.py | ||
db.sqlite3 | ||
db.sqlite3-journal | ||
media | ||
|
||
# If your build process includes running collectstatic, then you probably don't need or want to include staticfiles/ | ||
# in your Git repository. Update and uncomment the following line accordingly. | ||
# <django-project-name>/staticfiles/ | ||
|
||
### Django.Python Stack ### | ||
# Byte-compiled / optimized / DLL files | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
share/python-wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
MANIFEST | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.nox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
*.py,cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
cover/ | ||
|
||
# Translations | ||
*.mo | ||
|
||
# Django stuff: | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
.pybuilder/ | ||
target/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# IPython | ||
profile_default/ | ||
ipython_config.py | ||
|
||
# pyenv | ||
# For a library or package, you might want to ignore these files since the code is | ||
# intended to run in multiple environments; otherwise, check them in: | ||
# .python-version | ||
|
||
# pipenv | ||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. | ||
# However, in case of collaboration, if having platform-specific dependencies or dependencies | ||
# having no cross-platform support, pipenv may install dependencies that don't work, or not | ||
# install all needed dependencies. | ||
#Pipfile.lock | ||
|
||
# poetry | ||
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. | ||
# This is especially recommended for binary packages to ensure reproducibility, and is more | ||
# commonly ignored for libraries. | ||
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control | ||
#poetry.lock | ||
|
||
# pdm | ||
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. | ||
#pdm.lock | ||
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it | ||
# in version control. | ||
# https://pdm.fming.dev/#use-with-ide | ||
.pdm.toml | ||
|
||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm | ||
__pypackages__/ | ||
|
||
# Celery stuff | ||
celerybeat-schedule | ||
celerybeat.pid | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ | ||
.dmypy.json | ||
dmypy.json | ||
|
||
# Pyre type checker | ||
.pyre/ | ||
|
||
# pytype static type analyzer | ||
.pytype/ | ||
|
||
# Cython debug symbols | ||
cython_debug/ | ||
|
||
# PyCharm | ||
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can | ||
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore | ||
# and can be added to the global gitignore or merged into this file. For a more nuclear | ||
# option (not recommended) you can uncomment the following to ignore the entire idea folder. | ||
#.idea/ | ||
|
||
# End of https://www.toptal.com/developers/gitignore/api/django | ||
|
||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
/_static | ||
|
||
# dependencies | ||
/node_modules | ||
/.pnp | ||
.pnp.js | ||
|
||
# testing | ||
/coverage | ||
|
||
# next.js | ||
/.next/ | ||
/out/ | ||
|
||
# production | ||
/build | ||
|
||
# misc | ||
.DS_Store | ||
*.pem | ||
|
||
# debug | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# local env files | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
# vercel | ||
.vercel | ||
|
||
# DS_Store | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
|
||
[install] | ||
registry = "https://registry.npmjs.org" |
53 changes: 53 additions & 0 deletions
53
.web/components/reflex/radix_themes_color_mode_provider.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { useTheme } from "next-themes"; | ||
import { useEffect, useState } from "react"; | ||
import { | ||
ColorModeContext, | ||
defaultColorMode, | ||
isDevMode, | ||
lastCompiledTimeStamp, | ||
} from "$/utils/context.js"; | ||
|
||
export default function RadixThemesColorModeProvider({ children }) { | ||
const { theme, resolvedTheme, setTheme } = useTheme(); | ||
const [rawColorMode, setRawColorMode] = useState(defaultColorMode); | ||
const [resolvedColorMode, setResolvedColorMode] = useState("dark"); | ||
|
||
useEffect(() => { | ||
if (isDevMode) { | ||
const lastCompiledTimeInLocalStorage = | ||
localStorage.getItem("last_compiled_time"); | ||
if ( | ||
lastCompiledTimeInLocalStorage && | ||
lastCompiledTimeInLocalStorage !== lastCompiledTimeStamp | ||
) { | ||
// on app startup, make sure the application color mode is persisted correctly. | ||
setTheme(defaultColorMode); | ||
localStorage.setItem("last_compiled_time", lastCompiledTimeStamp); | ||
return; | ||
} | ||
} | ||
setRawColorMode(theme); | ||
setResolvedColorMode(resolvedTheme); | ||
}, [theme, resolvedTheme]); | ||
|
||
const toggleColorMode = () => { | ||
setTheme(resolvedTheme === "light" ? "dark" : "light"); | ||
}; | ||
const setColorMode = (mode) => { | ||
const allowedModes = ["light", "dark", "system"]; | ||
if (!allowedModes.includes(mode)) { | ||
console.error( | ||
`Invalid color mode "${mode}". Defaulting to "${defaultColorMode}".` | ||
); | ||
mode = defaultColorMode; | ||
} | ||
setTheme(mode); | ||
}; | ||
return ( | ||
<ColorModeContext.Provider | ||
value={{ rawColorMode, resolvedColorMode, toggleColorMode, setColorMode }} | ||
> | ||
{children} | ||
</ColorModeContext.Provider> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { useEffect, useState } from "react" | ||
import { codeToHtml} from "shiki" | ||
|
||
/** | ||
* Code component that uses Shiki to convert code to HTML and render it. | ||
* | ||
* @param code - The code to be highlighted. | ||
* @param theme - The theme to be used for highlighting. | ||
* @param language - The language of the code. | ||
* @param transformers - The transformers to be applied to the code. | ||
* @param decorations - The decorations to be applied to the code. | ||
* @param divProps - Additional properties to be passed to the div element. | ||
* @returns The rendered code block. | ||
*/ | ||
export function Code ({code, theme, language, transformers, decorations, ...divProps}) { | ||
const [codeResult, setCodeResult] = useState("") | ||
useEffect(() => { | ||
async function fetchCode() { | ||
const result = await codeToHtml(code, { | ||
lang: language, | ||
theme, | ||
transformers, | ||
decorations | ||
}); | ||
setCodeResult(result); | ||
} | ||
fetchCode(); | ||
}, [code, language, theme, transformers, decorations] | ||
|
||
) | ||
return ( | ||
<div dangerouslySetInnerHTML={{__html: codeResult}} {...divProps} ></div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"compilerOptions": { | ||
"baseUrl": ".", | ||
"paths": { | ||
"$/*": ["*"], | ||
"@/*": ["public/*"] | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"name": "reflex", | ||
"scripts": { | ||
"dev": "next dev", | ||
"export": "next build", | ||
"export-sitemap": "next build && next-sitemap", | ||
"prod": "next start" | ||
}, | ||
"dependencies": { | ||
"@babel/standalone": "7.26.0", | ||
"@emotion/react": "11.13.3", | ||
"axios": "1.7.7", | ||
"json5": "2.2.3", | ||
"next": "14.2.16", | ||
"next-sitemap": "4.2.3", | ||
"next-themes": "0.3.0", | ||
"react": "18.3.1", | ||
"react-dom": "18.3.1", | ||
"react-focus-lock": "2.13.2", | ||
"socket.io-client": "4.8.1", | ||
"universal-cookie": "7.2.1" | ||
}, | ||
"devDependencies": { | ||
"autoprefixer": "10.4.20", | ||
"postcss": "8.4.47", | ||
"postcss-import": "16.1.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module.exports = { | ||
plugins: { | ||
"postcss-import": {}, | ||
tailwindcss: {}, | ||
autoprefixer: {}, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"version": "0.6.5", "project_hash": 41797754355572169224845275497637032181} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
@import "tailwindcss/base"; | ||
|
||
@import "@radix-ui/themes/styles.css"; | ||
|
||
@tailwind components; | ||
@tailwind utilities; |
Oops, something went wrong.