Add tailwind and daisyUI

This commit is contained in:
badblocks 2025-02-26 17:18:48 -08:00
parent 80da7be559
commit 0b8e6c2d50
19 changed files with 2292 additions and 24289 deletions

4
.dockerignore Normal file
View file

@ -0,0 +1,4 @@
fly.toml
.git/
*.sqlite3
.venv

317
.gitignore vendored
View file

@ -13,3 +13,320 @@ media
# Virtual environment
.venv
## Node.gitignore
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# Snowpack dependency directory (https://snowpack.dev/)
web_modules/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional stylelint cache
.stylelintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local
# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache
# Next.js build output
.next
out
# Nuxt.js build / generate output
.nuxt
dist
# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public
# vuepress build output
.vuepress/dist
# vuepress v2.x temp and cache directory
.temp
.cache
# vitepress build output
**/.vitepress/dist
# vitepress cache directory
**/.vitepress/cache
# Docusaurus cache and generated files
.docusaurus
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# TernJS port file
.tern-port
# Stores VSCode versions used for testing VSCode extensions
.vscode-test
# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
## Python.gitignore
# Byte-compiled / optimized / DLL files
__pycache__/
*.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
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# 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
# UV
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
#uv.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/latest/usage/project/#working-with-version-control
.pdm.toml
.pdm-python
.pdm-build/
# 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/
# Ruff stuff:
.ruff_cache/
# PyPI configuration file
.pypirc
## Fly.io
fly.toml

View file

@ -19,6 +19,10 @@ RUN set -ex && \
# Copy local project
COPY . /code/
ENV HOME=/code
# Install NPM & node.js
RUN apt-get update && apt-get install -y nodejs npm
# Expose port 8000
EXPOSE 8000

View file

