Skip to content

Commit

Permalink
Merge pull request #227 from Sahil-Connect/build-fixes
Browse files Browse the repository at this point in the history
Docker builds for client app
  • Loading branch information
Emmanuel-Melon authored Oct 23, 2024
2 parents 9926f64 + c138abb commit b1c2cd5
Show file tree
Hide file tree
Showing 44 changed files with 1,673 additions and 426 deletions.
14 changes: 14 additions & 0 deletions .vscode/easycode.ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
node_modules/
dist/
vendor/
cache/
.*/
*.min.*
*.test.*
*.spec.*
*.bundle.*
*.bundle-min.*
*.log
infra/
apps/website
apps/client
8 changes: 2 additions & 6 deletions apps/admin/next.config.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
transpilePackages: ['@sahil/lib', 'ui', '@sahil/configs', "@sahil/features"],
transpilePackages: ['@sahil/lib', 'ui', '@sahil/configs', "@sahil/features", "tsconfig", "eslint-config-custom"],
images: {
remotePatterns: [
{
protocol: 'https',
hostname: 'res.cloudinary.com',
port: '',
},
{
protocol: 'https',
hostname: 'https://lh3.googleusercontent.com',
port: '',
},
],
},
output: "standalone"
};

module.exports = nextConfig;
29 changes: 27 additions & 2 deletions apps/admin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,41 @@
"lint": "next lint"
},
"dependencies": {
"@apollo/client": "^3.8.1",
"@apollo/react-hooks": "^4.0.0",
"@formkit/auto-animate": "^0.7.0",
"@hookform/resolvers": "^3.3.0",
"@react-google-maps/api": "^2.19.2",
"@sahil/configs": "*",
"@sahil/features": "*",
"@sahil/lib": "*",
"@types/jsonwebtoken": "^9.0.5",
"apollo-link-ws": "^1.0.20",
"autoprefixer": "10.4.15",
"daisyui": "^4.12.2",
"next": "14.2.3",
"date-fns": "^2.30.0",
"eslint": "8.47.0",
"eslint-config-custom": "*",
"eslint-config-next": "^14.2.3",
"graphql": "^16.8.0",
"graphql-ws": "^5.14.0",
"jsonwebtoken": "^9.0.2",
"next": "^14.2.3",
"next-auth": "^4.24.7",
"next-auth-hasura-adapter": "^2.0.0",
"postcss": "8.4.28",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"ui": "*"
"react-hook-form": "^7.45.4",
"react-hot-toast": "^2.4.1",
"react-icons": "^4.12.0",
"subscriptions-transport-ws": "^0.11.0",
"swr": "^2.2.1",
"tailwindcss": "3.3.3",
"tsconfig": "*",
"ui": "*",
"zod": "3.21.4",
"zustand": "^4.4.1"
},
"devDependencies": {
"@types/node": "^20",
Expand Down
48 changes: 48 additions & 0 deletions apps/admin/src/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { z } from 'zod';

const envSchema = z.object({
// Server
SERVER_URL: z.string().url(),

// Hasura
HASURA_GRAPHQL_CORS_DOMAIN: z.string(),
NEXT_PUBLIC_HASURA_GRAPHQL_ENDPOINT: z.string().url(),
NEXT_PUBLIC_HASURA_GRAPHQL_ADMIN_SECRET: z.string(),
NEXT_PUBLIC_HASURA_GRAPHQL_WS: z.string().url(),

// Auth
SECRET: z.string(),
NEXTAUTH_SECRET: z.string(),
NEXT_PUBLIC_NEXTAUTH_URL: z.string().url(),

// APIs
NEXT_PUBLIC_GITHUB_SECRET: z.string(),
NEXT_PUBLIC_GITHUB_ID: z.string(),
NEXT_PUBLIC_GOOGLE_SECRET: z.string(),
NEXT_PUBLIC_GOOGLE_API_KEY: z.string().optional(),
NEXT_PUBLIC_GOOGLE_ID: z.string(),

// Database
POSTGRES_USER: z.string(),
POSTGRES_PASSWORD: z.string(),
POSTGRES_DATABASE: z.string(),

// App URLs
ADMIN_URL: z.string().url(),
AGENT_URL: z.string().url(),
CLIENT_URL: z.string().url(),
COURIER_URL: z.string().url(),
API_URL: z.string().url(),

// Email
EMAIL_SERVER_USER: z.string(),
EMAIL_SERVER_PASSWORD: z.string(),
EMAIL_SERVER_HOST: z.string(),
EMAIL_SERVER_PORT: z.string(),
EMAIL_FROM: z.string().email(),
EMAIL_SERVER: z.string(),
});

const env = envSchema.parse(process.env);

export default env;
11 changes: 11 additions & 0 deletions apps/admin/types.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// https://github.com/nextauthjs/next-auth/discussions/536#discussioncomment-1932922
import NextAuth, { DefaultSession } from "next-auth";

declare module "next-auth" {
interface Session {
user: {
id: string;
address: string;
} & DefaultSession["user"];
}
}
4 changes: 2 additions & 2 deletions apps/agent/src/Layout/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ export default function Layout({ children, ...props }: LayoutProps) {
};
return (
<>
{session?.user && (
<Navbar
{session?.user && (
<Navbar
links={links}
logo={logo}
header="Agent"
Expand Down
48 changes: 48 additions & 0 deletions apps/agent/src/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { z } from 'zod';

const envSchema = z.object({
// Server
SERVER_URL: z.string().url(),

// Hasura
HASURA_GRAPHQL_CORS_DOMAIN: z.string(),
NEXT_PUBLIC_HASURA_GRAPHQL_ENDPOINT: z.string().url(),
NEXT_PUBLIC_HASURA_GRAPHQL_ADMIN_SECRET: z.string(),
NEXT_PUBLIC_HASURA_GRAPHQL_WS: z.string().url(),

// Auth
SECRET: z.string(),
NEXTAUTH_SECRET: z.string(),
NEXT_PUBLIC_NEXTAUTH_URL: z.string().url(),

// APIs
NEXT_PUBLIC_GITHUB_SECRET: z.string(),
NEXT_PUBLIC_GITHUB_ID: z.string(),
NEXT_PUBLIC_GOOGLE_SECRET: z.string(),
NEXT_PUBLIC_GOOGLE_API_KEY: z.string().optional(),
NEXT_PUBLIC_GOOGLE_ID: z.string(),

// Database
POSTGRES_USER: z.string(),
POSTGRES_PASSWORD: z.string(),
POSTGRES_DATABASE: z.string(),

// App URLs
ADMIN_URL: z.string().url(),
AGENT_URL: z.string().url(),
CLIENT_URL: z.string().url(),
COURIER_URL: z.string().url(),
API_URL: z.string().url(),

// Email
EMAIL_SERVER_USER: z.string(),
EMAIL_SERVER_PASSWORD: z.string(),
EMAIL_SERVER_HOST: z.string(),
EMAIL_SERVER_PORT: z.string(),
EMAIL_FROM: z.string().email(),
EMAIL_SERVER: z.string(),
});

const env = envSchema.parse(process.env);

export default env;
2 changes: 1 addition & 1 deletion apps/agent/src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default function App({
<SessionProvider session={session}>
<ApolloProvider client={client}>
<div
className={`${inter.variable} ${jakarta.variable} font-inter antialiased text-zinc-900 min-h-full leading-normal`}
className={`${inter.variable} ${jakarta.variable} font-inter antialiased text-gray-600 min-h-full leading-normal`}
>
<Layout>
<Component {...pageProps} />
Expand Down
6 changes: 3 additions & 3 deletions apps/agent/src/pages/couriers/[courierId].tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { CourierProfileOverview } from "@sahil/features/Couriers/components/CourierProfileOverview";
import { Couriers } from "@sahil/lib/graphql/__generated__/graphql";

import { useRouter } from "next/router";
import { useFetchCourierByPK } from "@sahil/lib/hooks/couriers";
Expand All @@ -23,11 +24,11 @@ export default function CourierPage() {
return <p>Loading...</p>;
}


return (
<>
<section className="flex">
<div className="basis-1/4">
<CourierProfileOverview courier={courier} />
<CourierProfileOverview courier={courier as Couriers} />
</div>
<div className="divider divider-horizontal"></div>
<div className="space-y-4 grow">
Expand All @@ -37,6 +38,5 @@ export default function CourierPage() {
<ZoneInformation />
</div>
</section>
</>
);
}
4 changes: 2 additions & 2 deletions apps/agent/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import NextAuth, { DefaultSession } from "next-auth";
declare module "next-auth" {
interface Session {
user: {
id: string;
address: string;
id?: string;
address?: string;
} & DefaultSession["user"];
}
}
1 change: 1 addition & 0 deletions apps/client/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const nextConfig = {
},
],
},
output: "standalone"
};

module.exports = nextConfig;
26 changes: 25 additions & 1 deletion apps/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,41 @@
"start": "next start"
},
"dependencies": {
"@apollo/client": "^3.8.1",
"@apollo/react-hooks": "^4.0.0",
"@formkit/auto-animate": "^0.7.0",
"@hookform/resolvers": "^3.3.0",
"@react-google-maps/api": "^2.19.2",
"@sahil/configs": "*",
"@sahil/features": "*",
"@sahil/lib": "*",
"@types/jsonwebtoken": "^9.0.5",
"apollo-link-ws": "^1.0.20",
"autoprefixer": "10.4.15",
"daisyui": "^4.12.2",
"date-fns": "^2.30.0",
"eslint": "8.47.0",
"eslint-config-custom": "*",
"eslint-config-next": "^14.2.3",
"graphql": "^16.8.0",
"graphql-ws": "^5.14.0",
"jsonwebtoken": "^9.0.2",
"next": "^14.2.3",
"next-auth": "^4.24.7",
"next-auth-hasura-adapter": "^2.0.0",
"postcss": "8.4.28",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"ui": "*"
"react-hook-form": "^7.45.4",
"react-hot-toast": "^2.4.1",
"react-icons": "^4.12.0",
"subscriptions-transport-ws": "^0.11.0",
"swr": "^2.2.1",
"tailwindcss": "3.3.3",
"tsconfig": "*",
"ui": "*",
"zod": "3.21.4",
"zustand": "^4.4.1"
},
"devDependencies": {
"@types/node": "^20",
Expand Down
48 changes: 48 additions & 0 deletions apps/client/src/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { z } from 'zod';

const envSchema = z.object({
// Server
SERVER_URL: z.string().url(),

// Hasura
HASURA_GRAPHQL_CORS_DOMAIN: z.string(),
NEXT_PUBLIC_HASURA_GRAPHQL_ENDPOINT: z.string().url(),
NEXT_PUBLIC_HASURA_GRAPHQL_ADMIN_SECRET: z.string(),
NEXT_PUBLIC_HASURA_GRAPHQL_WS: z.string().url(),

// Auth
SECRET: z.string(),
NEXTAUTH_SECRET: z.string(),
NEXT_PUBLIC_NEXTAUTH_URL: z.string().url(),

// APIs
NEXT_PUBLIC_GITHUB_SECRET: z.string(),
NEXT_PUBLIC_GITHUB_ID: z.string(),
NEXT_PUBLIC_GOOGLE_SECRET: z.string(),
NEXT_PUBLIC_GOOGLE_API_KEY: z.string().optional(),
NEXT_PUBLIC_GOOGLE_ID: z.string(),

// Database
POSTGRES_USER: z.string(),
POSTGRES_PASSWORD: z.string(),
POSTGRES_DATABASE: z.string(),

// App URLs
ADMIN_URL: z.string().url(),
AGENT_URL: z.string().url(),
CLIENT_URL: z.string().url(),
COURIER_URL: z.string().url(),
API_URL: z.string().url(),

// Email
EMAIL_SERVER_USER: z.string(),
EMAIL_SERVER_PASSWORD: z.string(),
EMAIL_SERVER_HOST: z.string(),
EMAIL_SERVER_PORT: z.string(),
EMAIL_FROM: z.string().email(),
EMAIL_SERVER: z.string(),
});

const env = envSchema.parse(process.env);

export default env;
4 changes: 2 additions & 2 deletions apps/client/src/pages/account/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {
BusinessProfileOverview,
BusinessOrderHistory,
} from "@sahil/features/Businesses";
} from "@sahil/features/businesses";
// import { useGetAccountBalance, useGetMomoAccountInfo } from "@/hooks/accounts";
import { useFetchBusinessByPK } from "@/hooks/businesses";
import { useFetchBusinessByPK } from "@sahil/lib/hooks/businesses";
import { Card, JoinGrid } from "ui";
import { useState } from "react";
import {
Expand Down
Loading

0 comments on commit b1c2cd5

Please sign in to comment.