Skip to content

Commit

Permalink
whoopsie in the gitignore
Browse files Browse the repository at this point in the history
  • Loading branch information
brendanbond committed May 30, 2024
1 parent 417386d commit 416c9ac
Show file tree
Hide file tree
Showing 2 changed files with 119 additions and 1 deletion.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
.idea
bower_components
node_modules
app*
npm-debug.log
client/node_modules
client/dist
119 changes: 119 additions & 0 deletions client/src/components/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
import { useFormioContext } from "@formio/react";
import { Route, Router, Redirect } from "wouter";
import { useHashLocation } from "wouter/use-hash-location";

import { Login } from "./Login";
import { Layout } from "./Layout";
import { useInfoPanelContext } from "../hooks/useInfoPanelContext";
import { FormList } from "./FormList";
import { FormView } from "./FormView";
import { NewForm } from "./NewForm";
import { HomePanel } from "./InfoPanel/HomePanel";
import { EditPanel } from "./InfoPanel/EditPanel";
import { AccessPanel } from "./InfoPanel/AccessPanel";
import { ActionsPanel } from "./InfoPanel/ActionsPanel";
import { UsePanel } from "./InfoPanel/UsePanel";
import { ViewDataPanel } from "./InfoPanel/ViewDataPanel";

const App = () => {
const { isAuthenticated, logout } = useFormioContext();
const { isOpen, setIsOpen } = useInfoPanelContext();
const [location] = useHashLocation();

const toggleInfoPanel = () => {
setIsOpen(!isOpen);
};

return (
<Layout onInfoPanelClick={toggleInfoPanel} onLogoutClick={logout}>
<Router hook={useHashLocation}>
{isAuthenticated ? (
<>
<Route path="/login">
<Redirect to="/" />
</Route>
<Route path="/newform">
<div className="panels">
<NewForm type="form" />
</div>
</Route>
<Route path="/newresource">
<div className="panels">
<NewForm type="resource" />
</div>
</Route>
<Route path="/resource/:id" nest>
{(params) => (
<div className="panels">
<FormList type="resource" />
<FormList type="form" />
<FormView type="resource" params={params} />
{(location === `/resource/${params.id}` ||
location ===
`/resource/${params.id}/edit/`) && (
<EditPanel type="resource" />
)}
{location ===
`/resource/${params.id}/use` && (
<UsePanel type="resource" />
)}
{location ===
`/resource/${params.id}/view` && (
<ViewDataPanel />
)}
{location ===
`/resource/${params.id}/actions` && (
<ActionsPanel type="resource" />
)}
{location ===
`/resource/${params.id}/access` && (
<AccessPanel type="resource" />
)}
</div>
)}
</Route>
<Route path="/form/:id" nest>
{(params) => (
<div className="panels">
<FormList type="resource" />
<FormList type="form" />
<FormView type="form" params={params} />
{(location === `/form/${params.id}` ||
location ===
`/form/${params.id}/edit`) && (
<EditPanel type="form" />
)}
{location === `/form/${params.id}/use` && (
<UsePanel type="form" />
)}
{location === `/form/${params.id}/view` && (
<ViewDataPanel />
)}
{location ===
`/form/${params.id}/actions` && (
<ActionsPanel type="form" />
)}
{location ===
`/form/${params.id}/access` && (
<AccessPanel type="form" />
)}
</div>
)}
</Route>
<Route path="/">
<div className="panels">
<FormList type="resource" />
<FormList type="form" />
<HomePanel />
</div>
</Route>
</>
) : (
<Login />
)}
</Router>
</Layout>
);
};

export default App;

0 comments on commit 416c9ac

Please sign in to comment.