Skip to content

Commit

Permalink
Merge pull request #126 from Sahil-Connect/SAH-64
Browse files Browse the repository at this point in the history
[SAH-64]: Configure GraphQL Codegen
  • Loading branch information
Emmanuel-Melon authored Jan 13, 2024
2 parents 85c6b72 + d280485 commit adea058
Show file tree
Hide file tree
Showing 273 changed files with 35,335 additions and 3,098 deletions.
24 changes: 13 additions & 11 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

title: ""
labels: ""
assignees: ""
---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
Expand All @@ -24,15 +24,17 @@ A clear and concise description of what you expected to happen.
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
7 changes: 3 additions & 4 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

title: ""
labels: ""
assignees: ""
---

**Is your feature request related to a problem? Please describe.**
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ jobs:
#- name: Linting
# run: yarn lint

# - name: Codegen
# run: yarn codegen

- name: Build
run: yarn build --filter=website

Expand Down
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

yarn format
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ Design an algorithm that matches businesses with suitable suppliers based on the

### Delivery Process


## DevOps

### Run the apps locally with Docker
Expand All @@ -29,4 +28,4 @@ docker compose build [SERVICE] eg. sahilwebsite

```
docker compose up -d sahilwebsite
```
```
2 changes: 1 addition & 1 deletion apps/admin/postcss.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const baseConfig = require('@sahil/configs/tailwind/postcss.config.js');
const baseConfig = require("@sahil/configs/tailwind/postcss.config.js");

module.exports = {
...baseConfig,
Expand Down
2 changes: 1 addition & 1 deletion apps/admin/src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default function RootLayout({
return (
<html lang="en">
<body>
<Navbar header="Admin" links={[]}/>
<Navbar header="Admin" links={[]} />
{children}
</body>
</html>
Expand Down
42 changes: 21 additions & 21 deletions apps/admin/tailwind.config.ts
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
import type { Config } from 'tailwindcss';
import type { Config } from "tailwindcss";

const baseConfig: Config = require('@sahil/configs/tailwind/tailwind.config');
const baseConfig: Config = require("@sahil/configs/tailwind/tailwind.config");

const extendedConfig: Config = {
...baseConfig,
content: [
...baseConfig.content,
'./src/Addresses/**/**.{js,ts,jsx,tsx,mdx}',
'./src/Agents/**/*.{js,ts,tsx,tsx,mdx}',
'./src/Centers/**/*.{js,ts,tsx,tsx,mdx}',
'./src/Couriers/**/*.{js,ts,tsx,tsx,mdx}',
'./src/Zones/**/*.{js,ts,tsx,tsx,mdx}',
'./src/Businesses/**/*.{js,ts,tsx,tsx,mdx}',
'./src/Suppliers/**/*.{js,ts,tsx,tsx,mdx}',
'./src/Layout/*.{js,ts,tsx,tsx,mdx}',
"./src/Addresses/**/**.{js,ts,jsx,tsx,mdx}",
"./src/Agents/**/*.{js,ts,tsx,tsx,mdx}",
"./src/Centers/**/*.{js,ts,tsx,tsx,mdx}",
"./src/Couriers/**/*.{js,ts,tsx,tsx,mdx}",
"./src/Zones/**/*.{js,ts,tsx,tsx,mdx}",
"./src/Businesses/**/*.{js,ts,tsx,tsx,mdx}",
"./src/Suppliers/**/*.{js,ts,tsx,tsx,mdx}",
"./src/Layout/*.{js,ts,tsx,tsx,mdx}",
],
theme: {
...baseConfig.theme,
extend: {
...baseConfig.theme?.extend,
},
},
plugins: [...baseConfig.plugins, require('daisyui')],
plugins: [...baseConfig.plugins, require("daisyui")],
daisyui: {
themes: [
{
lemonade: {
...require('daisyui/src/theming/themes')['[data-theme=lemonade]'],
primary: '#067a46',
secondary: '#056835',
accent: '#40efcf',
neutral: '#2d2f39',
'base-100': '#ffffff',
info: '#76d1e5',
success: '#22a05b',
warning: '#f0bc2d',
error: '#e33631',
...require("daisyui/src/theming/themes")["[data-theme=lemonade]"],
primary: "#067a46",
secondary: "#056835",
accent: "#40efcf",
neutral: "#2d2f39",
"base-100": "#ffffff",
info: "#76d1e5",
success: "#22a05b",
warning: "#f0bc2d",
error: "#e33631",
},
},
],
Expand Down
2 changes: 1 addition & 1 deletion apps/agent/README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# Agent Dashboard
# Agent Dashboard
3 changes: 2 additions & 1 deletion apps/agent/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
"lint": "next lint",
"prepare": "husky install"
},
"dependencies": {
"@apollo/client": "^3.8.1",
Expand Down
5 changes: 2 additions & 3 deletions apps/agent/src/Businesses/AddNewBusiness.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,13 @@ export const InsertNewBusiness = () => {
} = useForm<Inputs>();
const { insertClient, loading, error } = useRegisterBusiness();
const onSubmit: SubmitHandler<Inputs> = (data) => {

const validtedInput = businessSchema.parse(data);

insertClient({
variables: {
object: {
name: data.businessName,
...data
...data,
},
},
});
Expand Down
58 changes: 29 additions & 29 deletions apps/agent/src/Businesses/BusinessOrderHistory.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
import Link from 'next/link';
import { useFetchBusinessOrders } from '@/hooks/businesses';
import { useRouter } from 'next/router';
import { formatDateTime } from '@sahil/lib/dates';
import { Card, JoinGrid, List, ListHeader, ListErrorState } from 'ui';
import Link from "next/link";
import { useFetchBusinessOrders } from "@/hooks/businesses";
import { useRouter } from "next/router";
import { formatDateTime } from "@sahil/lib/dates";
import { Card, JoinGrid, List, ListHeader, ListErrorState } from "ui";
import {
HiOutlineCalendarDays,
HiOutlineMapPin,
HiOutlineFlag,
} from 'react-icons/hi2';
import { useState } from 'react';
} from "react-icons/hi2";
import { useState } from "react";

enum OrderStatus {
Cancelled = 'Cancelled',
Pending = 'Pending',
Fulfilled = 'Fulfilled',
Cancelled = "Cancelled",
Pending = "Pending",
Fulfilled = "Fulfilled",
}

const orderStyles: Record<OrderStatus, string> = {
[OrderStatus.Cancelled]: 'error',
[OrderStatus.Pending]: 'info',
[OrderStatus.Fulfilled]: 'success',
[OrderStatus.Cancelled]: "error",
[OrderStatus.Pending]: "info",
[OrderStatus.Fulfilled]: "success",
};

export const BusinessOrderHistory = () => {
Expand All @@ -35,18 +35,18 @@ export const BusinessOrderHistory = () => {
if (error) {
return (
<ListErrorState
heading='Unable to load products...'
heading="Unable to load products..."
message="Products aren't loading due to a technical problem on our side. Please
try again."
/>
);
}

return (
<div className='bg-gray-100 space-y-2 grow p-4 rounded-xl'>
<div className='flex justify-between items-center'>
<h3 className='text-xl'>Latest Orders</h3>
<button className='btn btn-sm'>View All</button>
<div className="bg-gray-100 space-y-2 grow p-4 rounded-xl">
<div className="flex justify-between items-center">
<h3 className="text-xl">Latest Orders</h3>
<button className="btn btn-sm">View All</button>
</div>
<ListHeader
onNextPage={() => setOffset((prev) => prev + 4)}
Expand All @@ -55,7 +55,7 @@ export const BusinessOrderHistory = () => {
isPrevDisabled={offset === 0}
size={ordersCount?.count}
limit={3}
sizeLabel='Orders'
sizeLabel="Orders"
/>
<List
data={orders}
Expand All @@ -68,35 +68,35 @@ export const BusinessOrderHistory = () => {
};

const OrderSummary = ({ order }) => {
const statusStyle = orderStyles[order.status] || 'default';
const statusStyle = orderStyles[order.status] || "default";
return (
<Card className='bg-white h-full'>
<Card className="bg-white h-full">
<div>
<Link href={`/orders/${order.id}`}>
<h3 className='card-title'>
<h3 className="card-title">
Order ID: #{order.id.slice(0, 8).toLocaleUpperCase()}
</h3>
</Link>
<div className='flex flex-wrap gap-2 gap-y-4'>
<div className="flex flex-wrap gap-2 gap-y-4">
<div className={`badge badge-sm badge-${statusStyle}`}>
{order.status}
</div>
</div>
</div>
<div className='flex items-center gap-2'>
<span className='shadow rounded-md p-2'>
<div className="flex items-center gap-2">
<span className="shadow rounded-md p-2">
<HiOutlineCalendarDays />
</span>
<p>{formatDateTime(order?.created_at)}</p>
</div>
<div className='flex items-center gap-1'>
<span className='shadow rounded-md p-2'>
<div className="flex items-center gap-1">
<span className="shadow rounded-md p-2">
<HiOutlineMapPin />
</span>
<p>{order.origin}</p>
</div>
<div className='flex items-center gap-1'>
<span className='shadow rounded-md p-2'>
<div className="flex items-center gap-1">
<span className="shadow rounded-md p-2">
<HiOutlineFlag />
</span>
<p>{order.destination}</p>
Expand Down
31 changes: 16 additions & 15 deletions apps/agent/src/Businesses/BusinessOverviewCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ import { formatDateTime } from "@sahil/lib/dates";
import { generateInitials } from "@sahil/lib/strings";
import Link from "next/link";
import { Card } from "ui";
import { HiOutlineEllipsisHorizontal, HiOutlinePhone, HiOutlineMapPin } from "react-icons/hi2";
import {
HiOutlineEllipsisHorizontal,
HiOutlinePhone,
HiOutlineMapPin,
} from "react-icons/hi2";

export type SahilBusiness = {
name: string;
Expand All @@ -12,7 +16,7 @@ export type SahilBusiness = {
type: string;
phoneNumber: string;
addresses: Array<{
street_address: string,
street_address: string;
}>;
};

Expand Down Expand Up @@ -53,24 +57,21 @@ export const BusinessOverviewCard: FC<Props> = ({ business }) => {
<p className="capitalize">{business.type}</p>
</div>
<div className="space-y-1 font-semibold">
<span className="opacity-70 text-sm font-normal">
Contact Name
</span>
<span className="opacity-70 text-sm font-normal">Contact Name</span>
<p className="capitalize">{business.contactName}</p>
</div>
</div>
</div>
<div className="mt-3">
{business.addresses && business.addresses.map((address, index) => (
<div key={index} className="flex items-center gap-2">
<span className="shadow rounded-md p-2">
<HiOutlineMapPin />
</span>
<p className="truncate ...">
{address.street_address}
</p>
</div>
))}
{business.addresses &&
business.addresses.map((address, index) => (
<div key={index} className="flex items-center gap-2">
<span className="shadow rounded-md p-2">
<HiOutlineMapPin />
</span>
<p className="truncate ...">{address.street_address}</p>
</div>
))}
</div>
<div className="mt-3">
<div className="flex items-center gap-2">
Expand Down
Loading

0 comments on commit adea058

Please sign in to comment.