diff --git a/public/index.php b/public/index.php index d1bd1da..e3ab58c 100644 --- a/public/index.php +++ b/public/index.php @@ -106,6 +106,7 @@ if (preg_match('/^\/(address(?:\/edit|\/delete)?|transaction|user|order|quote|pr '/account/billing' => $defaults['is_user'] ? account::billing($defaults) : header('Location: /account/login'), '/account/orders' => $defaults['is_user'] ? account::orders($defaults) : header('Location: /account/login'), '/account/shipping' => $defaults['is_user'] ? account::shipping($defaults) : header('Location: /account/login'), + '/account/notifications' => $defaults['is_user'] ? account::notifications($defaults) : header('Location: /account/login'), '/account/address/edit' => $defaults['is_user'] ? account::address_edit($defaults) : header('Location: /account/login'), '/account/address/set-default-shipping' => $defaults['is_user'] ? account::set_default_shipping($defaults) : header('Location: /account/login'), '/account/address/set-default-billing' => $defaults['is_user'] ? account::set_default_billing($defaults) : header('Location: /account/login'), diff --git a/src/colors.php b/src/colors.php index bf5d426..aba4638 100644 --- a/src/colors.php +++ b/src/colors.php @@ -1,58 +1,174 @@ [ - 'banner' => 'bg-gray-100 dark:bg-gray-600 text-gray-200 dark:text-gray-200', + 'banner' => [ + 'light' => 'bg-gray-100 text-gray-200', + 'dark' => 'bg-gray-600 text-gray-200', + ], ], 'anchor' => [ - 'primary' => 'text-blue-400 dark:text-blue-200', + 'primary' => [ + 'light' => 'text-blue-400', + 'dark' => 'text-blue-200', + ], + ], + 'body' => [ + 'light' => 'bg-white text-gray-600', + 'dark' => 'bg-gray-800 text-gray-300', ], - 'body' => 'bg-white dark:bg-gray-800 text-gray-600 dark:text-gray-300', 'button' => [ - 'primary' => 'border-blue-400 dark:border-blue-600 dark:hover:border-blue-800 bg-blue-400 dark:bg-blue-600 hover:bg-blue-600 hover:dark:bg-blue-800 text-white dark:text-white', - 'default' => 'hover:bg-gray-50 dark:hover:bg-gray-900', + 'primary' => [ + 'light' => 'border-blue-400 bg-blue-400 hover:bg-blue-600 text-white', + 'dark' => 'border-blue-600 hover:border-blue-800 bg-blue-600 hover:bg-blue-800 text-white', + ], + 'default' => [ + 'light' => 'bg-gray-200 hover:bg-gray-300 text-gray-800', + 'dark' => 'bg-gray-200 hover:bg-gray-300 text-gray-800', + ], + 'danger' => [ + 'light' => 'border-red-400 bg-red-400 hover:bg-red-600 text-white', + 'dark' => 'border-red-600 hover:border-red-800 bg-red-600 hover:bg-red-800 text-white', + ], + 'dropdown' => [ + 'light' => 'hover:bg-gray-50', + 'dark' => 'hover:bg-gray-900', + ], ], 'breadcrumb' => [ - 'parent' => 'text-gray-300 dark:text-gray-400 hover:text-gray-400 dark:hover:text-gray-500', - 'seperator' => 'text-gray-200 dark:text-gray-200', - 'child' => 'text-gray-200 dark:text-gray-300', + 'parent' => [ + 'light' => 'text-gray-300 hover:text-gray-400', + 'dark' => 'text-gray-400 hover:text-gray-500', + ], + 'seperator' => [ + 'light' => 'text-gray-200', + 'dark' => 'text-gray-200', + ], + 'child' => [ + 'light' => 'text-gray-200', + 'dark' => 'text-gray-300', + ], ], 'dropdown' => [ - 'list' => 'bg-white dark:bg-blue-900 border-gray-600 dark:border-gray-300', - 'item' => 'hover:bg-gray-200 dark:hover:bg-gray-900', + 'list' => [ + 'light' => 'bg-white border-gray-600', + 'dark' => 'bg-blue-900 border-gray-300', + ], + 'item' => [ + 'light' => 'hover:bg-gray-200', + 'dark' => 'hover:bg-gray-900', + ], + ], + 'input' => [ + 'light' => 'text-gray-800 bg-white border-gray-300 focus:ring-blue-500', + 'dark' => 'text-gray-300 bg-gray-800 border-gray-500 focus:ring-blue-500', ], - 'input' => 'text-gray-800 dark:text-gray-300 bg-white dark:bg-gray-800 border-gray-300 dark:border-gray-500 focus:ring-blue-500', 'error' => [ - 'text' => 'text-red-600', - 'alert' => 'bg-red-100 text-gray-800 border-red-600', + 'text' => [ + 'light' => 'text-red-600', + 'dark' => 'text-red-600', + ], + 'alert' => [ + 'light' => 'bg-red-100 text-gray-800 border-red-600', + 'dark' => 'bg-red-100 text-gray-800 border-red-600', + ], ], 'warning' => [ - 'text' => 'text-yellow-400', - 'alert' => 'bg-yellow-100 text-gray-800 border-yellow-400', + 'text' => [ + 'light' => 'text-yellow-400', + 'dark' => 'text-yellow-400', + ], + 'alert' => [ + 'light' => 'bg-yellow-100 text-gray-800 border-yellow-400', + 'dark' => 'bg-yellow-100 text-gray-800 border-yellow-400', + ], ], 'success' => [ - 'text' => 'text-green-600', - 'alert' => 'bg-green-100 text-gray-800 border-green-600', + 'text' => [ + 'light' => 'text-green-600', + 'dark' => 'text-green-600', + ], + 'alert' => [ + 'light' => 'bg-green-100 text-gray-800 border-green-600', + 'dark' => 'bg-green-100 text-gray-800 border-green-600', + ], ], 'info' => [ - 'text' => 'text-blue-400', - 'alert' => 'bg-blue-200 text-gray-800 border-blue-400', + 'text' => [ + 'light' => 'text-blue-400', + 'dark' => 'text-blue-400', + ], + 'alert' => [ + 'light' => 'bg-blue-200 text-gray-800 border-blue-400', + 'dark' => 'bg-blue-200 text-gray-800 border-blue-400', + ], ], 'modal' => [ - 'content' => 'bg-white dark:bg-blue-900 border-gray-600 dark:border-gray-300', - 'shadow' => 'bg-black/70', + 'content' => [ + 'light' => 'bg-white border-gray-600', + 'dark' => 'bg-blue-900 border-gray-300', + ], + 'shadow' => [ + 'light' => 'bg-black/70', + 'dark' => 'bg-black/70', + ], ], 'nav' => [ - 'bar' => 'bg-blue-400 dark:bg-blue-600 text-gray-200 dark:text-gray-200', - 'item' => 'hover:bg-blue-600 dark:hover:bg-blue-800 hover:text-gray-200 dark:hover:text-gray-300 text-white border-blue-400 dark:border-blue-600', - 'hovercontent' => 'bg-white dark:bg-slate-700 text-gray-800 dark:text-gray-300', + 'bar' => [ + 'light' => 'bg-blue-400 text-gray-200', + 'dark' => 'bg-blue-600 text-gray-200', + ], + 'item' => [ + 'light' => 'hover:bg-blue-600 hover:text-gray-200 text-white border-blue-400', + 'dark' => 'hover:bg-blue-800 hover:text-gray-300 text-white border-blue-600', + ], + 'hovercontent' => [ + 'light' => 'bg-white text-gray-800', + 'dark' => 'bg-slate-700 text-gray-300', + ], + ], + 'rule' => [ + 'light' => 'border-gray-400', + 'dark' => 'border-gray-400', ], - 'rule' => 'border-gray-400 dark:border-gray-400', 'text' => [ - 'muted' => 'text-gray-400 dark:text-gray-300', + 'muted' => [ + 'light' => 'text-gray-400', + 'dark' => 'text-gray-300', + ], + ], + 'toggle' => [ + 'light' => "bg-gray-300 peer-checked:bg-green-400 after:bg-white", + 'dark' => "bg-gray-300 peer-checked:bg-green-400 after:bg-white", ], - 'toggle' => "bg-gray-300 peer-checked:bg-green-400 after:bg-white", 'footer' => [ - "primary" => "bg-gray-200 dark:bg-slate-600 text-gray-500 dark:text-gray-300", - "policy" => "bg-slate-400 dark:bg-slate-800 text-gray-200 dark:text-gray-400", + 'primary' => [ + 'light' => "bg-gray-200 text-gray-500", + 'dark' => "bg-slate-600 text-gray-300", + ], + 'policy' => [ + 'light' => "bg-slate-400 text-gray-200", + 'dark' => "bg-slate-800 text-gray-400", + ], ], ]; +function lightDarkify($colors, $level = 0) +{ + $result = ['light' => [], 'dark' => []]; + if ($level >= 3) { + return $result; + } + foreach ($colors as $key => $value) { + if (is_array($value)) { + $subResult = lightDarkify($value, $level + 1); + foreach ($subResult as $theme => $subValue) { + if (isset($result[$theme])) { + $result[$theme][$key] = $subValue; + } + } + } elseif ($key == 'light' || $key == 'dark') { + $result[$key] = $value; + } + } + return $result; +} +return lightDarkify($colors)[$theme]; diff --git a/src/controllers/account.php b/src/controllers/account.php index 25a7b40..b4795ce 100644 --- a/src/controllers/account.php +++ b/src/controllers/account.php @@ -3,6 +3,7 @@ namespace app\controllers; use app\models\addresses; use app\models\magic_links; +use app\models\transactions; use app\models\users; use app\models\user_settings; @@ -10,14 +11,12 @@ class account { public static function index($defaults): void { - $user = users::getById($_SESSION['user_id']); - $addresses = addresses::getByUserId($_SESSION['user_id']); - echo $GLOBALS['twig']->render('lib/pages/index.twig', array_merge($defaults, [ 'child_template' => 'account/index.twig', 'page_title' => 'Manage Account - ' . $_ENV['APP_NAME'], - 'user' => $user, - 'addresses' => $addresses, + 'user' => users::getById($_SESSION['user_id']), + 'addresses' => addresses::getByUserId($_SESSION['user_id']), + 'balance' => transactions::getUserBalance($_SESSION['user_id']), 'breadcrumbs' => [ [ 'url' => null, @@ -33,6 +32,7 @@ class account $bill = addresses::validatePost("billing_"); if (isset($bill['error'])) { header('Location: /account/billing'); + exit; } $bill_id = addresses::add( $_SESSION['user_id'], @@ -47,15 +47,13 @@ class account ); $_SESSION['success'] = "Billing address saved!"; header('Location: /account/billing'); + exit; } - $user = users::getById($_SESSION['user_id']); - $addresses = addresses::getByUserId($_SESSION['user_id']); - echo $GLOBALS['twig']->render('lib/pages/index.twig', array_merge($defaults, [ 'child_template' => 'account/billing.twig', 'page_title' => 'Billing Information - ' . $_ENV['APP_NAME'], - 'user' => $user, - 'addresses' => $addresses, + 'user' => users::getById($_SESSION['user_id']), + 'addresses' => addresses::getByUserId($_SESSION['user_id']), 'breadcrumbs' => [ [ 'url' => '/account', @@ -74,7 +72,9 @@ class account users::updateProfileById($_SESSION['user_id'], $_POST); $dark_theme = $_POST['dark_theme'] ?? false; user_settings::update($_SESSION['user_id'], ['dark_theme' => $dark_theme]); + $_SESSION['success'] = 'Profile information updated sucessfully!'; header('Location: /account'); + exit; } } @@ -122,7 +122,6 @@ class account exit; } } - echo $GLOBALS['twig']->render('lib/pages/index.twig', array_merge($defaults, [ 'child_template' => 'account/verify.twig', 'page_title' => $_ENV['APP_NAME'], @@ -155,6 +154,7 @@ class account } if (isset($_SESSION['user_id'])) { header('Location: /account'); + exit; } echo $GLOBALS['twig']->render('lib/pages/index.twig', array_merge($defaults, [ 'child_template' => 'account/login.twig', @@ -168,6 +168,19 @@ class account ])); } + public static function notifications($defaults) + { + if ($_SERVER['REQUEST_METHOD'] == 'POST') { + $opt_in_promotional = isset($_POST['opt_in_promotional']) ? (bool) $_POST['opt_in_promotional'] : false; + $opt_in_subscription = isset($_POST['opt_in_subscription']) ? (bool) $_POST['opt_in_subscription'] : false; + $opt_in_order = isset($_POST['opt_in_order']) ? (bool) $_POST['opt_in_order'] : false; + users::updateOptIn($_SESSION['user_id'], $opt_in_promotional, $opt_in_subscription, $opt_in_order); + $_SESSION['success'] = "Notification preferences updated successfully."; + header('Location: /account'); + exit; + } + } + public static function logout() { session_unset(); @@ -216,6 +229,7 @@ class account $ship = addresses::validatePost("shipping_"); if (isset($ship['error'])) { header('Location: /account/shipping'); + exit; } $ship_id = addresses::add( $_SESSION['user_id'], @@ -230,15 +244,14 @@ class account ); $_SESSION['success'] = "Shipping address saved!"; header('Location: /account/shipping'); + exit; } - $user = users::getById($_SESSION['user_id']); - $addresses = addresses::getByUserId($_SESSION['user_id']); echo $GLOBALS['twig']->render('lib/pages/index.twig', array_merge($defaults, [ 'child_template' => 'account/shipping.twig', 'page_title' => $_ENV['APP_NAME'] . ' Shipping', - 'user' => $user, - 'addresses' => $addresses, + 'user' => users::getById($_SESSION['user_id']), + 'addresses' => addresses::getByUserId($_SESSION['user_id']), 'breadcrumbs' => [ [ 'url' => '/account', @@ -262,6 +275,7 @@ class account $_SESSION['error'] = "Failed to set default shipping address."; } header('Location: /account/shipping'); + exit; } } @@ -276,6 +290,7 @@ class account $_SESSION['error'] = "Failed to set default billing address."; } header('Location: /account/billing'); + exit; } } @@ -299,6 +314,7 @@ class account $_SESSION['error'] = "Shipping address verification failed. " . $_SESSION['error']; $_SESSION['last_post'] = $_POST; header('Location: /account/signup'); + exit; } if (! $useShipping) { $bill = addresses::validatePost("billing_"); @@ -306,11 +322,13 @@ class account $_SESSION['error'] = "Billing address verification failed. " . $_SESSION['error']; $_SESSION['last_post'] = $_POST; header('Location: /account/signup'); + exit; } } if (isset($_SESSION['error'])) { $_SESSION['last_post'] = $_POST; header('Location: /account/signup'); + exit; } $ship_id = addresses::add( null, diff --git a/src/controllers/transaction.php b/src/controllers/transaction.php index e220153..66a7c9c 100644 --- a/src/controllers/transaction.php +++ b/src/controllers/transaction.php @@ -13,12 +13,11 @@ class transaction if (! $tx) { lost::index($defaults); } - $user = users::getById($tx['user_id']); echo $GLOBALS['twig']->render('lib/pages/index.twig', array_merge($defaults, [ 'child_template' => 'transaction.twig', 'page_title' => 'Transaction Reciept #' . $txid, 'tx' => $tx, - 'user' => $user, + 'user' => users::getById($tx['user_id']), 'breadcrumbs' => [ [ 'url' => "/transaction/" . $txid, diff --git a/src/models/transactions.php b/src/models/transactions.php index f32f25e..e557abd 100644 --- a/src/models/transactions.php +++ b/src/models/transactions.php @@ -54,7 +54,7 @@ class transactions public static function getUserBalance($user_id) { - $query = "SELECT COALESCE(SUM(cents), 0) AS total_cents, COALESCE(SUM(sats), 0) AS total_sats FROM transactions WHERE user_id = :user_id"; + $query = "SELECT COALESCE(SUM(cents), 0) AS cents, COALESCE(SUM(sats), 0) AS sats FROM transactions WHERE user_id = :user_id"; $stmt = app::$db->prepare($query); $stmt->bindParam(':user_id', $user_id); $stmt->execute(); diff --git a/src/models/user_settings.php b/src/models/user_settings.php index f3ed336..c0a67c3 100644 --- a/src/models/user_settings.php +++ b/src/models/user_settings.php @@ -20,8 +20,8 @@ class user_settings public static function add($user_id, $opt_in_promotional, $dark_theme) { - $query = "INSERT INTO user_settings (user_id, opt_in_promotional, opt_in_subscription, opt_in_order, dark_theme) - VALUES (:user_id, :opt_in_promotional, :opt_in_subscription, :opt_in_orders, :dark_theme)"; + $query = "INSERT INTO user_settings (user_id, opt_in_promotional, dark_theme) + VALUES (:user_id, :opt_in_promotional, :dark_theme)"; $stmt = app::$db->prepare($query); $stmt->bindParam(':user_id', $user_id); $stmt->bindParam(':opt_in_promotional', $opt_in_promotional); diff --git a/src/models/users.php b/src/models/users.php index f4750d1..6467ca6 100644 --- a/src/models/users.php +++ b/src/models/users.php @@ -21,7 +21,6 @@ class users verified BOOLEAN NOT NULL, nsec TEXT, npub TEXT NOT NULL, - attached_lightning_address TEXT, replace_email_token TEXT, name TEXT, company_name TEXT, @@ -38,6 +37,20 @@ class users $stmt->bindParam(':user_id', $user_id, \PDO::PARAM_INT); $stmt->execute(); } + public static function updateOptIn($user_id, $opt_in_promotional, $opt_in_subscription, $opt_in_order) + { + $query = "UPDATE user_settings SET + opt_in_promotional = :opt_in_promotional, + opt_in_subscription = :opt_in_subscription, + opt_in_order = :opt_in_order + WHERE user_id = :user_id"; + $stmt = app::$db->prepare($query); + $stmt->bindParam(':opt_in_promotional', $opt_in_promotional, \PDO::PARAM_BOOL); + $stmt->bindParam(':opt_in_subscription', $opt_in_subscription, \PDO::PARAM_BOOL); + $stmt->bindParam(':opt_in_order', $opt_in_order, \PDO::PARAM_BOOL); + $stmt->bindParam(':user_id', $user_id, \PDO::PARAM_INT); + $stmt->execute(); + } public static function setDefaultBilling($user_id, $billing_address_id) { diff --git a/src/views/account/billing.twig b/src/views/account/billing.twig index 5270af5..099625b 100644 --- a/src/views/account/billing.twig +++ b/src/views/account/billing.twig @@ -35,9 +35,8 @@ {% include 'lib/forms/address.twig' with { type: 'billing_' } %} - {% include 'lib/button.twig' with { + {% include 'lib/buttons/submit.twig' with { label: 'Add Address', - onclick: 'this.parentNode.submit()', } %} {% if addresses|length > 1 %} diff --git a/src/views/account/index.twig b/src/views/account/index.twig index 0361b55..493aed2 100644 --- a/src/views/account/index.twig +++ b/src/views/account/index.twig @@ -11,11 +11,10 @@ company_name: user.company_name, company_type: user.company_type, company_size: user.company_size, - dark_theme: defaults.user_settings.dark_theme + dark_theme: user_settings.dark_theme } %} - {% include 'lib/button.twig' with { + {% include 'lib/buttons/primary.twig' with { label: 'Save Profile', - onclick: 'this.parentNode.submit()', } %} @@ -33,9 +32,8 @@ Verified: {{ user.verified ? 'Yes' : 'No' }} - {% include 'lib/button.twig' with { + {% include 'lib/buttons/primary.twig' with { label: 'Save Email', - onclick: 'this.parentNode.submit()', } %} @@ -101,7 +99,7 @@ - $0.00 + {{ '$' ~ (balance.cents / 100) | number_format(2, '.', ',') }} {% include 'lib/rule.twig' %} @@ -121,25 +119,36 @@ - 0 + {{ balance.sats | number_format(0, '', ',') }} {% include 'lib/rule.twig' %}

- Marketing + Email Notifications

{% include 'lib/rule.twig' %} -
- {% include 'lib/inputs/toggle.twig' with { + +
+ {% include 'lib/inputs/toggle.twig' with { label: 'Recieve coupons & more', name: 'opt_in_promotional', - on: defailts.user_settings.opt_in_promotional + on: user_settings.opt_in_promotional } %} - {% include 'lib/button.twig' with { + {% include 'lib/inputs/toggle.twig' with { + label: 'Recieve subscription reminders', + name: 'opt_in_subscription', + on: user_settings.opt_in_subscription + } %} + {% include 'lib/inputs/toggle.twig' with { + label: 'Recieve order updates', + name: 'opt_in_order', + on: user_settings.opt_in_order + } %} +
+ {% include 'lib/buttons/primary.twig' with { label: 'Save', - onclick: 'this.parentNode.submit()', } %}
diff --git a/src/views/account/login.twig b/src/views/account/login.twig index 90ec368..ef1c597 100644 --- a/src/views/account/login.twig +++ b/src/views/account/login.twig @@ -15,9 +15,8 @@ subtext: 'Get a one-time link sent to your email. No passwords!', placeholder: 'Enter your e-mail' } %} - {% include 'lib/button.twig' with { + {% include 'lib/buttons/submit.twig' with { label: 'Get login link', - onclick: 'this.parentNode.submit()', captcha: true } %} diff --git a/src/views/account/shipping.twig b/src/views/account/shipping.twig index d31e88f..c719ea5 100644 --- a/src/views/account/shipping.twig +++ b/src/views/account/shipping.twig @@ -25,9 +25,8 @@ {% include 'lib/forms/address.twig' with { type: 'shipping_' } %} - {% include 'lib/button.twig' with { + {% include 'lib/buttons/submit.twig' with { label: 'Add Address', - onclick: 'this.parentNode.submit()' } %} {% if addresses|length > 1 %} diff --git a/src/views/account/signup.twig b/src/views/account/signup.twig index ec934e7..6bd221b 100644 --- a/src/views/account/signup.twig +++ b/src/views/account/signup.twig @@ -85,9 +85,8 @@ } %} {% include 'lib/rule.twig' with { text: 'ALL DONE!' } %} - {% include 'lib/button.twig' with { + {% include 'lib/buttons/submit.twig' with { label: 'Register', - onclick: 'this.parentNode.submit()', captcha: true } %} diff --git a/src/views/account/verify.twig b/src/views/account/verify.twig index d6bcc07..b5b6605 100644 --- a/src/views/account/verify.twig +++ b/src/views/account/verify.twig @@ -10,66 +10,20 @@ {% include 'lib/rule.twig' %} {% include 'lib/alert.twig' %} -
- - - - {% include 'lib/button.twig' with { - label: 'Verify Code', - onclick: 'this.parentNode.submit()', - captcha: true + {% include 'lib/inputs/text.twig' with { + type: 'tel', + name: 'code', + placeholder: '******', + class: 'code-input', + maxlength: 6, + inputmode: 'numeric', + pattern: '[0-9]*' } %} -
- - - \ No newline at end of file + {% include 'lib/buttons/submit.twig' with { + label: 'Verify Code', + } %} + + + diff --git a/src/views/address/edit.twig b/src/views/address/edit.twig index 8222fc0..5efb43c 100644 --- a/src/views/address/edit.twig +++ b/src/views/address/edit.twig @@ -12,8 +12,7 @@ zip: address.zip, phone: address.phone, } %} - {% include 'lib/button.twig' with { + {% include 'lib/buttons/submit.twig' with { label: 'Save Address', - onclick: 'this.parentNode.submit()' } %} diff --git a/src/views/admin/emails.twig b/src/views/admin/emails.twig index 65e9b27..45242ab 100644 --- a/src/views/admin/emails.twig +++ b/src/views/admin/emails.twig @@ -2,7 +2,7 @@

Recently Sent Emails

- +
diff --git a/src/views/admin/transactions/add.twig b/src/views/admin/transactions/add.twig index 470a61a..2a04000 100644 --- a/src/views/admin/transactions/add.twig +++ b/src/views/admin/transactions/add.twig @@ -12,13 +12,13 @@ type="hidden" name="amount" id="amount" value="{{ session.last_post.amount }}" /> {% else %} {% include 'lib/inputs/number.twig' with { - id: 'amount', - name: 'amount', - label: 'Amount', - placeholder: 'Enter the amount', - value: session.last_post.amount, - required: true - } %} + id: 'amount', + name: 'amount', + label: 'Amount', + placeholder: 'Enter the amount', + value: session.last_post.amount, + required: true + } %} {% endif %} {% if session.last_post.currency %} {% if session.last_post %} - {% include 'lib/button.twig' with { - label: 'Cancel', - href: '/admin/transactions/reset' - } %} + + {% include 'lib/buttons/default.twig' with { + label: 'Cancel' + } %} + {% endif %} \ No newline at end of file diff --git a/src/views/admin/transactions/index.twig b/src/views/admin/transactions/index.twig index 5e40bd0..38e23e7 100644 --- a/src/views/admin/transactions/index.twig +++ b/src/views/admin/transactions/index.twig @@ -17,16 +17,15 @@ ], required: true } %} - {% include 'lib/button.twig' with { + {% include 'lib/buttons/submit.twig' with { label: 'Submit', - onclick: 'this.parentNode.submit()' } %}

Liabilities

- +
@@ -59,7 +58,7 @@

Sats Transactions

- +
@@ -101,7 +100,7 @@

Cents Transactions

- +
@@ -143,7 +142,7 @@

Whales Sats

- +
@@ -179,7 +178,7 @@

Whales Cents

- +
diff --git a/src/views/header.twig b/src/views/header.twig index 47e31dc..75f8cfb 100644 --- a/src/views/header.twig +++ b/src/views/header.twig @@ -48,14 +48,20 @@ -
- {% include 'lib/inputs/text.twig' with { - name: 'search', - type: 'search', - placeholder: 'What are you looking for?', - submit: true, - icon: 'search' - } %} + +
+ {% include 'lib/inputs/text.twig' with { + name: 'search', + type: 'search', + placeholder: 'What are you looking for?', + } %} +
+
diff --git a/src/views/lib/button.twig b/src/views/lib/button.twig deleted file mode 100644 index d61ff89..0000000 --- a/src/views/lib/button.twig +++ /dev/null @@ -1,49 +0,0 @@ -{% if href is defined %} - - {% else %} - -{% endif %} -{% if captcha is defined %} -
-

- This form is protected by reCAPTCHA and the Google - - Privacy Policy - - and - - Terms of Service - - apply. -

-
-{% endif %} diff --git a/src/views/lib/buttons/danger.twig b/src/views/lib/buttons/danger.twig new file mode 100644 index 0000000..edf4f43 --- /dev/null +++ b/src/views/lib/buttons/danger.twig @@ -0,0 +1,3 @@ + diff --git a/src/views/lib/buttons/default.twig b/src/views/lib/buttons/default.twig new file mode 100644 index 0000000..364d43c --- /dev/null +++ b/src/views/lib/buttons/default.twig @@ -0,0 +1,3 @@ + diff --git a/src/views/lib/buttons/primary.twig b/src/views/lib/buttons/primary.twig new file mode 100644 index 0000000..c8e8f87 --- /dev/null +++ b/src/views/lib/buttons/primary.twig @@ -0,0 +1,3 @@ + diff --git a/src/views/lib/buttons/submit.twig b/src/views/lib/buttons/submit.twig new file mode 100644 index 0000000..a3270b5 --- /dev/null +++ b/src/views/lib/buttons/submit.twig @@ -0,0 +1,22 @@ + +{% if captcha is defined %} +
+

+ This form is protected by reCAPTCHA and the Google + + Privacy Policy + + and + + Terms of Service + + apply. +

+
+{% endif %} diff --git a/src/views/lib/inputs/number.twig b/src/views/lib/inputs/number.twig index 006bf7f..b3cc3f0 100644 --- a/src/views/lib/inputs/number.twig +++ b/src/views/lib/inputs/number.twig @@ -1,11 +1,5 @@ -
+ + \ No newline at end of file diff --git a/src/views/lib/modal.twig b/src/views/lib/modal.twig index 973fb10..583c9b2 100644 --- a/src/views/lib/modal.twig +++ b/src/views/lib/modal.twig @@ -11,14 +11,28 @@ {% if okURL is defined %}
- + {% include 'lib/buttons/default.twig' with { + label: "Cancel" + } %}
- + {% include 'lib/buttons/primary.twig' with { + label: okText is defined ? okText : 'OK', + } %} +
+
+ {% endif %} + {% if dangerURL is defined %} +
+ + {% include 'lib/buttons/default.twig' with { + label: "Cancel" + } %} + +
+ {% include 'lib/buttons/danger.twig' with { + label: dangerText is defined ? dangerText : 'OK', + } %}
{% endif %} diff --git a/src/views/lib/modals/credit.twig b/src/views/lib/modals/credit.twig index d4c4c3b..2ac68ee 100644 --- a/src/views/lib/modals/credit.twig +++ b/src/views/lib/modals/credit.twig @@ -1,4 +1,12 @@
+
+ You have + + {{ '$' ~ (balance.cents / 100) | number_format(2, '.', ',') }} + USD + + in store credit +
Why do I have store credit?
diff --git a/src/views/lib/modals/sats.twig b/src/views/lib/modals/sats.twig index 9499366..34b1383 100644 --- a/src/views/lib/modals/sats.twig +++ b/src/views/lib/modals/sats.twig @@ -1,4 +1,19 @@
+
+ You have + + {{ balance.sats }} + + sats! +
+
+ What are sats? +
+
    +
  • + Sats are fractions of a Bitcoin (BTC). There are 100 million sats in one Bitcoin (BTC). +
  • +
Why do I have sats?
@@ -7,24 +22,26 @@ You may have received sats from a promotional event
  • - You may have recieved sats sent to your default generated Lightning Address (LNURL): - {{ user.npub }} - @ - {{ http_host }} -
  • - -
    - What can I do with sats? + You may have recieved sats sent to your generated Lightning Address (LNURL): +
    + + {{ user.npub ~ '@' ~ http_host }} + + + +
    + What can I do with these sats? +
    +
      +
    • + You may spend these sats at checkout +
    • +
    • + Your subscriptions and recurring purchases can also be paid with sats +
    • +
    • + You can configure these sats to autowithdraw by attaching a Lightning Address (LNURL) +
    • +
    -
      -
    • - You may spend sats at checkout -
    • -
    • - Your subscriptions and recurring purchases can also be paid with sats -
    • -
    • - You can configure these sats to autowithdraw by attaching a Lightning Address (LNURL) -
    • -
    -
    + \ No newline at end of file