Skip to content

Commit

Permalink
New routing for Permanent Config (#236)
Browse files Browse the repository at this point in the history
* Add new frontend routes and sidebar options

* Add backend routes
  • Loading branch information
PaulJKim authored and cmaddox5 committed Dec 13, 2023
1 parent 9d5d37b commit 5924a06
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 0 deletions.
5 changes: 5 additions & 0 deletions assets/js/components/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ const Dashboard = React.lazy(() => import("./Dashboard/Dashboard"));
const PlacesPage = React.lazy(() => import("./Dashboard/PlacesPage"));
const AlertsPage = React.lazy(() => import("./Dashboard/AlertsPage"));
const AlertDetails = React.lazy(() => import("./Dashboard/AlertDetails"));
const PendingScreensPage = React.lazy(
() => import("./Dashboard/PendingScreensPage")
);

class AppRoutes extends React.Component {
render() {
Expand All @@ -30,6 +33,8 @@ class AppRoutes extends React.Component {
<Route path="dashboard" element={<PlacesPage />}></Route>
<Route path="alerts" element={<AlertsPage />}></Route>
<Route path="alerts/:id" element={<AlertDetails />}></Route>
<Route path="pending" element={<PendingScreensPage />}></Route>
<Route path="configure-screens" element={<></>}></Route>
</Route>
</Routes>
</React.Suspense>
Expand Down
11 changes: 11 additions & 0 deletions assets/js/components/Dashboard/PendingScreensPage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React, { ComponentType } from "react";

const PendingScreensPage: ComponentType = () => {
return (
<div>
<div className="page-content__header">Pending</div>
</div>
);
};

export default PendingScreensPage;
16 changes: 16 additions & 0 deletions assets/js/components/Dashboard/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import {
CollectionFill,
ExclamationTriangleFill,
PersonFill,
PlusLg,
ClockFill,
} from "react-bootstrap-icons";
import TSquare from "../../../static/images/t-square.svg";

Expand Down Expand Up @@ -39,6 +41,20 @@ const Sidebar: ComponentType = () => {
<span className="nav-link__name">Posted Alerts</span>
</Button>
</Link>
<Link className="sidebar-link" to="/pending">
<Button className={pathname === "pending" ? "selected" : ""}>
<ClockFill size={20} className="sidebar-link__icon" />
<span className="nav-link__name">Pending</span>
</Button>
</Link>
<Link className="sidebar-link" to="/configure-screens">
<Button
className={pathname === "configure-screens" ? "selected" : ""}
>
<PlusLg size={20} className="sidebar-link__icon" />
<span className="nav-link__name">Configure</span>
</Button>
</Link>
{/* This button slightly different to trigger a reload */}
<Button href="/" className="takeover-button">
<ExclamationTriangleFill size={20} className="sidebar-link__icon" />
Expand Down
4 changes: 4 additions & 0 deletions lib/screenplay_web/controllers/config_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ defmodule ScreenplayWeb.ConfigController do

alias Screenplay.Config.PermanentConfig

def index(conn, _params) do
render(conn, "index.html")
end

def add(conn, _params) do
PermanentConfig.add_new_screen()
conn
Expand Down
2 changes: 2 additions & 0 deletions lib/screenplay_web/router.ex
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ defmodule ScreenplayWeb.Router do

get("/dashboard", DashboardController, :index)
get("/alerts/*id", AlertsController, :index)
get("/pending", ConfigController, :index)
get("/configure-screens", ConfigController, :index)
get("/unauthorized", UnauthorizedController, :index)
end

Expand Down
1 change: 1 addition & 0 deletions lib/screenplay_web/templates/config/index.html.eex
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<div id="app"></div>
3 changes: 3 additions & 0 deletions lib/screenplay_web/views/config_view.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
defmodule ScreenplayWeb.ConfigView do
use ScreenplayWeb, :view
end

0 comments on commit 5924a06

Please sign in to comment.