Skip to content

Commit

Permalink
New dashboard & sidebar
Browse files Browse the repository at this point in the history
  • Loading branch information
ilestis committed Aug 26, 2023
1 parent 8deb66a commit 06c23db
Show file tree
Hide file tree
Showing 32 changed files with 342 additions and 584 deletions.
52 changes: 26 additions & 26 deletions app/Services/SidebarService.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,81 +174,81 @@ protected function setupElements(): void
{
$this->elements = [
'dashboard' => [
'icon' => 'fa-solid fa-th-large',
'icon' => 'fa-duotone fa-house',
'label' => 'sidebar.dashboard',
'module' => false,
'route' => 'dashboard',
'fixed' => true,
],
'menu_links' => [
'icon' => 'fa-solid fa-star',
'icon' => 'fa-duotone fa-bookmark',
'label' => 'entities.menu_links',
'fixed' => true,
],
'campaigns' => [
'icon' => 'fa-solid fa-globe',
'icon' => 'fa-duotone fa-mountains',
'label' => 'sidebar.world',
'module' => false,
'route' => 'overview',
'fixed' => true,
],
'characters' => [
'icon' => 'fa-solid fa-user',
'icon' => 'fa-duotone fa-user',
'label' => 'entities.characters',
'mode' => true,
'type_id' => config('entities.ids.character')
],
'locations' => [
'icon' => 'ra ra-tower',
'icon' => 'fa-duotone fa-circle-location-arrow',
'label' => 'entities.locations',
'tree' => true,
'mode' => true,
'type_id' => config('entities.ids.location')
],
'maps' => [
'icon' => 'fa-solid fa-map',
'icon' => 'fa-duotone fa-map',
'label' => 'entities.maps',
'tree' => true,
'mode' => true,
'type_id' => config('entities.ids.map')
],
'organisations' => [
'icon' => 'ra ra-hood',
'icon' => 'fa-duotone fa-screen-users',
'label' => 'entities.organisations',
'tree' => true,
'mode' => true,
'type_id' => config('entities.ids.organisation')
],
'families' => [
'icon' => 'ra ra-double-team',
'icon' => 'fa-duotone fa-family',
'label' => 'entities.families',
'tree' => true,
'mode' => true,
'type_id' => config('entities.ids.family')
],
'calendars' => [
'icon' => 'fa-solid fa-calendar',
'icon' => 'fa-duotone fa-calendar',
'label' => 'entities.calendars',
'tree' => true,
'mode' => true,
'type_id' => config('entities.ids.calendar')
],
'timelines' => [
'icon' => 'fa-solid fa-hourglass-half',
'icon' => 'fa-duotone fa-hourglass-half',
'label' => 'entities.timelines',
'tree' => true,
'mode' => true,
'type_id' => config('entities.ids.timeline')
],
'races' => [
'icon' => 'ra ra-wyvern',
'icon' => 'fa-duotone fa-person-fairy',
'label' => 'entities.races',
'tree' => true,
'mode' => true,
'type_id' => config('entities.ids.race')
],
'creatures' => [
'icon' => 'ra ra-raven',
'icon' => 'fa-duotone fa-snake',
'label' => 'entities.creatures',
'tree' => true,
'mode' => true,
Expand All @@ -261,84 +261,84 @@ protected function setupElements(): void
'fixed' => true,
],
'quests' => [
'icon' => 'ra ra-wooden-sign',
'icon' => 'fa-duotone fa-sign-hanging',
'label' => 'entities.quests',
'tree' => true,
'mode' => true,
'type_id' => config('entities.ids.quest')
],
'journals' => [
'icon' => 'ra ra-quill-ink',
'icon' => 'fa-duotone fa-books',
'label' => 'entities.journals',
'tree' => true,
'mode' => true,
'type_id' => config('entities.ids.journal')
],
'items' => [
'icon' => 'ra ra-gem-pendant',
'icon' => 'fa-duotone fa-gem',
'label' => 'entities.items',
'tree' => true,
'mode' => true,
'type_id' => config('entities.ids.item')
],
'events' => [
'icon' => 'fa-solid fa-bolt',
'icon' => 'fa-duotone fa-cake-candles',
'label' => 'entities.events',
'tree' => true,
'mode' => true,
'type_id' => config('entities.ids.event')
],
'abilities' => [
'icon' => 'ra ra-fire-symbol',
'icon' => 'fa-duotone fa-fire',
'label' => 'entities.abilities',
'tree' => true,
'mode' => true,
'type_id' => config('entities.ids.ability')
],
'notes' => [
'icon' => 'fa-solid fa-book-open',
'icon' => 'fa-duotone fa-book-open',
'label' => 'entities.notes',
'tree' => true,
'mode' => true,
'type_id' => config('entities.ids.note')
],
'other' => [
'icon' => 'fa-solid fa-cubes',
'icon' => 'fa-duotone fa-database',
'label' => 'sidebar.other',
'module' => false,
'route' => false,
'fixed' => true,
],
'tags' => [
'icon' => 'fa-solid fa-tags',
'icon' => 'fa-duotone fa-tags',
'label' => 'entities.tags',
'tree' => true,
'mode' => true,
'type_id' => config('entities.ids.tag')
],
'conversations' => [
'icon' => 'fa-solid fa-comment',
'icon' => 'fa-duotone fa-comments',
'label' => 'entities.conversations',
],
'dice_rolls' => [
'icon' => 'ra ra-dice-five',
'icon' => 'fa-duotone fa-dice',
'label' => 'entities.dice_rolls',
],
'relations' => [
'icon' => 'fa-solid fa-people-arrows',
'icon' => 'fa-duotone fa-people-arrows',
'label' => 'sidebar.relations',
'perm' => 'relations',
'module' => false,
],
'gallery' => [
'icon' => 'fa-solid fa-images',
'icon' => 'fa-duotone fa-images',
'label' => 'sidebar.gallery',
'route' => 'campaign.gallery.index',
'perm' => 'gallery',
'module' => false,
],
'attribute_templates' => [
'icon' => 'fa-solid fa-copy',
'icon' => 'fa-duotone fa-file-export',
'label' => 'entities.attribute_templates',
],
/*'search' => [
Expand All @@ -348,7 +348,7 @@ protected function setupElements(): void
'route' => 'search',
],*/
'history' => [
'icon' => 'fa-solid fa-clock-rotate-left',
'icon' => 'fa-duotone fa-clock-rotate-left',
'label' => 'history.title',
'perm' => true,
'module' => false,
Expand Down
42 changes: 42 additions & 0 deletions app/View/Components/Widgets/Previews/Body.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

namespace App\View\Components\Widgets\Previews;

use App\Models\Campaign;
use App\Models\CampaignDashboardWidget;
use App\Models\Entity;
use App\Models\MiscModel;
use Closure;
use Illuminate\Contracts\View\View;
use Illuminate\View\Component;

class Body extends Component
{
public Campaign $campaign;
public CampaignDashboardWidget $widget;
public Entity $entity;
public MiscModel $model;

/**
* Create a new component instance.
*/
public function __construct(
Campaign $campaign,
CampaignDashboardWidget $widget,
Entity $entity,
MiscModel $model,
) {
$this->campaign = $campaign;
$this->widget = $widget;
$this->entity = $entity;
$this->model = $model;
}

/**
* Get the view / contents that represent the component.
*/
public function render(): View|Closure|string
{
return view('components.widgets.previews.body');
}
}
54 changes: 54 additions & 0 deletions app/View/Components/Widgets/Previews/Head.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?php

namespace App\View\Components\Widgets\Previews;

use App\Facades\Img;
use App\Models\Campaign;
use App\Models\CampaignDashboardWidget;
use App\Models\Entity;
use Closure;
use Illuminate\Contracts\View\View;
use Illuminate\View\Component;

class Head extends Component
{
public Campaign $campaign;
public CampaignDashboardWidget $widget;
public Entity $entity;

/**
* Create a new component instance.
*/
public function __construct(
Campaign $campaign,
CampaignDashboardWidget $widget,
Entity $entity,
) {
$this->campaign = $campaign;
$this->widget = $widget;
$this->entity = $entity;
}

/**
* Get the view / contents that represent the component.
*/
public function render(): View|Closure|string
{
return view('components.widgets.previews.head')
->with('image', $this->headerImage());
}

protected function headerImage(): null|string
{
if ($this->widget->conf('entity-header') && $this->campaign->boosted() && $this->entity->header_image) {
return $this->entity->thumbnail(1200, 400, 'header_image');
} elseif ($this->widget->conf('entity-header') && $this->campaign->boosted() && $this->widget->entity->header) {
return $this->entity->header->path;
} elseif ($this->entity->image) {
return Img::crop(1200, 400)->url($this->entity->image->path);
} elseif ($this->entity->child->image) {
return $this->entity->child->thumbnail(400);
}
return null;
}
}
23 changes: 23 additions & 0 deletions config/entities.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,28 @@
'dice_rolls' => 'App\Models\DiceRoll',
'menu_links' => 'App\Models\MenuLink',
'relations' => 'App\Models\Relation',
],

'icons' => [
'character' => 'fa-duotone fa-user',
'family' => 2,
'location' => 3,
'organisation' => 4,
'item' => 5,
'note' => 6,
'event' => 7,
'calendar' => 8,
'race' => 9,
'quest' => 10,
'journal' => 11,
'tag' => 12,
'dice_roll' => 13,
'conversation' => 14,
'attribute_template' => 15,
'ability' => 16,
'map' => 17,
'timeline' => 18,
'menu_link' => 19,
'creature' => 20,
]
];
Loading

0 comments on commit 06c23db

Please sign in to comment.