Skip to content

Commit

Permalink
Merge pull request #738 from enatega/new/ahmed-admin
Browse files Browse the repository at this point in the history
New/ahmed admin
  • Loading branch information
ufumerfarooq67 authored Jan 13, 2025
2 parents f1fdd4e + 96773e8 commit f13f6cb
Show file tree
Hide file tree
Showing 910 changed files with 57,847 additions and 50,463 deletions.
3 changes: 3 additions & 0 deletions enatega-multivendor-admin/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
NEXT_PUBLIC_BASE_URL='https://enatega-multivendor.up.railway.app'
NEXT_PUBLIC_SOCKET_URL='wss://enatega-multivendor.up.railway.app'
NEXT_PUBLIC_AUTH_TOKEN='eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiI2NjkxMTc0YjQ2NzNiNTFhMzJmMTRiYmEiLCJlbWFpbCI6ImFkbWluQGdtYWlsLmNvbSIsInVzZXJUeXBlIjoiQURNSU4iLCJpYXQiOjE3MjY5MTIwMTl9.MZLg34LWhCTkkAtB03MU-lK5sVA0H9w3H1ND5ZQE7HA'
4 changes: 0 additions & 4 deletions enatega-multivendor-admin/.eslintignore

This file was deleted.

78 changes: 56 additions & 22 deletions enatega-multivendor-admin/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,61 @@
{
"env": {
"browser": true,
"es6": true
},
"extends": [
"plugin:react/recommended"
"extends": ["next", "next/core-web-vitals", "eslint:recommended"],
"globals": {
"cy": "readonly",
"it": "readonly",
"React": "readonly",
"google": "readonly",
"GeolocationPosition": "readonly",
"GeolocationPositionError": "readonly"
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2023,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true,
"tsx": true
}
},
"plugins": [
"@typescript-eslint",
"prettier",
"unused-imports" // Added plugin for unused imports
],
"rules": {
// Allow .tsx and .jsx extensions for JSX files
"react/jsx-filename-extension": [1, { "extensions": [".tsx", ".jsx"] }],

// Remove unused variables
"@typescript-eslint/no-unused-vars": [
"error",
{ "varsIgnorePattern": "^_", "argsIgnorePattern": "^_" }
],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 10,
"sourceType": "module"
},
"plugins": [
"react"

// Remove unused imports automatically
"unused-imports/no-unused-imports": "error",

// Remove unused variables but allow unused arguments prefixed with _
"unused-imports/no-unused-vars": [
"warn",
{
"vars": "all",
"varsIgnorePattern": "^_",
"args": "after-used",
"argsIgnorePattern": "^_"
}
],
"rules": {
"space-before-function-paren": ["error", "never"],
"react/prop-types": 0

// Prettier-related rules
// "prettier/prettier": ["error", {}, { "usePrettierrc": true }],

"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-explicit-any": "error",
"react-hooks/exhaustive-deps": "off"
},
"settings": {
"import/resolver": {
"typescript": {}
}
}
}
40 changes: 38 additions & 2 deletions enatega-multivendor-admin/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,39 @@
node_modules
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js
.yarn/install-state.gz

# testing
/coverage

# next.js
/.next/
/out/

# production
/build
.env

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts

*storybook.log

1 change: 1 addition & 0 deletions enatega-multivendor-admin/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
engine-strict=true
1 change: 1 addition & 0 deletions enatega-multivendor-admin/.nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v20.16.0
8 changes: 5 additions & 3 deletions enatega-multivendor-admin/.prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
src/assets/*
public/*
build/*
.next
dist
node_modules
build
coverage
8 changes: 8 additions & 0 deletions enatega-multivendor-admin/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"trailingComma": "es5",
"tabWidth": 2,
"semi": true,
"singleQuote": true,
"bracketSpacing": true,
"endOfLine": "lf"
}
1 change: 0 additions & 1 deletion enatega-multivendor-admin/.prettierrc.js

This file was deleted.

37 changes: 37 additions & 0 deletions enatega-multivendor-admin/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Changelog

## 10.1.0

- Update to PrimeReact 10.2.1

## 10.0.0

- Upgrade to Next 13.4.8
- Migrate to Next App Roter
- Migrate to PrimeReactContext
- Update to PrimeReact 9.6.2
- Update other dependencies

## 9.1.2

- Refactored project files

## 9.1.1

- Fixed hydration warnings

## 9.1.0

- Add typescript support

## 9.0.0

- Upgrade PrimeReact to v9
- Upgrade to PrimeReact 9.2.2
- Upgrade to PrimeFlex 3.3.0
- Upgrade to Next 13.2.3
- Update other dependencies

## 8.1.0

- Migrate CRA to NextJS
164 changes: 164 additions & 0 deletions enatega-multivendor-admin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
# Restaurant Delivery Management System

This project is a Restaurant Delivery Management System built with modern web technologies.

## Technologies Used

- **Next.js 14**
- **TypeScript**
- **UI Libraries**: Next UI, Chakra UI, or Prime React
- **React Icons** (if required)
- **Tailwind CSS**
- **Cypress** for:
- Component Testing
- Integration Testing
- E2E Testing

## Build Size and Performance

- **Page Size**: Must be between 150KB.
- **Critical JS and CSS**: Must be below 100KB.
- **Bundle Analysis**: Use `webpack-bundle-analyzer` as a dev dependency to analyze the bundle.
- **Dynamic Imports**: Use dynamic imports in Next.js.
- **Image Optimization**: Use the `<Image/>` tag of Next.js.

### Performance Metrics

The app must follow the standard render times as follows:

- **First Contentful Paint (FCP)**: Under 1.8 seconds
- **Largest Contentful Paint (LCP)**: Under 2.5 seconds
- **First Input Delay (FID)**: Under 100 milliseconds
- **Time to Interactive (TTI)**: Under 5 seconds
- **Total Blocking Time (TBT)**: Under 300 milliseconds
- **Cumulative Layout Shift (CLS)**: Under 0.1
- **Speed Index (SI)**: Under 4.3 seconds
- **Time to First Byte (TTFB)**: Under 600 milliseconds
- **First Meaningful Paint (FMP)**: Under 2.5 seconds

Use the browser's Lighthouse tool for performance reports.

## Folder Structure

### `app` Folder

- Contains only routes and layouts.

### `cypress` Folder

- Contains only test cases

### `lib` Folder

- **hooks Folder**: Custom hooks (e.g., `useAuth`, `useConfiguration`).
- **hoc Folder**: Higher-order components (e.g., `Route Protection HOC`, `Data Refresh HOC`).
- **services Folder**: Services for different flows, third-party API calls (e.g. `Apollo`, `Geolocation API`).
- create separate sub-folders.
- **ui Folder**: Reusable components, layouts, and screens.
- **utils Folder**:
- **methods Folder**: Utility methods (e.g. string manipulation).
- **interfaces Folder**: TypeScript interfaces (prefixed with "I").
- **constants Folder**: Common constants (strings, headers).
- **types Folder**: Custom TypeScript types, if necessary.

## Component Guidelines

- Divide complex components into sub-components (e.g., header, body, footer).
- Recommended code lines per component: `100-200 lines`.

## Changelog

- Log code changes in the `CHANGELOG.md` file.
- Only log merges/pushes to develop/staging/production branches.

---

```plaintext
├── .husky
│ └── git hooks
├── .vscode
│ └── IDE configuration
├── dist
│ └── built and minifed app.
├── .npmrc
│ └── npm configuration
├── .nvmrc
│ └── nvm configuration
├── cypress.config.ts
│ └── cypress configuration
├── app
│ └── routes
│ └── layouts
├── lib
│ ├── hooks
│ │ ├── useAuth.ts
│ │ ├── useConfiguration.ts
│ │ └── index.ts
│ ├── hoc
│ │ ├── withRouteProtection.ts
│ │ └── withDataRefresh.ts
│ │
│ ├── services
│ │ ├── support
│ │ │ ├── support.service.ts
│ │ │ └── index.ts
│ │ └── index.ts
│ ├── ui
│ │ ├── components
│ │ ├── layouts
│ │ └── screens
| ├── utils
| │ ├── methods
| | | | ├── string
| │ │ | | ├── sort.ts
| │ │ | | ├── toSentenceCase.ts
| │ │ | | ├── index.ts
| | | | ├── regex
| │ │ | | ├── email.ts
| │ │ | | ├── password.ts
| │ │ | | ├── url.ts
| │ │ | | ├── index.ts
| | | | └── index. ts
| │ ├── interfaces
| │ │ ├── common
| │ │ │ ├── IParent.ts
| │ │ │ └── index.ts
| │ │ ├── support.interface (sub-folders if required and index.ts for each)
| │ │ └── index.ts
| │ ├── constants
| │ │ ├── strings
| │ │ │ ├── global.strings.ts
| │ │ │ └── support.strings (sub-folders if required and index.ts for each)
| | | | └── index.ts (export all above)
| │ │ ├── headers
| │ │ │ ├── global.headers.ts
| │ │ │ └── support.headers (sub-folders if required and index.ts for each)
| | | | └── index.ts (export all above)
| │ │ └── index.ts
| │ ├── types (same as interfaces)
| │ │ └── index.ts
├── CHANGELOG.md
├── tsconfig.json
├── next.config.js
├── package.json
└── README.md
```

### Git

- **Commit Predefined Types**:
- build
- fix
- refactor
- revert
- style
- test
- translation
- security
- changeset
- config

### Note

- Under constant modifications.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
'use client';

// Core
import { useRouter } from 'next/navigation';
import { useEffect } from 'react';

export default function AdminPage() {
// Hooks
const router = useRouter();

// Effects
useEffect(() => {
// If userType vendor -> redirect to vendor dashboard else restaurant dashboard
router.push('/admin/store/dashboard');
}, []);

return <></>;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import CouponsScreen from '@/lib/ui/screens/admin/restaurant/general/coupons';

export default function CouponsPage() {
return <CouponsScreen />;
}
Loading

0 comments on commit f13f6cb

Please sign in to comment.