From bb06ed902bfb7a11028f688dcf26b1929c146bdc Mon Sep 17 00:00:00 2001 From: TheAlluringCO <153435853+TheAlluringCO@users.noreply.github.com> Date: Thu, 10 Jul 2025 00:21:08 +0200 Subject: [PATCH] Refactor project --- .gitignore | 1 + ENV_TEMPLATE | 1 + config.php | 12 +++++--- home.php | 23 ++------------- style.css => inc/css/style.css | 0 inc/js/theme.js | 9 ++++++ inc/php/footer.php | 3 ++ inc/php/header.php | 7 +++++ inc/php/resources.php | 31 ++++++++++++++++++++ index.php | 52 ++++++---------------------------- process.php | 28 ++++++------------ 11 files changed, 81 insertions(+), 86 deletions(-) create mode 100644 .gitignore create mode 100644 ENV_TEMPLATE rename style.css => inc/css/style.css (100%) create mode 100644 inc/js/theme.js create mode 100644 inc/php/footer.php create mode 100644 inc/php/header.php create mode 100644 inc/php/resources.php diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2eea525 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.env \ No newline at end of file diff --git a/ENV_TEMPLATE b/ENV_TEMPLATE new file mode 100644 index 0000000..f77e5d7 --- /dev/null +++ b/ENV_TEMPLATE @@ -0,0 +1 @@ +APIKEY=123 diff --git a/config.php b/config.php index 5776db7..f28fb96 100644 --- a/config.php +++ b/config.php @@ -1,7 +1,11 @@ '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', - -]; +function getApi(){ + $api_key = getenv('APIKEY'); + if($api_key){ + return array('openai_api_key' => $api_key); + }else{ + return false; + } +} ?> \ No newline at end of file diff --git a/home.php b/home.php index e199301..3319270 100644 --- a/home.php +++ b/home.php @@ -1,26 +1,9 @@ - - - - - - AI Email Generator - - +

AI Email Generator

Effortlessly craft polished, professional emails in seconds.

- +
- - - - +{ + const toggleBtn = document.getElementById('darkModeBtn'); + if(toggleBtn){ + toggleBtn.addEventListener('click', (e) =>{ + e.preventDefault(); + document.body.classList.toggle('dark-mode'); + }) + } +}) \ No newline at end of file diff --git a/inc/php/footer.php b/inc/php/footer.php new file mode 100644 index 0000000..8a83201 --- /dev/null +++ b/inc/php/footer.php @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/inc/php/header.php b/inc/php/header.php new file mode 100644 index 0000000..c4649ca --- /dev/null +++ b/inc/php/header.php @@ -0,0 +1,7 @@ + + + + + AI Email Generator - Result + + \ No newline at end of file diff --git a/inc/php/resources.php b/inc/php/resources.php new file mode 100644 index 0000000..c24fd6d --- /dev/null +++ b/inc/php/resources.php @@ -0,0 +1,31 @@ + - - - - AI Email Generator - - +

AI Email Generator

@@ -21,45 +19,13 @@
- - - - + - - - - AI Email Generator - Result - - + +
'Write this email in a formal tone', @@ -106,12 +103,5 @@ return false; }; } - - if (darkBtn) { - darkBtn.onclick = function () { - document.body.classList.toggle('dark-mode'); - }; - } - - +