Skip to content

Commit

Permalink
Migrated all UI to React (Not ready yet)
Browse files Browse the repository at this point in the history
  • Loading branch information
EXG1O committed Dec 14, 2023
1 parent a6439aa commit 3bbb482
Show file tree
Hide file tree
Showing 167 changed files with 569 additions and 6,584 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Папки
__pycache__/
node_modules/
webpack_stats/
/constructor_telegram_bots/static/frontend/
.vscode/
/static/
media/
Expand All @@ -11,7 +11,7 @@ dist/

# Файлы
celerybeat-schedule
*.webpack.stats.json
webpack.stats.json
.env
*.db
*.mo
2 changes: 1 addition & 1 deletion constructor_telegram_bots/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from constructor_telegram_bots.celery import celery_app


__all__ = ('celery_app',)
__all__ = ('celery_app',)
2 changes: 1 addition & 1 deletion constructor_telegram_bots/asgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'constructor_telegram_bots.settings')

application = get_asgi_application()
application = get_asgi_application()
2 changes: 1 addition & 1 deletion constructor_telegram_bots/celery.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
def celery_after_setup(*args, **kwargs) -> None:
from telegram_bot.tasks import start_all_telegram_bots as celery_start_all_telegram_bots

celery_start_all_telegram_bots.delay()
celery_start_all_telegram_bots.delay()
5 changes: 0 additions & 5 deletions constructor_telegram_bots/context_processors.py

This file was deleted.

2 changes: 1 addition & 1 deletion constructor_telegram_bots/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@ def replace_text_variables_to_jinja_variables_values(telegram_bot, text: str, ji
}).json()['response']

async def areplace_text_variables_to_jinja_variables_values(telegram_bot, text: str, jinja_variables: dict[str, Any]) -> str:
return await sync_to_async(replace_text_variables_to_jinja_variables_values)(telegram_bot, text, jinja_variables)
return await sync_to_async(replace_text_variables_to_jinja_variables_values)(telegram_bot, text, jinja_variables)
2 changes: 1 addition & 1 deletion constructor_telegram_bots/exception_formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ def format_error_response(self, error_response: ErrorResponse) -> FormatErrorRes
'name': error.attr,
'message': error.detail,
'level': 'danger',
}
}
2 changes: 1 addition & 1 deletion constructor_telegram_bots/gunicorn_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@

capture_output = True
accesslog = str(BASE_DIR / 'logs/gunicorn_info.log')
errorlog = str(BASE_DIR / 'logs/gunicorn_info.log')
errorlog = str(BASE_DIR / 'logs/gunicorn_info.log')
65 changes: 14 additions & 51 deletions constructor_telegram_bots/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,6 @@

SITE_DOMAIN = 'http://127.0.0.1:8000' if DEBUG else 'https://constructor.exg1o.org'
ALLOWED_HOSTS = ['127.0.0.1', 'constructor.exg1o.org']
CSRF_TRUSTED_ORIGINS = [
'http://*.127.0.0.1',
'https://*.127.0.0.1',
'http://constructor.exg1o.org',
'https://constructor.exg1o.org',
]


CELERY_BROKER_URL = 'redis://127.0.0.1:6379'
Expand Down Expand Up @@ -74,52 +68,22 @@
'django.contrib.messages',
'django.contrib.staticfiles',

'user',
'telegram_bot',
'telegram_bot.frontend',
'telegram_bot.api',
'plugin',

'user',
'home',
'team',
'updates',
'instruction',
'donation',
'personal_cabinet',
'plugin',
'privacy_policy',
]

