-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
450 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { NavLink, Outlet } from '@remix-run/react' | ||
|
||
const salesRoutes = [ | ||
{ | ||
title: 'Overview', | ||
href: '', | ||
end: true, | ||
}, | ||
{ | ||
title: 'Invoices', | ||
href: 'invoices', | ||
}, | ||
{ | ||
title: 'Customers', | ||
href: 'customers', | ||
}, | ||
{ | ||
title: 'Quotes', | ||
href: 'quotes', | ||
}, | ||
{ | ||
title: 'Payments', | ||
href: 'payments', | ||
}, | ||
] | ||
|
||
export default function AccountsLayout() { | ||
return ( | ||
<> | ||
<h1 className="text-h3 md:text-h2">Accounts</h1> | ||
|
||
<nav className="grid max-w-lg grid-flow-col gap-6 overflow-y-auto py-2 [scrollbar-width:none]"> | ||
{salesRoutes.map(route => ( | ||
<NavLink | ||
key={route.title} | ||
className={({ isActive }) => | ||
`font-semibold hover:underline ${isActive ? 'underline' : 'text-foreground/50'}` | ||
} | ||
to={route.href} | ||
end={route.end} | ||
> | ||
{route.title} | ||
</NavLink> | ||
))} | ||
</nav> | ||
|
||
<hr /> | ||
|
||
<section className="space-y-6"> | ||
<Outlet /> | ||
</section> | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,42 @@ | ||
import { invariantResponse } from '@epic-web/invariant' | ||
import { type LoaderFunctionArgs, json } from '@remix-run/node' | ||
import { useLoaderData } from '@remix-run/react' | ||
import { requireUserId } from '#app/utils/auth.server' | ||
import { PLATFORM_STATUS } from '#app/utils/constants/platform-status' | ||
import { prisma } from '#app/utils/db.server' | ||
|
||
export async function loader({ request, params }: LoaderFunctionArgs) { | ||
const userId = await requireUserId(request) | ||
|
||
const company = await prisma.company.findUnique({ | ||
where: { | ||
id: params.companyId, | ||
users: { | ||
some: { | ||
userId: userId, | ||
}, | ||
}, | ||
platformStatusKey: PLATFORM_STATUS.ACTIVE.KEY, | ||
}, | ||
select: { | ||
name: true, | ||
}, | ||
}) | ||
|
||
invariantResponse(company, 'Not found', { status: 404 }) | ||
|
||
return json({ company }) | ||
} | ||
|
||
export default function CompanyIndex() { | ||
const data = useLoaderData<typeof loader>() | ||
|
||
// Get company daily/monthly metrics | ||
// Get company basic stats | ||
|
||
return ( | ||
<div className="bg-red-400"> | ||
<h1>Company Route</h1> | ||
<div> | ||
<h1 className="text-h3 md:text-h2">{data.company.name}</h1> | ||
</div> | ||
) | ||
} |
Oops, something went wrong.