Skip to content

Commit

Permalink
Start adding case routes (#125)
Browse files Browse the repository at this point in the history
Co-authored-by: plocket <[email protected]>
Co-authored-by: Jeff Korenstein <[email protected]>
Co-authored-by: Tai Phuong <[email protected]>
Co-authored-by: Michael Hughes <[email protected]>
Co-authored-by: Justin Song <[email protected]>
  • Loading branch information
6 people authored Dec 26, 2023
1 parent 1571ddd commit 25e70ee
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 3 deletions.
18 changes: 15 additions & 3 deletions heat-stack/app/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
json,
type LinksFunction,
} from '@remix-run/node'
import { Links, Scripts } from '@remix-run/react'
import { Links, Scripts, Outlet } from '@remix-run/react'
import { CaseSummary } from './components/CaseSummary.tsx'
import { href as iconsHref } from './components/ui/icon.tsx'
import fontStyleSheetUrl from './styles/font.css'
Expand Down Expand Up @@ -125,8 +125,11 @@ export const headers: HeadersFunction = ({ loaderHeaders, parentHeaders }) => {
}
}

export default function HeatStack({ env = {} }) {
const nonce = useNonce()
export default function HeatStack({ children, env = {}, nonce }: {
children: React.ReactNode
nonce: string
env?: Record<string, string>
}) {
return (
<html lang="en" className={`${'light'} h-full overflow-x-hidden`}>
<head>
Expand All @@ -135,7 +138,14 @@ export default function HeatStack({ env = {} }) {
<Links />
</head>
<body className="bg-background text-foreground">

<h1>Title</h1>

<Outlet />
<CaseSummary />

<div>Footer</div>

<script
nonce={nonce}
dangerouslySetInnerHTML={{
Expand All @@ -147,3 +157,5 @@ export default function HeatStack({ env = {} }) {
</html>
)
}

// <CaseSummary />
35 changes: 35 additions & 0 deletions heat-stack/app/routes/cases+/$analysisid.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { json, type DataFunctionArgs } from '@remix-run/node'
import { Outlet, useLoaderData } from '@remix-run/react'
import { Fragment } from 'react'

export async function loader({ params }: DataFunctionArgs) {
// // From the database:
// const user = await prisma.user.findFirst({
// select: {
// id: true,
// name: true,
// username: true,
// createdAt: true,
// image: { select: { id: true } },
// },
// where: {
// username: params.username,
// },
// })

return json({
id: params.analysisid
})
}

export default function Analysis () {
const data = useLoaderData<typeof loader>()
const id = data?.id

return (
<Fragment>
<h1>{ id }</h1>
{/* <Outlet /> */}
</Fragment>
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Outlet } from '@remix-run/react'

export default function Cases() {
return(
<div className="w-100p h-100p bk-primary">
<h1>Case name</h1>
<Outlet/>
</div>
)
}
11 changes: 11 additions & 0 deletions heat-stack/app/routes/cases+/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export default function Cases() {
return(
<div className="w-96 bg-slate-400 ">
<h1>Cases</h1>
<ul>
<li>Case 1</li>
<li>Case 2</li>
</ul>
</div>
)
}

0 comments on commit 25e70ee

Please sign in to comment.