Remove *more* unused stuff
This commit is contained in:
parent
da992ff1b7
commit
cebb14f59c
52 changed files with 791 additions and 2984 deletions
|
@ -1,68 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\View\Components;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\View\Component;
|
||||
|
||||
class DiscordStatus extends Component
|
||||
{
|
||||
/**
|
||||
* Create a new component instance.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns current Discord presence from Lanyard API
|
||||
* @return array|mixed
|
||||
*/
|
||||
public function getDiscordPresence(): mixed {
|
||||
// If it's already cached just return that
|
||||
if (Cache::has('discord_presence')) {
|
||||
return Cache::get('discord_presence');
|
||||
}
|
||||
|
||||
$response = Http::get('https://api.lanyard.rest/v1/users/' . Config::get('services.lanyard.user_id'));
|
||||
$data = $response->json();
|
||||
if (!isset($data["data"])) return null;
|
||||
$presence = $data["data"];
|
||||
Cache::put('discord_presence', $presence, now()->addSeconds(60));
|
||||
return $presence;
|
||||
}
|
||||
|
||||
public function getOnlineStatus(): ?array {
|
||||
$presence = $this->getDiscordPresence();
|
||||
if ($presence == null) return null;
|
||||
return match ($presence["discord_status"]) {
|
||||
"online", "dnd" => [
|
||||
"text" => "online",
|
||||
"color" => "#02c83a"
|
||||
],
|
||||
"idle" => [
|
||||
"text" => "away",
|
||||
"color" => "#d77c20"
|
||||
],
|
||||
default => [
|
||||
"text" => "offline",
|
||||
"color" => "#ca3329"
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*/
|
||||
public function render(): View|Closure|string
|
||||
{
|
||||
return view('components.discord-status', [
|
||||
'status' => $this->getOnlineStatus(),
|
||||
]);
|
||||
}
|
||||
}
|
|
@ -6,22 +6,19 @@
|
|||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\View\Component;
|
||||
|
||||
class LastFMCurrent extends Component
|
||||
{
|
||||
class LastFMCurrent extends Component {
|
||||
public $track;
|
||||
/**
|
||||
* Create a new component instance.
|
||||
*/
|
||||
public function __construct($track)
|
||||
{
|
||||
public function __construct($track) {
|
||||
$this->track = $track;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*/
|
||||
public function render(): View|Closure|string
|
||||
{
|
||||
return view('components.lasfm-current');
|
||||
public function render(): View|Closure|string {
|
||||
return view('components.lastfm-current');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,22 +6,19 @@
|
|||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\View\Component;
|
||||
|
||||
class LastFMTop extends Component
|
||||
{
|
||||
class LastFMTop extends Component {
|
||||
public $tracks;
|
||||
/**
|
||||
* Create a new component instance.
|
||||
*/
|
||||
public function __construct($tracks)
|
||||
{
|
||||
public function __construct($tracks) {
|
||||
$this->tracks = $tracks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*/
|
||||
public function render(): View|Closure|string
|
||||
{
|
||||
public function render(): View|Closure|string {
|
||||
return view('components.lastfm-top');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,15 +6,13 @@
|
|||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\View\Component;
|
||||
|
||||
class LastFMTrack extends Component
|
||||
{
|
||||
class LastFMTrack extends Component {
|
||||
public $track;
|
||||
public $count;
|
||||
/**
|
||||
* Create a new component instance.
|
||||
*/
|
||||
public function __construct($track, $count)
|
||||
{
|
||||
public function __construct($track, $count) {
|
||||
$this->track = $track;
|
||||
$this->count = $count;
|
||||
}
|
||||
|
@ -22,8 +20,7 @@ public function __construct($track, $count)
|
|||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*/
|
||||
public function render(): View|Closure|string
|
||||
{
|
||||
public function render(): View|Closure|string {
|
||||
return view('components.lastfm-track');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,22 +6,19 @@
|
|||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\View\Component;
|
||||
|
||||
class Navbar extends Component
|
||||
{
|
||||
class Navbar extends Component {
|
||||
public $title;
|
||||
/**
|
||||
* Create a new component instance.
|
||||
*/
|
||||
public function __construct($title)
|
||||
{
|
||||
public function __construct($title) {
|
||||
$this->title = $title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*/
|
||||
public function render(): View|Closure|string
|
||||
{
|
||||
public function render(): View|Closure|string {
|
||||
return view('components.navigation');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\View\Components;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\View\Component;
|
||||
|
||||
class NeverSaid extends Component
|
||||
{
|
||||
/**
|
||||
* Create a new component instance.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
function returnQuote(): array {
|
||||
$quotes = config('quotes.neversaid');
|
||||
$index = rand(0, count($quotes) - 1);
|
||||
return $quotes[$index];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*/
|
||||
public function render(): View|Closure|string
|
||||
{
|
||||
return view('components.never-said', [
|
||||
"quote" => $this->returnQuote()
|
||||
]);
|
||||
}
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\View\Components;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\View\Component;
|
||||
|
||||
class TohQuote extends Component
|
||||
{
|
||||
/**
|
||||
* Create a new component instance.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
function returnQuote(): array {
|
||||
$quotes = config('quotes.toh');
|
||||
$index = rand(0, count($quotes) - 1);
|
||||
return $quotes[$index];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*/
|
||||
public function render(): View|Closure|string
|
||||
{
|
||||
return view('components.toh-quote',[
|
||||
'quote' => $this->returnQuote()
|
||||
]);
|
||||
}
|
||||
}
|
|
@ -9,8 +9,7 @@
|
|||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\View\Component;
|
||||
|
||||
class Wah extends Component
|
||||
{
|
||||
class Wah extends Component {
|
||||
/**
|
||||
* Create a new component instance.
|
||||
*/
|
||||
|
|
|
@ -1,50 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\View\Components;
|
||||
|
||||
use Closure;
|
||||
use Exception;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\View\Component;
|
||||
|
||||
class Weather extends Component
|
||||
{
|
||||
/**
|
||||
* Create a new component instance.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function getWeatherData(): mixed {
|
||||
// If it's already cached just return that
|
||||
if (Cache::has('weather_data')) {
|
||||
return Cache::get('weather_data');
|
||||
}
|
||||
|
||||
try {
|
||||
$response = Http::get('http://' . Config::get('services.weatherlink') . '/v1/current_conditions');
|
||||
$data = $response->json();
|
||||
$conditions = $data["data"]["conditions"];
|
||||
Cache::put('weather_data', $conditions, now()->addSeconds(60));
|
||||
return $conditions;
|
||||
} catch (Exception $ex) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*/
|
||||
public function render(): View|Closure|string
|
||||
{
|
||||
return view('components.weather', [
|
||||
'conditions' => $this->getWeatherData(),
|
||||
]);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue