-
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.
* Remove forwardRef wrappers as they broke typings (anyway not needed yet, just unnecessary complexity) * Re-add ref capability to Button component using the innerRef pattern * Fix types * New mockup for Transaction page * Rework transaction model
- Loading branch information
1 parent
8cab9f1
commit 5591e7e
Showing
37 changed files
with
1,536 additions
and
4,368 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,22 +1,18 @@ | ||
import { Link } from "@remix-run/react"; | ||
import type { ButtonProps } from "./button"; | ||
import { Button } from "./button"; | ||
import { forwardRef } from "react"; | ||
import type { Ref, ComponentPropsWithRef } from "react"; | ||
import type { ComponentPropsWithoutRef } from "react"; | ||
|
||
export type LinkButtonProps = { | ||
/** The link target. See the Remix `Link` component for details. */ | ||
to: ComponentPropsWithRef<typeof Link>["to"]; | ||
to: ComponentPropsWithoutRef<typeof Link>["to"]; | ||
} & Omit<ButtonProps<typeof Link>, "as" | "to">; | ||
|
||
/** | ||
* Renders a Remix `Link` component styled as a button. Any additional props are | ||
* forwarded to the `Link` component. Use the `to` prop to specify the link | ||
* target. | ||
*/ | ||
export const LinkButton = forwardRef(function LinkButton( | ||
props: LinkButtonProps, | ||
ref: Ref<HTMLButtonElement>, | ||
) { | ||
return <Button {...props} as={Link} ref={ref} />; | ||
}); | ||
export const LinkButton = function LinkButton(props: LinkButtonProps) { | ||
return <Button {...props} as={Link} />; | ||
}; |
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,18 @@ | ||
import { createId } from "@paralleldrive/cuid2"; | ||
import type { IncomeCategoryDto } from "./types"; | ||
|
||
export function buildIncomeCategoryDto( | ||
values: Partial<IncomeCategoryDto> = {}, | ||
) { | ||
return { | ||
id: createId(), | ||
name: "Salary", | ||
|
||
createdAt: new Date(2021, 3, 7).toJSON(), | ||
updatedAt: new Date(2021, 3, 7).toJSON(), | ||
|
||
userId: createId(), | ||
|
||
...values, | ||
} as IncomeCategoryDto; | ||
} |
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,22 @@ | ||
import type { IncomeCategory } from "@prisma/client"; | ||
import { prisma } from "~/common/prisma.server"; | ||
|
||
export async function getIncomeCategories(userId: IncomeCategory["userId"]) { | ||
return await prisma.incomeCategory.findMany({ | ||
where: { userId }, | ||
}); | ||
} | ||
|
||
export async function createIncomeCategory( | ||
userId: IncomeCategory["userId"], | ||
{ name }: Pick<IncomeCategory, "name">, | ||
) { | ||
name = name.trim(); | ||
|
||
return await prisma.incomeCategory.create({ | ||
data: { | ||
name, | ||
userId, | ||
}, | ||
}); | ||
} |
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,4 @@ | ||
import type { IncomeCategory } from "@prisma/client"; | ||
import type { SerializeFrom } from "@remix-run/node"; | ||
|
||
export type IncomeCategoryDto = SerializeFrom<IncomeCategory>; |
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
Oops, something went wrong.