Skip to content

Commit

Permalink
Merge pull request #1609 from SimonRothUCF/react/dark-mode
Browse files Browse the repository at this point in the history
Dark Mode
  • Loading branch information
clpetersonucf authored Dec 5, 2024
2 parents 1f269bf + e9dff02 commit 5769e93
Show file tree
Hide file tree
Showing 66 changed files with 3,638 additions and 322 deletions.
1 change: 1 addition & 0 deletions fuel/app/classes/controller/api/user.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public function post_settings()
$set_meta = [
'useGravatar' => Input::json('useGravatar', null),
'notify' => Input::json('notify', null),
'darkMode' => Input::json('darkMode', null)
];

$success = Materia\Api::user_update_meta($set_meta);
Expand Down
1 change: 1 addition & 0 deletions fuel/app/classes/controller/qsets.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

class Controller_Qsets extends Controller
{
use Trait_CommonControllerTemplate;

public function action_import()
{
Expand Down
2 changes: 2 additions & 0 deletions fuel/app/classes/controller/questions.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

class Controller_Questions extends Controller
{
use Trait_CommonControllerTemplate;

public function get_import()
{
// Validate Logged in
Expand Down
3 changes: 2 additions & 1 deletion fuel/app/classes/model/user.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ class Model_User extends Orm\Model

protected static $_default_profile_fields = [
'useGravatar' => true,
'notify' => true
'notify' => true,
'darkMode' => false
];

protected static $_properties = [
Expand Down
6 changes: 6 additions & 0 deletions fuel/app/classes/trait/commoncontrollertemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
trait Trait_CommonControllerTemplate
{
use Trait_Analytics;
use Trait_DarkMode;

protected $_disable_browser_cache = false;

Expand All @@ -32,6 +33,11 @@ public function after($response)

$this->inject_common_js_constants();

if ($this->is_using_darkmode())
{
$this->theme->get_template()->set('darkmode', true);
}

return parent::after($response);
}

Expand Down
19 changes: 19 additions & 0 deletions fuel/app/classes/trait/darkmode.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php
/**
* Materia
* License outlined in licenses folder
*/

trait Trait_DarkMode
{
protected function is_using_darkmode()
{
if (\Service_User::verify_session() == true)
{
$meta = \Model_User::find_current()->profile_fields;
$darkmode = ! empty($meta['darkMode']) && $meta['darkMode'];
return $darkmode;
}
else return false;
}
}
2 changes: 1 addition & 1 deletion fuel/app/themes/default/layouts/react.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<?= Css::render() ?>
<?= $partials['google_analytics'] ?? '' ?>
</head>
<body class="<?= (isset($page_type) ? $page_type : '') ?>">
<body class="<?= (isset($page_type) ? $page_type : '') ?> <?= (isset($darkmode) ? 'darkMode' : '') ?>">
<div id="app"></div>
<div id="modal"></div>
<?= Js::render() ?>
Expand Down
Binary file added public/img/404_beachandocean_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/404_insand_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/404_logo_balls_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/banner_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/kogneato_metal_detecting_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
134 changes: 134 additions & 0 deletions public/img/kogneato_metal_detecting_dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
82 changes: 82 additions & 0 deletions public/img/kogneato_mywidgets_dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 5769e93

Please sign in to comment.