Skip to content

Commit

Permalink
Merge pull request #4 from ducheharsh/harsh/backend
Browse files Browse the repository at this point in the history
dockerizing user-app
  • Loading branch information
ducheharsh authored Aug 1, 2024
2 parents b5abc80 + 1d8657f commit d76958e
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 73 deletions.
17 changes: 0 additions & 17 deletions apps/merchant-app/app/api/user/route.ts

This file was deleted.

17 changes: 7 additions & 10 deletions apps/user-app/components/HomeChart.tsx
Original file line number Diff line number Diff line change
@@ -1,37 +1,35 @@
"use client"
"use client";

import { TrendingUp } from "lucide-react"
import { CartesianGrid, Line, LineChart, XAxis } from "recharts"
import { CartesianGrid, Line, LineChart, XAxis } from "recharts";

import {
Card,
CardContent,
CardDescription,
CardFooter,
CardHeader,
CardTitle,
} from "./ui/card"
} from "./ui/card";
import {
ChartConfig,
ChartContainer,
ChartTooltip,
ChartTooltipContent,
} from "./ui/chart"
} from "./ui/chart";
const chartData = [
{ month: "January", expenses: 186 },
{ month: "February", expenses: 305 },
{ month: "March", expenses: 237 },
{ month: "April", expenses: 73 },
{ month: "May", expenses: 209 },
{ month: "June", expenses: 214 },
]
];

const chartConfig = {
expenses: {
label: "Expenses",
color: "purple",
},
} satisfies ChartConfig
} satisfies ChartConfig;

export function ChartComp() {
return (
Expand Down Expand Up @@ -72,7 +70,6 @@ export function ChartComp() {
</LineChart>
</ChartContainer>
</CardContent>

</Card>
)
);
}
6 changes: 1 addition & 5 deletions apps/user-app/components/OnRampTrans.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import { Card, CardContent, CardDescription, CardTitle, CardHeader } from "./ui/card";

enum TransactionType {
Deposit = 'Deposit',
Withdrawal = 'Withdrawal',
Transfer = 'Transfer',
}



export default function OnRampTransCard({
Expand Down
86 changes: 48 additions & 38 deletions apps/user-app/components/P2pTransfer.tsx
Original file line number Diff line number Diff line change
@@ -1,47 +1,57 @@
"use client"
"use client";

import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "./ui/card"
import { Button } from "@repo/ui/button"
import { Input } from "./ui/input"
import { Select } from "./ui/select"
import { useState } from "react"
import { CreateP2PTransaction } from "../app/lib/actions/P2pTxnsAction"
import { Card, CardContent, CardHeader, CardTitle } from "./ui/card";
import { Button } from "@repo/ui/button";
import { Input } from "./ui/input";
import { useState } from "react";
import { CreateP2PTransaction } from "../app/lib/actions/P2pTxnsAction";

export default function P2pTransfer() {
const [amount, setAmount] = useState(0)
const [peerPhn, setPeerPhn] = useState("")
return( <Card className='mt-6 w-[30vw] h-fit'>
<CardHeader>
const [amount, setAmount] = useState(0);
const [peerPhn, setPeerPhn] = useState("");
return (
<Card className="mt-6 w-[30vw] h-fit">
<CardHeader>
<CardTitle>Send amount</CardTitle>
</CardHeader>
<CardContent>

<div className='flex flex-col ' >
<h1>Phone No.</h1>
<Input type='number' onChange={(e)=>{
setPeerPhn(e.target.value)
}} placeholder='Peers phone no. ' />
<div className="mt-3">
<h1 >Amount</h1>
<Input type='number' onChange={(e)=>{
setAmount(Number(e.target.value))
}} placeholder='Enter Amount' />
</div>
<CardContent>
<div className="flex flex-col ">
<h1>Phone No.</h1>
<Input
type="number"
onChange={(e) => {
setPeerPhn(e.target.value);
}}
placeholder="Peers phone no. "
/>
<div className="mt-3">
<h1>Amount</h1>
<Input
type="number"
onChange={(e) => {
setAmount(Number(e.target.value));
}}
placeholder="Enter Amount"
/>
</div>
</div>

<div className='flex flex-col mt-6' >

<div className="mt-6">
<Button onClick={async()=>{
const sendMoney = await CreateP2PTransaction({amount, peerPhone:peerPhn})
alert(sendMoney?.message)
}}>
Send Money
</Button>
<div className="flex flex-col mt-6">
<div className="mt-6">
<Button
onClick={async () => {
const sendMoney = await CreateP2PTransaction({
amount,
peerPhone: peerPhn,
});
alert(sendMoney?.message);
}}
>
Send Money
</Button>
</div>
</div>
</div>

</CardContent>
</CardContent>
</Card>
)
}
);
}
18 changes: 18 additions & 0 deletions docker/Dockerfile.user
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM node:20.12.0-alpine3.19

WORKDIR /usr/src/app

COPY package.json package-lock.json turbo.json tsconfig.json ./

COPY apps ./apps
COPY packages ./packages

# Install dependencies
RUN npm install
# Can you add a script to the global package.json that does this?
RUN npm run db:generate

# Can you filter the build down to just one app?
RUN npm run build

CMD ["npm", "run", "start-user-app"]
4 changes: 3 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"dev": "turbo dev",
"lint": "turbo lint",
"format": "prettier --write \"**/*.{ts,tsx,md}\"",
"db:generate":"cd packages/db && npx prisma generate"

"db:generate": "cd packages/db && npx prisma generate",
"start-user-app": "cd ./apps/user-app && npm run start"
},
"devDependencies": {
"@repo/eslint-config": "*",
Expand Down

0 comments on commit d76958e

Please sign in to comment.