Skip to content

Commit

Permalink
Using NextJS 15 (Canary)
Browse files Browse the repository at this point in the history
  • Loading branch information
oxisto committed Dec 23, 2024
1 parent 1a16e50 commit 1cce6ba
Show file tree
Hide file tree
Showing 8 changed files with 74 additions and 69 deletions.
1 change: 1 addition & 0 deletions ui/.env.development
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
AUTH_CLIENT_ID=dashboard
4 changes: 2 additions & 2 deletions ui/components/portfolio-position-row.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { components } from "@/lib/api/v1";
import { components, SchemaPortfolioPosition } from "@/lib/api/v1";
import { classNames, shorten } from "@/lib/util";
import {
ArrowDownIcon,
Expand All @@ -9,7 +9,7 @@ import FormattedCurrency from "./formatted-currency";
import FormattedPercentage from "./formatted-percentage";

interface PortfolioPositionRowProps {
position: components["schemas"]["PortfolioPosition"];
position: SchemaPortfolioPosition;
}

export default function PortfolioPositionRow({
Expand Down
4 changes: 2 additions & 2 deletions ui/lib/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { decode } from "next-auth/jwt";
import { cookies } from "next/headers";
import createClient, { Middleware } from "openapi-fetch";
import type { paths } from "./v1";
export * from "./types";
export * from "./v1";

const authMiddleware: Middleware = {
async onRequest({ request }) {
Expand All @@ -13,7 +13,7 @@ const authMiddleware: Middleware = {
: "authjs.session-token";
// Retrieve our frontend auth cookie that contains the encrypted frontend
// token
const cookie = cookies().get(cookieName);
const cookie = (await cookies()).get(cookieName);

// Decode/decrypt the token to access the backend API token
const token = await decode({
Expand Down
8 changes: 0 additions & 8 deletions ui/lib/api/types.ts

This file was deleted.

12 changes: 12 additions & 0 deletions ui/lib/api/v1.d.ts → ui/lib/api/v1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,18 @@ export interface components {
headers: never;
pathItems: never;
}
export type SchemaCurrency = components['schemas']['Currency'];
export type SchemaGoogleProtobufAny = components['schemas']['GoogleProtobufAny'];
export type SchemaListPortfolioTransactionsResponse = components['schemas']['ListPortfolioTransactionsResponse'];
export type SchemaListPortfoliosResponse = components['schemas']['ListPortfoliosResponse'];
export type SchemaListSecuritiesResponse = components['schemas']['ListSecuritiesResponse'];
export type SchemaListedSecurity = components['schemas']['ListedSecurity'];
export type SchemaPortfolio = components['schemas']['Portfolio'];
export type SchemaPortfolioEvent = components['schemas']['PortfolioEvent'];
export type SchemaPortfolioPosition = components['schemas']['PortfolioPosition'];
export type SchemaPortfolioSnapshot = components['schemas']['PortfolioSnapshot'];
export type SchemaSecurity = components['schemas']['Security'];
export type SchemaStatus = components['schemas']['Status'];
export type $defs = Record<string, never>;
export interface operations {
PortfolioService_ListPortfolios: {
Expand Down
4 changes: 2 additions & 2 deletions ui/lib/currency.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Currency } from "@/lib/api";
import { SchemaCurrency } from "@/lib/api";

/**
* This function returns a currency value to a decimal. Internally,
Expand All @@ -10,7 +10,7 @@ import { Currency } from "@/lib/api";
* @param currency the currency to convert
* @returns a decimal representation
*/
export function toDecimal(currency?: Currency): number {
export function toDecimal(currency?: SchemaCurrency): number {
if (
currency == undefined ||
currency.value == undefined ||
Expand Down
104 changes: 52 additions & 52 deletions ui/package-lock.json

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

6 changes: 3 additions & 3 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@
"build": "next build",
"start": "next start",
"lint": "next lint",
"generate:types": "openapi-typescript ../openapi.yaml -o lib/api/v1.d.ts",
"generate:types": "openapi-typescript ../openapi.yaml -o lib/api/v1.ts --root-types",
"predev": "npm run generate:types",
"prebuild": "npm run generate:types"
},
"dependencies": {
"next": "^15.0.0-rc.0",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"@headlessui/react": "^2.1.2",
Expand All @@ -21,6 +20,7 @@
"dayjs": "^1.11.12",
"inter-ui": "^4.0.2",
"negotiator": "^0.6.3",
"next": "^15.1.1-canary.17",
"next-auth": "^5.0.0-beta.20",
"next-intl": "^3.17.3",
"openapi-fetch": "^0.13.0",
Expand All @@ -33,7 +33,7 @@
"eslint": "^9.0.0",
"eslint-config-next": "14.2.17",
"eslint-config-prettier": "^9.1.0",
"openapi-typescript": "^7.3.0",
"openapi-typescript": "^7.4.0",
"postcss": "^8",
"prettier": "^3.3.3",
"prettier-plugin-classnames": "^0.7.2",
Expand Down

0 comments on commit 1cce6ba

Please sign in to comment.