WEBPACK_LOADER_BASE_CONFIG = {
'CACHE': not DEBUG,
'POLL_INTERVAL': 0.1,
}
WEBPACK_LOADER = {
'DEFAULT': WEBPACK_LOADER_BASE_CONFIG | {
'STATS_FILE': BASE_DIR / 'webpack_stats/default.webpack.stats.json',
},
'HOME:INDEX': WEBPACK_LOADER_BASE_CONFIG | {
'STATS_FILE': BASE_DIR / 'webpack_stats/index.home.webpack.stats.json',
},
'TEAM:INDEX': WEBPACK_LOADER_BASE_CONFIG | {
'STATS_FILE': BASE_DIR / 'webpack_stats/index.team.webpack.stats.json',
},
'PERSONAL_CABINET:INDEX': WEBPACK_LOADER_BASE_CONFIG | {
'STATS_FILE': BASE_DIR / 'webpack_stats/index.personal-cabinet.webpack.stats.json',
},
'TELEGRAM_BOT_MENU:DEFAULT': WEBPACK_LOADER_BASE_CONFIG | {
'STATS_FILE': BASE_DIR / 'webpack_stats/default.telegram-bot-menu.webpack.stats.json',
},
'TELEGRAM_BOT_MENU:INDEX': WEBPACK_LOADER_BASE_CONFIG | {
'STATS_FILE': BASE_DIR / 'webpack_stats/index.telegram-bot-menu.webpack.stats.json',
},
'TELEGRAM_BOT_MENU:VARIABLES': WEBPACK_LOADER_BASE_CONFIG | {
'STATS_FILE': BASE_DIR / 'webpack_stats/variables.telegram-bot-menu.webpack.stats.json',
},
'TELEGRAM_BOT_MENU:USERS': WEBPACK_LOADER_BASE_CONFIG | {
'STATS_FILE': BASE_DIR / 'webpack_stats/users.telegram-bot-menu.webpack.stats.json',
},
'TELEGRAM_BOT_MENU:DATABASE': WEBPACK_LOADER_BASE_CONFIG | {
'STATS_FILE': BASE_DIR / 'webpack_stats/database.telegram-bot-menu.webpack.stats.json',
'INDEX': {
'CACHE': not DEBUG,
'POLL_INTERVAL': 0.1,
'STATS_FILE': BASE_DIR / 'frontend/webpack.stats.json',
},
}

Expand Down Expand Up @@ -157,13 +121,11 @@
]

REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES': [
'rest_framework.authentication.BasicAuthentication',
'rest_framework.authentication.SessionAuthentication',
],
'EXCEPTION_HANDLER': 'drf_standardized_errors.handler.exception_handler',
}
DRF_STANDARDIZED_ERRORS = {'EXCEPTION_FORMATTER_CLASS': 'constructor_telegram_bots.exception_formatter.CustomExceptionFormatter'}
DRF_STANDARDIZED_ERRORS = {
'EXCEPTION_FORMATTER_CLASS': 'constructor_telegram_bots.exception_formatter.CustomExceptionFormatter',
}


TEMPLATES = [
Expand All @@ -177,8 +139,6 @@
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',

'constructor_telegram_bots.context_processors.constructor_telegram_bot_username',
],
},
},
Expand Down Expand Up @@ -222,7 +182,10 @@

STATIC_URL = '/static/'
STATIC_ROOT = BASE_DIR / 'static'
STATICFILES_DIRS = [BASE_DIR / 'constructor_telegram_bots/static']
STATICFILES_DIRS = [
BASE_DIR / 'constructor_telegram_bots/static',
BASE_DIR / 'frontend/dist',
]

MEDIA_URL = '/media/'
MEDIA_ROOT = BASE_DIR / 'media'
Expand Down Expand Up @@ -299,4 +262,4 @@
'propagate': True,
},
},
}
}
16 changes: 0 additions & 16 deletions constructor_telegram_bots/static/default/src/logout.ts

This file was deleted.

6 changes: 0 additions & 6 deletions constructor_telegram_bots/static/default/src/main.ts

This file was deleted.

This file was deleted.

48 changes: 0 additions & 48 deletions constructor_telegram_bots/static/global_modules/api.ts

This file was deleted.

9 changes: 0 additions & 9 deletions constructor_telegram_bots/static/global_modules/jsi18n.d.ts

This file was deleted.

This file was deleted.

21 changes: 0 additions & 21 deletions constructor_telegram_bots/static/global_modules/monaco_editor.ts

This file was deleted.

33 changes: 0 additions & 33 deletions constructor_telegram_bots/static/global_modules/toast.ts

This file was deleted.

9 changes: 0 additions & 9 deletions constructor_telegram_bots/templates/404.html

This file was deleted.

2 changes: 1 addition & 1 deletion constructor_telegram_bots/templates/admin/base_site.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
{% block welcome-msg %}{% endblock welcome-msg %}

{% block userlinks %}
<a href="{% url 'home:index' %}">{% trans 'Вернуться на сайт' %}</a> /
<a href="/">{% trans 'Вернуться на сайт' %}</a> /
<a href="{% url 'user:logout' %}">{% trans 'Выйти' %}</a> /
<form action="{% url 'set_language' %}" method="post" style="display:inline">
{% csrf_token %}
Expand Down
Loading

0 comments on commit 3bbb482

Please sign in to comment.