From: Daniel Karbach Date: Fri, 25 Aug 2023 21:27:34 +0000 (+0200) Subject: tech meta image X-Git-Url: https://git.localhorst.tv/?a=commitdiff_plain;ds=sidebyside;h=d8ca13d8ccb5efe181198d0e5243a26c9f807aa1;hp=aa5f285a5fd3c1047c428b3e9f843b900b966f98;p=alttp.git tech meta image --- diff --git a/app/Http/Controllers/TechniqueController.php b/app/Http/Controllers/TechniqueController.php index 1d51aff..b88b5a3 100644 --- a/app/Http/Controllers/TechniqueController.php +++ b/app/Http/Controllers/TechniqueController.php @@ -72,9 +72,15 @@ class TechniqueController extends Controller public function web(Request $request, $type, $name) { $tech = Technique::where('type', '=', $type)->where('name', '=', $name)->first(); if ($tech) { - return view('app') + $view = view('app') ->with('title', $tech->getTranslatedProperty('title')) ->with('description', $tech->getTranslatedProperty('short')); + if ($tech->image) { + $view = $view->with('image', url($tech->image)); + } else if ($tech->gif) { + $view = $view->with('image', url($tech->gif)); + } + return $view; } $url_map = [ 'dungeon' => 'dungeons', diff --git a/resources/js/components/pages/Technique.js b/resources/js/components/pages/Technique.js index 30eed5b..a24b879 100644 --- a/resources/js/components/pages/Technique.js +++ b/resources/js/components/pages/Technique.js @@ -90,6 +90,14 @@ const Technique = ({ basepath, type }) => { {getTranslation(technique, 'title', i18n.language)} + {technique.image ? + + + : null} + {!technique.image && technique.gif ? + + + : null} @endisset +@isset($image) + + +@endisset