Skip to content

Commit

Permalink
Merge pull request #42 from nofusscomputing/markdown-rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
jon-nfc authored Jan 22, 2025
2 parents 4bf4f5d + 9dc18c3 commit ebe36f7
Show file tree
Hide file tree
Showing 32 changed files with 1,820 additions and 476 deletions.
93 changes: 27 additions & 66 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { useMemo, useState } from "react";
import {
Route,
RouterProvider,
Expand All @@ -10,16 +9,17 @@ import {
import './index.css'
import Detail from "./layout/Detail";
import ErrorPage from "./layout/Error";
import { getCookie } from "./hooks/getCookie";
import List from "./layout/List";
import { ResponseException } from "./classes/Exceptions";
import RootLayout from "./layout/Root";
import Ticket from "./layout/Ticket";
import ModelForm from "./layout/ModelForm";
import History from "./layout/history";
import Settings from "./layout/Settings";
import urlBuilder from "./hooks/urlBuilder";
import { apiFetch } from "./hooks/apiFetch";
import { InlineFieldAction } from "./components/InlineFields";
import MainLayout from "./layout/Main";
import { UserProvider } from './hooks/UserContext';

const Login = () => {

Expand All @@ -29,56 +29,41 @@ const Login = () => {
<section>redirect</section>
);
}



function App() {

const [content_heading, setContentHeading] = useState(null)
const [ content_header_icon, SetContentHeaderIcon ] = useState(null)

const router = useMemo(() => {
function App() {

return createBrowserRouter(
const router = createBrowserRouter(

createRoutesFromElements(
createRoutesFromElements(
<Route element={<RootLayout />} >

<Route path="/"
element={<RootLayout
content_heading={content_heading}
content_header_icon={content_header_icon}
/>}
errorElement={<ErrorPage /> }
element={<MainLayout />}
errorElement={<ErrorPage />}
>

{/* ********************************************************
Redirects
******************************************************** */}

<Route path='/login' element={<Login/>}/>
<Route path='/login' element={<Login />}/>

{/* ********************************************************
History View
******************************************************** */}

<Route path="/core/:model/:pk/history"
element={<History
setContentHeading={setContentHeading}
SetContentHeaderIcon={SetContentHeaderIcon}
/>}
errorElement={<ErrorPage /> }
element={<History />}
/>

{/* ********************************************************
Settings View
******************************************************** */}

<Route path="/settings"
element={<Settings
setContentHeading={setContentHeading}
SetContentHeaderIcon={SetContentHeaderIcon}
/>}
errorElement={<ErrorPage /> }
element={<Settings />}
loader = {pagedLoader}
/>

Expand All @@ -89,11 +74,7 @@ function App() {
******************************************************** */}

<Route
element={<ModelForm
setContentHeading={setContentHeading}
SetContentHeaderIcon={SetContentHeaderIcon}
/>}
errorElement={<ErrorPage /> }
element={<ModelForm />}
loader = {pagedLoader}
>

Expand All @@ -115,63 +96,43 @@ function App() {
List View
******************************************************** */}

<Route
errorElement={<ErrorPage /> }
>

<Route path="ticket/:model" element={<List
setContentHeading={setContentHeading}
SetContentHeaderIcon={SetContentHeaderIcon}
/>} loader = {pagedLoader} />

<Route path=":model" element={<List
setContentHeading={setContentHeading}
SetContentHeaderIcon={SetContentHeaderIcon}
/>} loader = {pagedLoader} />
<Route path="ticket/:model" element={<List
/>} loader = {pagedLoader} />

</Route>
<Route path=":model" element={<List
/>} loader = {pagedLoader} />

{/* ********************************************************
Tickets View
******************************************************** */}

<Route path=":common_model/:common_pk/project_task/:pk" element={<Ticket
setContentHeading={setContentHeading}
SetContentHeaderIcon={SetContentHeaderIcon}
/>} loader = {pagedLoader} errorElement={<ErrorPage /> } />
/>} loader = {pagedLoader} action={InlineFieldAction} />

<Route path="ticket/:model/:pk" element={<Ticket
setContentHeading={setContentHeading}
SetContentHeaderIcon={SetContentHeaderIcon}
/>} loader = {pagedLoader} errorElement={<ErrorPage /> } />
/>} loader = {pagedLoader} action={InlineFieldAction} />

{/* ********************************************************
Detail View
******************************************************** */}

<Route path=":common_model/:common_pk/:model/:pk" element={<Detail
setContentHeading={setContentHeading}
SetContentHeaderIcon={SetContentHeaderIcon}
/>} loader = {pagedLoader} errorElement={<ErrorPage /> } />
/>} loader = {pagedLoader} />

<Route path=":model/:pk" element={<Detail
setContentHeading={setContentHeading}
SetContentHeaderIcon={SetContentHeaderIcon}
/>} loader = {pagedLoader} errorElement={<ErrorPage /> } />
<Route path=":model/:pk" element={<Detail
/>} loader = {pagedLoader} />

</Route>
</Route>
));

}, [
content_heading,
setContentHeading,
]);
</Route>
));


return (
<div className="app">
<RouterProvider router={router} />
<UserProvider>
<RouterProvider router={router} />
</UserProvider>
</div>
);
}
Expand Down
2 changes: 2 additions & 0 deletions src/components/IconLoader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ const icon_components = {
ansible: AnsibleIcon,
assistance: AssistanceIcon,
cluster: ClusterIcon,
config_group: ConfigManagementIcon,
config_management: ConfigManagementIcon,
device_status_bad: InventoryStatusBadIcon,
device_status_ok: InventoryStatusOkIcon,
Expand All @@ -78,6 +79,7 @@ const icon_components = {
help: HelpIcon,
history: HistoryIcon,
information: InformationIcon,
kb: InformationIcon,
itam: ItamIcon,
itim: ITIMIcon,
link: LinkIcon,
Expand Down
Loading

0 comments on commit ebe36f7

Please sign in to comment.