Skip to content

Commit

Permalink
Merge branch 'develop' into SAH-45
Browse files Browse the repository at this point in the history
  • Loading branch information
Emmanuel-Melon authored Nov 19, 2024
2 parents 2ba1895 + b1c2cd5 commit d0c6122
Show file tree
Hide file tree
Showing 95 changed files with 2,769 additions and 1,008 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
4 changes: 1 addition & 3 deletions apps/admin/src/Layout/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,7 @@ export default function Layout({ children, ...props }: LayoutProps) {
user={session?.user}
/>
)}
<main className={session?.user ? 'p-4' : 'p-0'}>
{children}
</main>
<main className={session?.user ? "p-4" : "p-0"}>{children}</main>
</>
);
}
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"];
}
}
19 changes: 12 additions & 7 deletions apps/agent/src/Dashboard/AgentToolBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,27 @@ export const AgentToolBar = () => {
<div className="flex items-center gap-2">
<Avatar alt="Hello" src={user?.image} />
<div>
<h1 className="text-lg md:text-xl font-semibold">Hey, {user?.name?.split(' ')[0]}</h1>
<p className="text-xs md:text-sm text-gray-600">{formatCurrentDate()}</p>
<h1 className="text-lg md:text-xl font-semibold">
Hey, {user?.name?.split(" ")[0]}
</h1>
<p className="text-xs md:text-sm text-gray-600">
{formatCurrentDate()}
</p>
</div>
</div>
<div className="flex gap-2">
<div className="dropdown dropdown-end">
<label tabIndex={0} className="btn btn-sm btn-primary capitalize rounded-md">
<span className="hidden md:block">
Register
</span> <HiChevronDown />
<label
tabIndex={0}
className="btn btn-sm btn-primary capitalize rounded-md"
>
<span className="hidden md:block">Register</span> <HiChevronDown />
</label>
<ul
tabIndex={0}
className="menu menu-sm dropdown-content mt-3 z-10 p-2 shadow bg-base-100 rounded-box w-52 space-y-2"
>
<li className="border-b font-semibold">
<li className="border-b font-semibold">
<p className="">Quick Register:</p>
</li>
<li>
Expand Down
8 changes: 3 additions & 5 deletions apps/agent/src/Layout/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,16 @@ export default function Layout({ children, ...props }: LayoutProps) {
};
return (
<>
{session?.user && (
<Navbar
{session?.user && (
<Navbar
links={links}
logo={logo}
header="Agent"
onSignOut={onSignOut}
user={session?.user}
/>
)}
<main className={session?.user ? 'p-4' : 'p-0'}>
{children}
</main>
<main className={session?.user ? "p-4" : "p-0"}>{children}</main>
</>
);
}
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;
8 changes: 5 additions & 3 deletions apps/agent/src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import Inter from "next/font/local";
import Plus_Jakarta_Sans from "next/font/local";

const inter = Inter({
src: '../../public/fonts/Inter-VariableFont_slnt,wght.ttf',
src: "../../public/fonts/Inter-VariableFont_slnt,wght.ttf",
variable: "--font-inter",
display: "swap",
});

const jakarta = Plus_Jakarta_Sans({
src: '../../public/fonts/PlusJakartaSans-VariableFont_wght.ttf',
src: "../../public/fonts/PlusJakartaSans-VariableFont_wght.ttf",
variable: "--font-jakarta",
display: "swap",
});
Expand Down Expand Up @@ -42,7 +42,9 @@ export default function App({
return (
<SessionProvider session={session}>
<ApolloProvider client={client}>
<div className={`${inter.variable} ${jakarta.variable} font-inter antialiased text-zinc-900 min-h-full leading-normal`}>
<div
className={`${inter.variable} ${jakarta.variable} font-inter antialiased text-gray-600 min-h-full leading-normal`}
>
<Layout>
<Component {...pageProps} />
</Layout>
Expand Down
4 changes: 2 additions & 2 deletions apps/agent/src/pages/businesses/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ const actions = [
label: "Register Business",
icon: <HiPlus />,
href: "/businesses/register/basic_info",
primary: true
}
primary: true,
},
];

export default function Business() {
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>
</>
);
}
6 changes: 3 additions & 3 deletions apps/agent/src/pages/couriers/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ const actions = [
{
label: "Track Courier",
icon: <HiOutlineMap />,
href: "/couriers/track"
href: "/couriers/track",
},
{
label: "Register Courier",
icon: <HiOutlinePlus />,
href: "/couriers/register/personal_info",
primary: true
}
primary: true,
},
];

export default function CouriersPage() {
Expand Down
Loading

0 comments on commit d0c6122

Please sign in to comment.