Initial commit
This commit is contained in:
30
app/View/Components/EntryMetaItem.php
Normal file
30
app/View/Components/EntryMetaItem.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\View\Component;
|
||||
|
||||
class EntryMetaItem extends Component
|
||||
{
|
||||
/**
|
||||
* Create a new component instance.
|
||||
*/
|
||||
public function __construct(
|
||||
public string $label,
|
||||
public string $value,
|
||||
public string $route = "#"
|
||||
)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*/
|
||||
public function render(): View|Closure|string
|
||||
{
|
||||
return view('components.entry-meta-item');
|
||||
}
|
||||
}
|
||||
29
app/View/Components/EntrySectionTitle.php
Normal file
29
app/View/Components/EntrySectionTitle.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\View\Component;
|
||||
|
||||
class EntrySectionTitle extends Component
|
||||
{
|
||||
/**
|
||||
* Create a new component instance.
|
||||
*/
|
||||
public function __construct(
|
||||
public string $label,
|
||||
public string $icon = ''
|
||||
)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*/
|
||||
public function render(): View|Closure|string
|
||||
{
|
||||
return view('components.entry-section-title');
|
||||
}
|
||||
}
|
||||
43
app/View/Components/ErrorBlock.php
Normal file
43
app/View/Components/ErrorBlock.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\View\Component;
|
||||
|
||||
class ErrorBlock extends Component
|
||||
{
|
||||
|
||||
private const array ERROR_TYPES = [
|
||||
'custom' => [
|
||||
'icon' => 'ban',
|
||||
'message' => '%s'
|
||||
],
|
||||
'page-not-allowed' => [
|
||||
'icon' => 'shield-ban',
|
||||
'message' => "You do not have permission to access this page.\nRequired permission: %s"
|
||||
]
|
||||
];
|
||||
|
||||
public array $errorArray;
|
||||
|
||||
/**
|
||||
* Create a new component instance.
|
||||
*/
|
||||
public function __construct(
|
||||
public string $errorType,
|
||||
public string $message = ""
|
||||
)
|
||||
{
|
||||
$this->errorArray = self::ERROR_TYPES[$errorType] ?? self::ERROR_TYPES['custom'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*/
|
||||
public function render(): View|Closure|string
|
||||
{
|
||||
return view('components.error-block');
|
||||
}
|
||||
}
|
||||
29
app/View/Components/FormErrorText.php
Normal file
29
app/View/Components/FormErrorText.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\View\Component;
|
||||
|
||||
class FormErrorText extends Component
|
||||
{
|
||||
/**
|
||||
* Create a new component instance.
|
||||
*/
|
||||
public function __construct(
|
||||
public string $message,
|
||||
public bool $icon = true
|
||||
)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*/
|
||||
public function render(): View|Closure|string
|
||||
{
|
||||
return view('components.form-error-text');
|
||||
}
|
||||
}
|
||||
30
app/View/Components/FormFieldTitle.php
Normal file
30
app/View/Components/FormFieldTitle.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\View\Component;
|
||||
|
||||
class FormFieldTitle extends Component
|
||||
{
|
||||
/**
|
||||
* Create a new component instance.
|
||||
*/
|
||||
public function __construct(
|
||||
public string $name,
|
||||
public string $helper = "",
|
||||
public bool $required = false,
|
||||
)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*/
|
||||
public function render(): View|Closure|string
|
||||
{
|
||||
return view('components.form-field-title');
|
||||
}
|
||||
}
|
||||
29
app/View/Components/FormGroupTitle.php
Normal file
29
app/View/Components/FormGroupTitle.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\View\Component;
|
||||
|
||||
class FormGroupTitle extends Component
|
||||
{
|
||||
/**
|
||||
* Create a new component instance.
|
||||
*/
|
||||
public function __construct(
|
||||
public string $label,
|
||||
public string $icon = ""
|
||||
)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*/
|
||||
public function render(): View|Closure|string
|
||||
{
|
||||
return view('components.form-group-title');
|
||||
}
|
||||
}
|
||||
29
app/View/Components/GalleryField.php
Normal file
29
app/View/Components/GalleryField.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\View\Component;
|
||||
|
||||
class GalleryField extends Component
|
||||
{
|
||||
/**
|
||||
* Create a new component instance.
|
||||
*/
|
||||
public function __construct(
|
||||
public array $oldPaths = [],
|
||||
public bool $required = true,
|
||||
)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*/
|
||||
public function render(): View|Closure|string
|
||||
{
|
||||
return view('components.gallery-field');
|
||||
}
|
||||
}
|
||||
33
app/View/Components/LanguagesSelector.php
Normal file
33
app/View/Components/LanguagesSelector.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components;
|
||||
|
||||
use App\Models\Language;
|
||||
use Closure;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\View\Component;
|
||||
|
||||
class LanguagesSelector extends Component
|
||||
{
|
||||
|
||||
public $languages;
|
||||
|
||||
/**
|
||||
* Create a new component instance.
|
||||
*/
|
||||
public function __construct(
|
||||
public array $selected = [],
|
||||
public bool $required = true
|
||||
)
|
||||
{
|
||||
$this->languages = Language::orderBy('name')->get();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*/
|
||||
public function render(): View|Closure|string
|
||||
{
|
||||
return view('components.languages-selector');
|
||||
}
|
||||
}
|
||||
29
app/View/Components/MainImageField.php
Normal file
29
app/View/Components/MainImageField.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\View\Component;
|
||||
|
||||
class MainImageField extends Component
|
||||
{
|
||||
/**
|
||||
* Create a new component instance.
|
||||
*/
|
||||
public function __construct(
|
||||
public string $oldPath = "",
|
||||
public bool $required = true
|
||||
)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*/
|
||||
public function render(): View|Closure|string
|
||||
{
|
||||
return view('components.main-image-field');
|
||||
}
|
||||
}
|
||||
35
app/View/Components/MarkdownTextarea.php
Normal file
35
app/View/Components/MarkdownTextarea.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\View\Component;
|
||||
|
||||
class MarkdownTextarea extends Component
|
||||
{
|
||||
|
||||
public array $toolbar;
|
||||
/**
|
||||
* Create a new component instance.
|
||||
*/
|
||||
public function __construct(
|
||||
public string $name,
|
||||
public string $value = "",
|
||||
public string $minHeight = "200px",
|
||||
public bool $required = true
|
||||
)
|
||||
{
|
||||
$this->toolbar = [
|
||||
'bold', 'italic', 'strikethrough', 'heading', '|', 'quote', 'unordered-list', 'ordered-list', 'check-list', '|', 'link', 'image', '|', 'preview', 'guide'
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*/
|
||||
public function render(): View|Closure|string
|
||||
{
|
||||
return view('components.markdown-textarea');
|
||||
}
|
||||
}
|
||||
28
app/View/Components/StaffCreditsField.php
Normal file
28
app/View/Components/StaffCreditsField.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\View\Component;
|
||||
|
||||
class StaffCreditsField extends Component
|
||||
{
|
||||
/**
|
||||
* Create a new component instance.
|
||||
*/
|
||||
public function __construct(
|
||||
public ?string $oldStaffCredits = null // JSON.
|
||||
)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*/
|
||||
public function render(): View|Closure|string
|
||||
{
|
||||
return view('components.staff-credits-field');
|
||||
}
|
||||
}
|
||||
44
app/View/Components/SubmitEntryStatus.php
Normal file
44
app/View/Components/SubmitEntryStatus.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\View\Component;
|
||||
|
||||
class SubmitEntryStatus extends Component
|
||||
{
|
||||
/**
|
||||
* Create a new component instance.
|
||||
*/
|
||||
public function __construct(
|
||||
public string $section
|
||||
)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function availableStates(): array
|
||||
{
|
||||
// TODO: Change for permissions.
|
||||
return [
|
||||
'draft' => "Save into my drafts",
|
||||
'pending' => "Add to submissions queue",
|
||||
'published' => "Publish it now"
|
||||
];
|
||||
}
|
||||
|
||||
public function defaultState(): string
|
||||
{
|
||||
$availableStates = array_keys( $this->availableStates() );
|
||||
return in_array('published', $availableStates) ? 'published' : ( in_array('pending', $availableStates) ? 'pending' : 'draft' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*/
|
||||
public function render(): View|Closure|string
|
||||
{
|
||||
return view('components.submit-entry-status', [ 'states' => $this->availableStates(), 'defaultState' => $this->defaultState(), 'section' => $this->section ]);
|
||||
}
|
||||
}
|
||||
39
app/View/Components/SuccessBlock.php
Normal file
39
app/View/Components/SuccessBlock.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\View\Component;
|
||||
|
||||
class SuccessBlock extends Component
|
||||
{
|
||||
|
||||
private const array SUCCESS_TYPES = [
|
||||
'custom' => [
|
||||
'icon' => 'check',
|
||||
'message' => '%s'
|
||||
]
|
||||
];
|
||||
|
||||
public array $successArray;
|
||||
|
||||
/**
|
||||
* Create a new component instance.
|
||||
*/
|
||||
public function __construct(
|
||||
public string $successType,
|
||||
public string $message = "",
|
||||
)
|
||||
{
|
||||
$this->successArray = self::SUCCESS_TYPES[$this->successType] ?? self::SUCCESS_TYPES['custom'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*/
|
||||
public function render(): View|Closure|string
|
||||
{
|
||||
return view('components.success-block');
|
||||
}
|
||||
}
|
||||
30
app/View/Components/XenForoAvatar.php
Normal file
30
app/View/Components/XenForoAvatar.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components;
|
||||
|
||||
use App\Auth\XenForoUser;
|
||||
use Closure;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\View\Component;
|
||||
|
||||
class XenForoAvatar extends Component
|
||||
{
|
||||
/**
|
||||
* Create a new component instance.
|
||||
*/
|
||||
public function __construct(
|
||||
public ?XenForoUser $user = null,
|
||||
)
|
||||
{
|
||||
if( $this->user === null )
|
||||
$this->user = \Auth::user();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*/
|
||||
public function render(): View|Closure|string
|
||||
{
|
||||
return view('components.xen-foro-avatar');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user