Skip to content

Commit

Permalink
Merge pull request #3 from mnsrulz/main
Browse files Browse the repository at this point in the history
sync: main to stage
  • Loading branch information
mnsrulz authored Apr 14, 2024
2 parents 19f2125 + 9c291eb commit e59d29d
Show file tree
Hide file tree
Showing 19 changed files with 445 additions and 280 deletions.
155 changes: 72 additions & 83 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"lodash.debounce": "^4.0.8",
"match-sorter": "^6.3.4",
"next": "14.1.4",
"next-auth": "^4.24.7",
"next-auth": "^5.0.0-beta.16",
"react": "^18",
"react-dom": "^18",
"react-hook-form": "^7.51.2",
Expand Down
32 changes: 9 additions & 23 deletions src/app/api/auth/[...nextauth]/route.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,13 @@
import NextAuth, { NextAuthOptions } from 'next-auth'
import NextAuth from 'next-auth'
import { authOptions, NA } from '@/lib/auth';

import CredentialsProvider from 'next-auth/providers/credentials'
import { authenticate } from '@/lib/auth'
const { GET, POST } = NextAuth(authOptions).handlers;
export { GET, POST }

const authOptions: NextAuthOptions = {
providers: [
CredentialsProvider({
name: 'credentials',
credentials: {
username: { label: "Username", type: "text", placeholder: "admin" },
password: { label: "Password", type: "password" }
},
async authorize(creds, req) {
if (authenticate(creds?.username, creds?.password)) {
const user = { id: "1", name: "admin", email: "[email protected]" }
return user
}
return null
}
})
]
}
// export const {
// handlers: { GET, POST },
// auth,
// } = NA;

const handler = NextAuth(authOptions);

export { handler as GET, handler as POST }
// export { handler as GET, handler as POST }
13 changes: 13 additions & 0 deletions src/app/api/symbols/search/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { NextRequest, NextResponse } from "next/server";
import yf from 'yahoo-finance2';

export async function GET(request: NextRequest, p: { params: { symbol: string } }) {
const q = request.nextUrl.searchParams.get('q');
if (!q) return NextResponse.json({ 'error': 'q parameter is not provided in the request.' }, {
status: 400
});
const resp = await yf.search(q);
return NextResponse.json({
items: resp
});
}
2 changes: 2 additions & 0 deletions src/app/api/trades/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { NextRequest, NextResponse } from "next/server";
// export const runtime = 'edge'; //This specifies the runtime environment that the middleware function will be executed in.

export async function GET(request: NextRequest, p: { params: { symbol: string } }) {
console.log(`in get`);

const resp = await prisma.trade.findMany();
return NextResponse.json({
items: resp
Expand Down
2 changes: 0 additions & 2 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import { Inter } from "next/font/google";
import "./globals.css";
import TabsRouter from "./routes";
import { CssBaseline } from "@mui/material";
import { LocalizationProvider } from "@mui/x-date-pickers";
import { AdapterDayjs } from "@mui/x-date-pickers/AdapterDayjs";

const inter = Inter({ subsets: ["latin"] });

Expand Down
5 changes: 5 additions & 0 deletions src/app/login/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export default function Page() {
return <div>
This is the login page!!!
</div>
}
4 changes: 2 additions & 2 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use client';
import { Autocomplete, Button, ButtonGroup, Grid, TextField } from '@mui/material';
import { Grid } from '@mui/material';
import * as React from 'react';
import { TickerSearch } from '../components/ticker-search';
import { AddTickerToMyList, SearchTickerItem, useMyStockList } from '@/lib/socket';
import { useMyStockList } from '@/lib/socket';
import { MyStockList } from '@/components/mystocks';

export default function Page() {
Expand Down
9 changes: 9 additions & 0 deletions src/components/TickerName.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
'use client';
import { ITradeView } from "@/lib/types";
import { shortDateFormatter } from "./trades";


export const TickerName = (p: { trade: ITradeView; }) => {
const { trade } = p;
return <div>{trade.symbol} {trade.strikePrice as unknown as string} {shortDateFormatter(trade.contractExpiry as unknown as string)} x {trade.numberOfContracts}</div>;
};
Loading

0 comments on commit e59d29d

Please sign in to comment.