From ee518bd7dcc8a7f80a588f0981e0984d4f10fb84 Mon Sep 17 00:00:00 2001 From: Mikan <72257910+Mikan-DS@users.noreply.github.com> Date: Fri, 13 Sep 2024 18:59:32 +0300 Subject: [PATCH] frontend added --- .gitmodules | 3 ++ .idea/NovelPlus.iml | 4 +- frontend/NovelPlus-frontend | 1 + frontend/react-to-django/template.html | 15 ++++++ .../react-to-django/update-frontend-part.py | 51 +++++++++++++++++++ .../static/frontend/css/main.5a7bc931.css | 2 + frontend/static/frontend/js/main.d06055e6.js | 3 ++ ...Title.8c1197cb53cdb26ecdd7df17ac1107b5.svg | 24 +++++++++ ...vatar.e6a82bfc54b2a0b85cec8ec36a4db6d0.svg | 3 ++ ...image.6e196fb2ee10df3c81213358f43872e0.svg | 3 ++ ...image.237361450e476b21dd4e666838ccb466.svg | 3 ++ 11 files changed, 111 insertions(+), 1 deletion(-) create mode 100644 .gitmodules create mode 160000 frontend/NovelPlus-frontend create mode 100644 frontend/react-to-django/template.html create mode 100644 frontend/react-to-django/update-frontend-part.py create mode 100644 frontend/static/frontend/css/main.5a7bc931.css create mode 100644 frontend/static/frontend/js/main.d06055e6.js create mode 100644 frontend/static/media/IconTitle.8c1197cb53cdb26ecdd7df17ac1107b5.svg create mode 100644 frontend/static/media/avatar.e6a82bfc54b2a0b85cec8ec36a4db6d0.svg create mode 100644 frontend/static/media/card-image.6e196fb2ee10df3c81213358f43872e0.svg create mode 100644 frontend/static/media/mini-card-image.237361450e476b21dd4e666838ccb466.svg diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..201d48a --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "frontend/NovelPlus-frontend"] + path = frontend/NovelPlus-frontend + url = https://github.com/Mikan-DS/NovelPlus-frontend.git diff --git a/.idea/NovelPlus.iml b/.idea/NovelPlus.iml index 747f99a..aced695 100644 --- a/.idea/NovelPlus.iml +++ b/.idea/NovelPlus.iml @@ -14,6 +14,7 @@ + @@ -23,7 +24,8 @@ diff --git a/frontend/NovelPlus-frontend b/frontend/NovelPlus-frontend new file mode 160000 index 0000000..36c4909 --- /dev/null +++ b/frontend/NovelPlus-frontend @@ -0,0 +1 @@ +Subproject commit 36c49097ab0e2f6d0c304f8db053f198e4903c6e diff --git a/frontend/react-to-django/template.html b/frontend/react-to-django/template.html new file mode 100644 index 0000000..8d250a5 --- /dev/null +++ b/frontend/react-to-django/template.html @@ -0,0 +1,15 @@ +{%% load static %%} + + + + + NovelPlus + + + + + + +
+ + \ No newline at end of file diff --git a/frontend/react-to-django/update-frontend-part.py b/frontend/react-to-django/update-frontend-part.py new file mode 100644 index 0000000..1bbb221 --- /dev/null +++ b/frontend/react-to-django/update-frontend-part.py @@ -0,0 +1,51 @@ +import glob +import os +import shutil + + + +os.chdir("..") + +for dir_name in os.listdir("."): + if "frontend" in dir_name: + break + +print(dir_name) + +os.chdir(dir_name) +os.system('npm run build') + +with open("../react-to-django/template.html", "r", encoding="UTF-8") as file: + template = file.read() + +# Получаем список файлов в директории +js_files = glob.glob('build/static/js/*.js') + +shutil.rmtree("../static/frontend/js/", ignore_errors=True) +os.makedirs("../static/frontend/js/", exist_ok=True) +# Копируем файлы в нужную директорию +js_file = [i for i in js_files if "main" in os.path.basename(i)][0] +shutil.copy(js_file, f'../static/frontend/js/{os.path.basename(js_file)}') + +# Получаем список файлов в директории +css_files = glob.glob('build/static/css/*.css') + +shutil.rmtree("../static/frontend/css/", ignore_errors=True) +os.makedirs("../static/frontend/css/", exist_ok=True) +# Копируем файлы в нужную директорию +css_file = [i for i in css_files if "main" in os.path.basename(i)][0] +shutil.copy(css_file, f'../static/frontend/css/{os.path.basename(css_file)}') + +shutil.rmtree("../static/media", ignore_errors=True) +shutil.copytree("build/static/media", "../static/media", dirs_exist_ok=True) + + +if not os.path.exists("../templates/frontend/"): + os.makedirs("../templates/frontend", exist_ok=True) + +with open("../templates/frontend/app.html", "w", encoding="UTF-8") as file: + file.write(template % (os.path.basename(js_file), os.path.basename(css_file))) + +os.chdir('../static') +os.system('git add ./frontend/') +os.system('git add ./media/') diff --git a/frontend/static/frontend/css/main.5a7bc931.css b/frontend/static/frontend/css/main.5a7bc931.css new file mode 100644 index 0000000..37c7dd2 --- /dev/null +++ b/frontend/static/frontend/css/main.5a7bc931.css @@ -0,0 +1,2 @@ +@import url(https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;600;700;800&display=swap);body{background-color:#ffe0ce;margin:0;padding:0}h1,h2{margin:0;text-transform:uppercase}h1{font-size:80px}h2{font-size:40px}.body-text{font-size:26px;font-weight:500}.body-text,.primary{font-family:Montserrat,sans-serif}.primary{background:#edc881;border:1px solid #7d5555;border-radius:40px;box-sizing:border-box;color:#7d5555;cursor:pointer;text-decoration:none;text-transform:uppercase;width:fit-content}.primary:hover{border-color:#000;color:#000}.primary.selected{background:#7d5555;border-color:#000;color:#edc881}.primary.large{font-size:80px;font-weight:600;padding:6px 54px}.primary.medium{font-size:40px;font-weight:500;padding:14px 54px}.primary.small{font-size:26px;font-weight:500;padding:10px 29px}.content-box{margin-left:auto;margin-right:auto;width:1880px}.fill-width{width:100%}.align-center,.align-end,.align-start,.horizontal-box,.stretched-box,.vertical-box{display:flex}.stretched-box{flex-direction:row;justify-content:space-between}.vertical-box{flex-direction:column}.horizontal-box{flex-direction:row}.align-end{align-items:flex-end}.align-center{align-items:center}.align-start{align-items:flex-start}.align-left{margin-right:auto}.section{margin:0 auto;min-height:300px;padding:30px 0}.header{background-color:#feb198;padding-bottom:40px;padding-top:40px}.header .bottom-menu,.header .upper-menu{padding-bottom:20px;padding-top:20px}.header .upper-menu{gap:60px}.header .bottom-menu{border-top:1px solid #000}.header .navigation{gap:20px}.header .avatar{height:100px;width:100px}.header .dropdown-menu{position:relative}.header .menu-button{background:none;border:none;cursor:pointer}.header .menu-content{background-color:#333;border:1px solid #fcfcfa;border-radius:5px;display:flex;flex-direction:column;padding:10px;width:max-content}.header .menu-content a{color:#fcfcfa;padding:10px 20px;text-decoration:none}.header .menu-content a:hover{background-color:#444}.header .menu-click-area{position:absolute;right:0;top:0}.header .menu-click-area>div{gap:10px}.card{color:#fff;text-decoration:none}.card,.card>div{height:350px;width:500px}.card>div{background:linear-gradient(180deg,#2d0c0c00 68.5%,#2d0c0c)}.card>div:hover{background:linear-gradient(180deg,#2d0c0c00 30.5%,#2d0c0c)}.card>div>div{color:#edc881;height:66px;margin-left:auto;margin-right:auto;text-align:center;width:450px}.store{grid-gap:39px;display:grid;gap:39px;grid-template-columns:min-content min-content min-content;width:1578px}.footer{background-color:#7d5555;padding:130px 150px}.footer a{color:#fff;font-family:Montserrat,sans-serif;font-size:40px;font-weight:500;text-decoration:none}.footer a:hover{color:#edc881}.vacancy{gap:56px}.mini-card{color:#000;gap:12px;text-decoration:none}.mini-card:hover{background-color:#feb198}.section.item .preview{gap:39px} +/*# sourceMappingURL=main.5a7bc931.css.map*/ \ No newline at end of file diff --git a/frontend/static/frontend/js/main.d06055e6.js b/frontend/static/frontend/js/main.d06055e6.js new file mode 100644 index 0000000..44c73c3 --- /dev/null +++ b/frontend/static/frontend/js/main.d06055e6.js @@ -0,0 +1,3 @@ +/*! For license information please see main.d06055e6.js.LICENSE.txt */ +(()=>{var e={240:e=>{"use strict";var t=Object.prototype.hasOwnProperty,n=Object.prototype.toString,r=Object.defineProperty,l=Object.getOwnPropertyDescriptor,o=function(e){return"function"===typeof Array.isArray?Array.isArray(e):"[object Array]"===n.call(e)},i=function(e){if(!e||"[object Object]"!==n.call(e))return!1;var r,l=t.call(e,"constructor"),o=e.constructor&&e.constructor.prototype&&t.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!l&&!o)return!1;for(r in e);return"undefined"===typeof r||t.call(e,r)},a=function(e,t){r&&"__proto__"===t.name?r(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},u=function(e,n){if("__proto__"===n){if(!t.call(e,n))return;if(l)return l(e,n).value}return e[n]};e.exports=function e(){var t,n,r,l,s,c,f=arguments[0],d=1,p=arguments.length,h=!1;for("boolean"===typeof f&&(h=f,f=arguments[1]||{},d=2),(null==f||"object"!==typeof f&&"function"!==typeof f)&&(f={});d{var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,n=/\n/g,r=/^\s*/,l=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,a=/^[;\s]*/,u=/^\s+|\s+$/g,s="";function c(e){return e?e.replace(u,s):s}e.exports=function(e,u){if("string"!==typeof e)throw new TypeError("First argument must be a string");if(!e)return[];u=u||{};var f=1,d=1;function p(e){var t=e.match(n);t&&(f+=t.length);var r=e.lastIndexOf("\n");d=~r?e.length-r:d+e.length}function h(){var e={line:f,column:d};return function(t){return t.position=new m(e),b(),t}}function m(e){this.start=e,this.end={line:f,column:d},this.source=u.source}m.prototype.content=e;var g=[];function y(t){var n=new Error(u.source+":"+f+":"+d+": "+t);if(n.reason=t,n.filename=u.source,n.line=f,n.column=d,n.source=e,!u.silent)throw n;g.push(n)}function v(t){var n=t.exec(e);if(n){var r=n[0];return p(r),e=e.slice(r.length),n}}function b(){v(r)}function k(e){var t;for(e=e||[];t=x();)!1!==t&&e.push(t);return e}function x(){var t=h();if("/"==e.charAt(0)&&"*"==e.charAt(1)){for(var n=2;s!=e.charAt(n)&&("*"!=e.charAt(n)||"/"!=e.charAt(n+1));)++n;if(n+=2,s===e.charAt(n-1))return y("End of comment missing");var r=e.slice(2,n-2);return d+=2,p(r),e=e.slice(n),d+=2,t({type:"comment",comment:r})}}function w(){var e=h(),n=v(l);if(n){if(x(),!v(o))return y("property missing ':'");var r=v(i),u=e({type:"declaration",property:c(n[0].replace(t,s)),value:r?c(r[0].replace(t,s)):s});return v(a),u}}return b(),function(){var e,t=[];for(k(t);e=w();)!1!==e&&(t.push(e),k(t));return t}()}},730:(e,t,n)=>{"use strict";var r=n(43),l=n(853);function o(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n