Skip to content

Commit

Permalink
Improved theme styles
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelfolaron committed Nov 10, 2024
1 parent b672289 commit 61e4fb2
Show file tree
Hide file tree
Showing 70 changed files with 1,227 additions and 619 deletions.
6 changes: 6 additions & 0 deletions .idea/codebuddy.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 0 additions & 34 deletions .idea/leantime-oss.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 2 additions & 35 deletions .idea/php.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 19 additions & 24 deletions app/Domain/Menu/Composers/HeadMenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,38 +5,34 @@
use Illuminate\Contracts\Container\BindingResolutionException;
use Leantime\Core\Controller\Composer;
use Leantime\Core\Controller\Frontcontroller as FrontcontrollerCore;
use Leantime\Core\Theme;
use Leantime\Core\UI\Theme;
use Leantime\Domain\Auth\Services\Auth as AuthService;
use Leantime\Domain\Help\Services\Helper;
use Leantime\Domain\Menu\Repositories\Menu as MenuRepo;
use Leantime\Domain\Notifications\Services\Notifications as NotificationService;
use Leantime\Domain\Timesheets\Services\Timesheets as TimesheetService;
use Leantime\Domain\Users\Services\Users as UserService;

/**
*
*/
class HeadMenu extends Composer
{
public static array $views = [
'menu::headMenu',
];

private NotificationService $notificationService;

private TimesheetService $timesheets;

private UserService $userService;

private AuthService $authService;

private Helper $helperService;

private Theme $themeCore;

private MenuRepo $menuRepo;

/**
* @param NotificationService $notificationService
* @param TimesheetService $timesheets
* @param UserService $userService
* @param AuthService $authService
* @return void
*/
public function init(
NotificationService $notificationService,
TimesheetService $timesheets,
Expand All @@ -56,17 +52,16 @@ public function init(
}

/**
* @return array
* @throws BindingResolutionException
*/
public function with(): array
{
$notificationService = $this->notificationService;
$notifications = array();
$notifications = [];
$newnotificationCount = 0;
if (session()->exists("userdata")) {
$notifications = $notificationService->getAllNotifications(session("userdata.id"));
$newnotificationCount = $notificationService->getAllNotifications(session("userdata.id"), true);
if (session()->exists('userdata')) {
$notifications = $notificationService->getAllNotifications(session('userdata.id'));
$newnotificationCount = $notificationService->getAllNotifications(session('userdata.id'), true);
}

$nCount = is_array($newnotificationCount) ? count($newnotificationCount) : 0;
Expand All @@ -75,7 +70,7 @@ public function with(): array
$totalNewMentions =
$totalNewNotifications = 0;

$menuType = $this->menuRepo->getSectionMenuType(FrontcontrollerCore::getCurrentRoute(), "project");
$menuType = $this->menuRepo->getSectionMenuType(FrontcontrollerCore::getCurrentRoute(), 'project');

foreach ($notifications as $notif) {
if ($notif['type'] == 'mention') {
Expand All @@ -92,19 +87,19 @@ public function with(): array
}

$user = false;
if (session()->exists("userdata")) {
$user = $this->userService->getUser(session("userdata.id"));
if (session()->exists('userdata')) {
$user = $this->userService->getUser(session('userdata.id'));
}

if (!$user) {
if (! $user) {
$this->authService->logout();
FrontcontrollerCore::redirect(BASE_URL . '/auth/login');
FrontcontrollerCore::redirect(BASE_URL.'/auth/login');
}

$modal = $this->helperService->getHelperModalByRoute(FrontcontrollerCore::getCurrentRoute());

if (!session()->exists("companysettings.logoPath")) {
session(["companysettings.logoPath" => $this->themeCore->getLogoUrl()]);
if (! session()->exists('companysettings.logoPath')) {
session(['companysettings.logoPath' => $this->themeCore->getLogoUrl()]);
}

return [
Expand All @@ -115,7 +110,7 @@ public function with(): array
'totalNewNotifications' => $totalNewNotifications,
'menuType' => $menuType,
'notifications' => $notifications ?? [],
'onTheClock' => session()->exists("userdata") ? $this->timesheets->isClocked(session("userdata.id")) : false,
'onTheClock' => session()->exists('userdata') ? $this->timesheets->isClocked(session('userdata.id')) : false,
'activePath' => FrontcontrollerCore::getCurrentRoute(),
'action' => FrontcontrollerCore::getActionName(),
'module' => FrontcontrollerCore::getModuleName(),
Expand Down
45 changes: 24 additions & 21 deletions app/Domain/Menu/Composers/Menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
use Leantime\Core\Http\IncomingRequest as IncomingRequestCore;
use Leantime\Domain\Menu\Repositories\Menu as MenuRepository;

/**
*
*/
class Menu extends Composer
{
use DispatchesEvents;
Expand All @@ -21,15 +18,11 @@ class Menu extends Composer
];

private MenuRepository $menuRepo;

private IncomingRequestCore $incomingRequest;

private \Leantime\Domain\Menu\Services\Menu $menuService;

/**
* @param MenuRepository $menuRepo
* @param \Leantime\Domain\Menu\Services\Menu $menuService
* @param IncomingRequestCore $request
* @return void
*/
public function init(
MenuRepository $menuRepo,
\Leantime\Domain\Menu\Services\Menu $menuService,
Expand All @@ -41,13 +34,13 @@ public function init(
}

/**
* @param array $data
* @return array
* @param array $data
*
* @throws BindingResolutionException
*/
public function with(): array
{
$allAssignedprojects =
$allAssignedprojects = $showSettingsIndicator = false;
$allAvailableProjects =
$recentProjects =
$favoriteProjects =
Expand All @@ -60,14 +53,14 @@ public function with(): array
$projectType = '';
$menuType = 'default';

$projectSelectFilter = session("usersettings.projectSelectFilter") ?? array(
"groupBy" => "structure",
"client" => null,
);
$projectSelectFilter = session('usersettings.projectSelectFilter') ?? [
'groupBy' => 'structure',
'client' => null,
];

if (session()->exists("userdata")) {
if (session()->exists('userdata')) {
//Getting all projects (ignoring client filter, clients are filtered on the frontend)
$projectVars = $this->menuService->getUserProjectList(session("userdata.id"), $projectSelectFilter["client"]);
$projectVars = $this->menuService->getUserProjectList(session('userdata.id'), $projectSelectFilter['client']);

$allAssignedprojects = $projectVars['assignedProjects'];
$allAvailableProjects = $projectVars['availableProjects'];
Expand All @@ -82,6 +75,13 @@ public function with(): array
$currentProject = $projectVars['currentProject'];
}

// Check for new widgets to show settings indicator
if (session()->exists('userdata')) {
$widgetService = app()->make(\Leantime\Domain\Widgets\Services\Widgets::class);
$newWidgets = $widgetService->getNewWidgets(session('userdata.id'));
$showSettingsIndicator = !empty($newWidgets);
}

$menuType = $this->menuRepo->getSectionMenuType(FrontcontrollerCore::getCurrentRoute(), $menuType);

if (str_contains($redirectUrl = $this->incomingRequest->getRequestUri(), 'showProject')) {
Expand All @@ -97,9 +97,9 @@ public function with(): array
'action' => '',
'settingsIcon' => '',
'settingsTooltip' => '',
];
];

if ($menuType == "project" || $menuType == "default") {
if ($menuType == 'project' || $menuType == 'default') {
$settingsLink = [
'label' => __('menu.project_settings'),
'module' => 'projects',
Expand All @@ -109,7 +109,9 @@ public function with(): array
];
}

$newProjectUrl = self::dispatch_filter("startSomething", "#/projects/createnew");
$settingsLink = self::dispatch_filter('settingsLink', $settingsLink, ["type" => $menuType]);

$newProjectUrl = self::dispatch_filter('startSomething', '#/projects/createnew');

return [
'currentClient' => $currentClient,
Expand All @@ -132,6 +134,7 @@ public function with(): array
'projectSelectFilter' => $projectSelectFilter,
'clients' => $clients,
'startSomethingUrl' => $newProjectUrl,
'showSettingsIndicator' => $showSettingsIndicator,
];
}
}
2 changes: 1 addition & 1 deletion app/Domain/Menu/Templates/headMenu.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class="dropdown-toggle profileHandler newsDropDownHandler"

</a>

<div class='dropdown-menu tw-p-m' id='newsDropdown'>
<div class='dropdown-menu tw-p-m tw-h-screen tw-overflow-y-auto' id='newsDropdown'>
<div class="htmx-indicator">
<x-global::loadingText type="text" count="3" includeHeadline="true" />
</div>
Expand Down
Loading

0 comments on commit 61e4fb2

Please sign in to comment.