@ -16,12 +16,13 @@ SECRET_KEY = "django-insecure-0peo@#x9jur3!h$ryje!$879xww8y1y66jx!%*#ymhg&jkozs2
DEBUG = True
# https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts
ALLOWED_HOSTS = ["localhost", "0.0.0.0", "127.0.0.1"]
ALLOWED_HOSTS = ["localhost", "0.0.0.0", "127.0.0.1", "pocket-trade-dev.fly.dev"]
# Application definition
# https://docs.djangoproject.com/en/dev/ref/settings/#installed-apps
INSTALLED_APPS = [
"django_daisy",
"django.contrib.admin",
"django.contrib.auth",
"django.contrib.contenttypes",
@ -30,7 +31,6 @@ INSTALLED_APPS = [
"whitenoise.runserver_nostatic",
"django.contrib.staticfiles",
"django.contrib.sites",
# Third-party
"allauth",
"allauth.account",
'allauth.socialaccount.providers.google',
@ -39,9 +39,8 @@ INSTALLED_APPS = [
"debug_toolbar",
"el_pagination",
"tailwind",
#"theme",
"theme",
"django_browser_reload",
# Local
"accounts",
"cards",
"home",
@ -49,6 +48,8 @@ INSTALLED_APPS = [
"friend_codes"
]
TAILWIND_APP_NAME = 'theme'
# https://docs.djangoproject.com/en/dev/ref/settings/#middleware
MIDDLEWARE = [
"django.middleware.security.SecurityMiddleware",
@ -65,6 +66,11 @@ MIDDLEWARE = [
"django_project.middleware.AutoLoginMiddleware",
]
DAISY_SETTINGS = {
'SITE_TITLE': 'Pocket.Trade Admin',
'DONT_SUPPORT_ME': True,
}
# https://docs.djangoproject.com/en/dev/ref/settings/#root-urlconf
ROOT_URLCONF = "django_project.urls"
@ -75,7 +81,8 @@ WSGI_APPLICATION = "django_project.wsgi.application"
TEMPLATES = [
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [BASE_DIR / "templates"],
#"DIRS": [BASE_DIR / "templates"],
"DIRS": [BASE_DIR / "theme", BASE_DIR / "templates"],
"APP_DIRS": True,
"OPTIONS": {
"context_processors": [
@ -105,6 +112,17 @@ DATABASES = {
"PASSWORD": "postgres",
"HOST": "db", # set in docker-compose.yml
"PORT": 5432, # default postgres port
},
"neon": {
"ENGINE": "django.db.backends.postgresql",
"NAME": "pocket-trade",
"USER": "pocket_trade_owner",
"PASSWORD": "npg_f1lTpOX7Rnvb",
"HOST": "ep-cool-cake-a6zvgu85-pooler.us-west-2.aws.neon.tech", # set in docker-compose.yml
"PORT": 5432, # default postgres port
"OPTIONS": {
"sslmode": "require"
},
}
}

View file

@ -1,7 +1,7 @@
services:
web:
build: .
command: python /code/manage.py runserver 0.0.0.0:8000
command: python /code/manage.py runserver 0.0.0.0:8000 &; python /code/manage.py tailwind start; fg
volumes:
- .:/code:z
ports:

View file

@ -10,6 +10,7 @@ Django==5.1.2
django-allauth==65.0.2
django-browser-reload==1.17.0
django-crispy-forms==2.3
django-daisy==1.0.11
django-debug-toolbar==4.4.6
django-el-pagination==4.1.2
django-tailwind-4[reload]==0.1.4

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

View file

@ -18,8 +18,6 @@
integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.5/font/bootstrap-icons.css">
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
{# <link rel="stylesheet" href="{% static 'css/darkly.min.css' %}"> #}
{# <link rel="stylesheet" href="{% static 'css/flatly.min.css' %}"> #}
<link rel="stylesheet" href="{% static 'css/base.css' %}">
{% block css %}
{% endblock %}

0
theme/__init__.py Normal file
View file

5
theme/apps.py Normal file
View file

@ -0,0 +1,5 @@
from django.apps import AppConfig
class ThemeConfig(AppConfig):
name = 'theme'

1767
theme/static_src/package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,29 @@
{
"name": "theme",
"version": "3.8.0",
"description": "",
"scripts": {
"start": "npm run dev",
"build": "npm run build:clean && npm run build:tailwind",
"build:clean": "rimraf ../static/css/dist",
"build:tailwind": "cross-env NODE_ENV=production tailwindcss --postcss -i ./src/styles.css -o ../static/css/dist/styles.css --minify",
"dev": "cross-env NODE_ENV=development tailwindcss --postcss -i ./src/styles.css -o ../static/css/dist/styles.css -w",
"tailwindcss": "node ./node_modules/tailwindcss/lib/cli.js"
},
"keywords": [],
"author": "",
"license": "MIT",
"devDependencies": {
"@tailwindcss/aspect-ratio": "^0.4.2",
"@tailwindcss/forms": "^0.5.10",
"@tailwindcss/typography": "^0.5.16",
"cross-env": "^7.0.3",
"postcss": "^8.5.1",
"postcss-import": "^16.1.0",
"postcss-nested": "^7.0.2",
"postcss-simple-vars": "^7.0.1",
"rimraf": "^6.0.1",
"tailwindcss": "^4.0.0",
"@tailwindcss/cli": "^4.0.0"
}
}

View file

@ -0,0 +1,8 @@
module.exports = {
plugins: {
//"postcss-import": {},
//"postcss-simple-vars": {},
//"postcss-nested": {},
"@tailwindcss/postcss": {}
},
}

View file

@ -0,0 +1,75 @@
/*
* This is where you can configure the folders that Tailwind will scan.
*
* For detailed documents, check the Tailwind docs at:
*
* https://tailwindcss.com/docs/detecting-classes-in-source-files#explicitly-registering-sources
*
* This default configuration will scan all folder in your root project directory.
*
* Here is an example configuration that will only scan your templates/ folder:
*
* @import "tailwindcss" source(none);
*
* @source "../../../templates";
*/
@import "tailwindcss" source("../../../");
/*
* If you would like to customise you theme, you can do that here too.
*
* https://tailwindcss.com/docs/theme
*
*/
@theme {}
/*
* You can install tailwind plugins like below.
*
* https://tailwindcss.com/docs/functions-and-directives#plugin-directive
*
*/
@plugin "@tailwindcss/forms";
@plugin "@tailwindcss/typography";
@plugin "@tailwindcss/aspect-ratio";
@plugin "daisyui/theme" {
name: "acid";
default: false;
prefersdark: true;
color-scheme: "dark";
--color-base-100: oklch(98% 0 0);
--color-base-200: oklch(92% 0 0);
--color-base-300: oklch(87% 0 0);
--color-base-content: oklch(0% 0 0);
--color-primary: #CF36E0;
--color-primary-content: oklch(98% 0.003 247.858);
--color-secondary: #8040E0;
--color-secondary-content: oklch(98% 0.003 247.858);
--color-accent: #1070EB;
--color-accent-content: oklch(18.556% 0.052 122.962);
--color-neutral: oklch(43% 0 0);
--color-neutral-content: oklch(98% 0.003 247.858);
--color-info: #302FD9;
--color-info-content: oklch(98% 0.003 247.858);
--color-success: #20AA80;
--color-success-content: oklch(12% 0.042 264.695);
--color-warning: #EB8600;
--color-warning-content: oklch(18.202% 0.042 100.5);
--color-error: #E00202;
--color-error-content: oklch(98% 0.003 247.858);
--radius-selector: 0rem;
--radius-field: 0rem;
--radius-box: 0rem;
--size-selector: 0.3125rem;
--size-field: 0.3125rem;
--border: 1.5px;
--depth: 1;
--noise: 0;
}

View file

@ -0,0 +1,57 @@
/**
* This is a minimal config.
*
* If you need the full config, get it from here:
* https://unpkg.com/browse/tailwindcss@latest/stubs/defaultConfig.stub.js
*/
module.exports = {
content: [
/**
* HTML. Paths to Django template files that will contain Tailwind CSS classes.
*/
/* Templates within theme app (<tailwind_app_name>/templates), e.g. base.html. */
'../templates/**/*.html',
/*
* Main templates directory of the project (BASE_DIR/templates).
* Adjust the following line to match your project structure.
*/
'../../templates/**/*.html',
/*
* Templates in other django apps (BASE_DIR/<any_app_name>/templates).
* Adjust the following line to match your project structure.
*/
'../../**/templates/**/*.html',
/**
* JS: If you use Tailwind CSS in JavaScript, uncomment the following lines and make sure
* patterns match your project structure.
*/
/* JS 1: Ignore any JavaScript in node_modules folder. */
// '!../../**/node_modules',
/* JS 2: Process all JavaScript files in the project. */
// '../../**/*.js',
/**
* Python: If you use Tailwind CSS classes in Python, uncomment the following line
* and make sure the pattern below matches your project structure.
*/
// '../../**/*.py'
],
theme: {
extend: {},
},
plugins: [
/**
* '@tailwindcss/forms' is the forms plugin that provides a minimal styling
* for forms. If you don't like it or have own styling for forms,
* comment the line below to disable '@tailwindcss/forms'.
*/
require('@tailwindcss/forms'),
require('@tailwindcss/typography'),
require('@tailwindcss/aspect-ratio'),
],
}

View file

@ -0,0 +1 @@
{% load static tailwind_tags %}