diff --git a/public/assets/css/front/index.css b/public/assets/css/front/index.css index 7fb9463..d22d13d 100644 --- a/public/assets/css/front/index.css +++ b/public/assets/css/front/index.css @@ -4,34 +4,41 @@ section[role="start"] { background-position: center; background-repeat: no-repeat; background-size: cover; - display: flex; align-items: center; justify-content: center; } -section[role="start"] div { +section[role="start"] div[role="index-wrapper"] { + margin: 0 auto; + width: 100%; + max-width: 600px; + padding-top: 30px; +} + +section[role="start"] div[role="index-search"] { background: var(--primary); - width: 400px; - border-radius: 3px; - padding: 5px; + border-radius: 5px; + padding: 15px; } -section[role="start"] span[role="title"] { - font-size: 100px; - line-height: 80px; - font-weight: bold; - color: var(--secondary); +section[role="start"] div input[type="text"] { + font-size: 2em; + width: 87%; } -section[role="start"] p { - color: var(--white); - display: inline-block; +section[role="start"] div button { vertical-align: top; - margin: 6px auto; - font-size: 1.87em; + width: 57px; + height: 57px; } -section[role="start"] p a { - color: var(--highlight); - margin-top: 5px; +section[role="start"] div button i { + font-size: 1.5em; +} + +section[role="start"] a.search-link { + background: var(--secondary); + padding: 5px; + color: var(--primary); + border-radius: 3px; } diff --git a/public/assets/css/global/frame.css b/public/assets/css/global/frame.css index 7127e93..8c17c24 100644 --- a/public/assets/css/global/frame.css +++ b/public/assets/css/global/frame.css @@ -28,6 +28,10 @@ header > nav { padding: 10px; } +header > nav a { + color: var(--primary); +} + header > nav i { font-size: 1.3em; } @@ -49,7 +53,7 @@ main { /* GLOBALS */ a { - color: var(--primary); + color: var(--highlight); text-decoration: none; border-bottom: 1px solid var(--white); transition: all 0.2s linear; @@ -61,7 +65,7 @@ a[role="nav-links"] { } a:hover { - border-bottom: 1px solid var(--primary); + border-bottom: 1px solid var(--secondary); } sup { diff --git a/src/Controller/Routes/Back/Locations.php b/src/Controller/Routes/Back/Locations.php index 880ef7c..1d2fb1b 100644 --- a/src/Controller/Routes/Back/Locations.php +++ b/src/Controller/Routes/Back/Locations.php @@ -12,7 +12,6 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\RequestStack; use Doctrine\Persistence\ManagerRegistry; use App\Service\HandleLocations; -use Doctrine\DBAL\Connection; use App\Service\Auth; use App\Service\FileUploader; use App\Service\Render; @@ -37,7 +36,6 @@ class Locations extends AbstractController Auth $auth, HandleLocations $locations, ManagerRegistry $doctrine, - Connection $connection, Render $render, string $pageNum ): Response { diff --git a/src/Controller/Routes/Back/Members.php b/src/Controller/Routes/Back/Members.php index 19243ae..5568055 100644 --- a/src/Controller/Routes/Back/Members.php +++ b/src/Controller/Routes/Back/Members.php @@ -16,7 +16,7 @@ use App\Service\Auth; class Members extends AbstractController { /** - * @Route("/den/members/page/{pageNum}", name="den-locations") + * @Route("/den/members/page/{pageNum}", name="den-members-index") */ public function showMembers( Request $request, diff --git a/src/Controller/Routes/Front/Index.php b/src/Controller/Routes/Front/Index.php index 788f34b..d3eea1d 100644 --- a/src/Controller/Routes/Front/Index.php +++ b/src/Controller/Routes/Front/Index.php @@ -21,7 +21,35 @@ class Index extends AbstractController public function showIndex(Request $request, Auth $auth, Render $render, HandleLocations $locations): Response { $list = $locations->getActiveLocations(); - return $render->page(["count" => count($list)], "This is The Bad Space", "front/index.twig"); + if ($request->getMethod() == "GET") { + return $render->page(["count" => count($list)], "This is The Bad Space", "front/index.twig"); + } else { + $results = $locations->searchLocations($request->request->get("index_search")); + return $render->page( + ["count" => count($list), + "items" => $results['items'] + ], + "This is The Bad Space", + "front/index.twig" + ); + }; + } + + /** + * @Route("/location/{uuid}", name="front-location") + */ + public function showLocations( + Request $request, + Render $render, + HandleLocations $locations, + string $uuid = "none" + ): Response { + $location = $locations->getLocationbyUUID($uuid); + return $render->page( + ["location" => $location[0]], + "The Bad Space | " . $location[0]->getName(), + "front/location.twig" + ); } /** diff --git a/src/Service/HandleLocations.php b/src/Service/HandleLocations.php index c09ae94..964a647 100644 --- a/src/Service/HandleLocations.php +++ b/src/Service/HandleLocations.php @@ -11,6 +11,7 @@ use Exception; use Doctrine\ORM\EntityManagerInterface; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\Uid\Uuid; +use Doctrine\DBAL\Connection; use App\Entity\Location; use League\Csv\Reader; @@ -25,16 +26,59 @@ class HandleLocations { private $session; private $entityManager; + private $conn; private $limit = 4; public function __construct( + Connection $connection, EntityManagerInterface $entityManager, RequestStack $requestStack ) { + $this->connection = $connection; $this->entityManager = $entityManager; $this->session = $requestStack->getSession(); } + public function searchLocations(string $terms) + { + $errorMessage = null; + $response = null; + //$utils = new StringTools(); + //$term = $utils->removeCommonWords($terms); + $terms = str_replace(",", "", $terms); + $terms = str_replace(" ", "|", $terms); + + try { + $search = $this->connection->fetchAllAssociative("SELECT * FROM searchlocations('$terms')"); + } catch (PDOException $error) { + $errorMessage = $error->getMessage(); + } catch (DBALException $error) { + $errorMessage = $error->getMessage(); + } catch (ORMException $error) { + $errorMessage = $error->getMessage(); + } catch (Exception $error) { + $errorMessage = $error->getMessage(); + } catch (SyntaxErrorException $error) { + $errorMessage = $error->getMessage(); + } + + if ($errorMessage != null) { + $response = [ + "status" => false, + "message" => $errorMessage, + ]; + } else { + $response = [ + "status" => true, + "message" => "Good Reqeust", + "items" => $search, + "terms" => $terms, + ]; + } + + return $response; + } + public function getActiveLocations() { $listings = $this->entityManager->getRepository(Location::class); diff --git a/templates/front/about.twig b/templates/front/about.twig index 96cc4f8..08bc052 100644 --- a/templates/front/about.twig +++ b/templates/front/about.twig @@ -16,15 +16,12 @@ Artist Marcia X with additional support from Ginger - to provide a catolog of instances seek to cause harm and reduce the quality of experience in the fediverse. + to provide a catalog of instances that seek to cause harm and reduce the quality of experience in the fediverse.
- - -- Technial support provided by + Technical support provided by Ro.
diff --git a/templates/front/index.twig b/templates/front/index.twig index 690d5ae..4d04dfe 100644 --- a/templates/front/index.twig +++ b/templates/front/index.twig @@ -5,12 +5,29 @@ {% block main %}
- Bad Spaces tracked.
- Pace yourself.
-