Skip to content

Commit

Permalink
Deploy version 0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
cp-dharti-r committed Mar 26, 2024
1 parent 1f30c39 commit 98b44cf
Show file tree
Hide file tree
Showing 200 changed files with 15,667 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Run build for admin panel and website

on:
push:

jobs:
admin-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: "20.x"

- name: Set up environment and build for admin
env:
NEXT_PUBLIC_ADMIN_BASE_URL: ${{ secrets.ADMIN_BASE_URL }}
NEXT_PUBLIC_SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
NEXT_PUBLIC_SUPABASE_ANON_KEY: ${{ secrets.SUPABASE_ANON_KEY }}
NEXT_PUBLIC_JWT_SECRET: ${{ secrets.JWT_SECRET }}
NEXT_PUBLIC_CRYPTO_SECRET: ${{ secrets.CRYPTO_SECRET }}
NEXT_PUBLIC_AWS_REGION: ${{ secrets.AWS_REGION }}
NEXT_PUBLIC_AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
NEXT_PUBLIC_AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
NEXT_PUBLIC_SUPABASE_STORAGE_URL: ${{ secrets.SUPABASE_STORAGE_URL }}
run: |
cd admin
npm install
npm run build
website-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: "20.x"

- name: Set up environment and build for website
env:
NEXT_PUBLIC_SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
NEXT_PUBLIC_SUPABASE_ANON_KEY: ${{ secrets.SUPABASE_ANON_KEY }}
run: |
cd website
npm install
npm run build
60 changes: 60 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Deploy website and admin panel

on:
push:
branches:
- main

jobs:
merge:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Fetch and reset main branch
run: |
git fetch origin main
git checkout main
git reset --hard origin/main
- name: Merge website branch to website-main
run: |
git fetch origin
git config user.name github-actions
git config user.email [email protected]
if [ "$(git diff origin/main:website origin/website-main | wc -l)" -gt "0" ]; then
echo "Detected uncommitted changes in the website folder after build. Pushing changes to website-main branch."
git checkout website-main
git rm -r *
git checkout main -- website
git mv website/* .
ls
rm -r website
git add .
git commit -m "Deploy website"
git push origin website-main
else
echo "No changes detected in the website folder after build. Exiting."
fi
- name: Merge admin branch to admin-main
run: |
git fetch origin
git config user.name github-actions
git config user.email [email protected]
if [ "$(git diff origin/main:admin origin/admin-main | wc -l)" -gt "0" ]; then
echo "Detected uncommitted changes in the admin folder after build. Pushing changes to admin-main branch."
git checkout admin-main
git rm -r *
git checkout main -- admin
git mv admin/* .
ls
rm -r admin
git add .
git commit -m "Deploy admin panel"
git push origin admin-main
else
echo "No changes detected in the admin folder after build. Exiting."
fi
3 changes: 3 additions & 0 deletions admin/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "next/core-web-vitals"
}
38 changes: 38 additions & 0 deletions admin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# 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

# 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

package-lock.json
40 changes: 40 additions & 0 deletions admin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).

## Getting Started

First, run the development server:

```bash
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

You can start editing the page by modifying `pages/index.tsx`. The page auto-updates as you edit the file.

[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.ts`.

The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.

This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.

## Learn More

To learn more about Next.js, take a look at the following resources:

- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.

You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!

## Deploy on Vercel

The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.

Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
26 changes: 26 additions & 0 deletions admin/components/Breadcrumbs/Breadcrumb.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import Link from "next/link";
interface BreadcrumbProps {
pageName: string;
}
const Breadcrumb = ({ pageName }: BreadcrumbProps) => {
return (
<div className="mb-6 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between">
<h2 className="text-title-md2 font-semibold text-black dark:text-white">
{pageName}
</h2>

<nav>
<ol className="flex items-center gap-2">
<li>
<Link className="font-medium" href="/">
Dashboard /
</Link>
</li>
<li className="font-medium text-primary">{pageName}</li>
</ol>
</nav>
</div>
);
};

export default Breadcrumb;
89 changes: 89 additions & 0 deletions admin/components/CardDataStats.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
import React, { ReactNode } from "react";

interface CardDataStatsProps {
title: string;
total: number;
rate: string;
levelUp?: boolean;
levelDown?: boolean;
quote: string;
children: ReactNode;
isLoading: boolean;
}

const CardDataStats: React.FC<CardDataStatsProps> = ({
title,
total,
rate,
levelUp,
levelDown,
quote,
children,
isLoading,
}) => {
return (
<div className="rounded-sm border border-stroke bg-white px-7.5 py-6 shadow-default dark:border-strokedark dark:bg-boxdark flex flex-col gap-3">
<div className="flex justify-between">
<div className="flex h-14 w-14 items-center justify-center rounded-full bg-meta-2 dark:bg-meta-4">
{children}
</div>
<div>
{isLoading ? (
<div className="flex items-center justify-center">
<div className="h-8 w-8 animate-spin rounded-full border-2 border-solid border-primary border-t-transparent"></div>
</div>
) : (
<h4 className="text-title-md text-right font-bold text-black dark:text-white">
{total}
</h4>
)}
<span className="text-sm font-medium">{title}</span>
</div>
</div>

<div className="mt-4 text-right">
{/* <span
className={`flex items-center gap-1 text-sm font-medium ${
levelUp && "text-meta-3"
} ${levelDown && "text-meta-5"} `}
>
{rate}
{levelUp && (
<svg
className="fill-meta-3"
width="10"
height="11"
viewBox="0 0 10 11"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M4.35716 2.47737L0.908974 5.82987L5.0443e-07 4.94612L5 0.0848689L10 4.94612L9.09103 5.82987L5.64284 2.47737L5.64284 10.0849L4.35716 10.0849L4.35716 2.47737Z"
fill=""
/>
</svg>
)}
{levelDown && (
<svg
className="fill-meta-5"
width="10"
height="11"
viewBox="0 0 10 11"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M5.64284 7.69237L9.09102 4.33987L10 5.22362L5 10.0849L-8.98488e-07 5.22362L0.908973 4.33987L4.35716 7.69237L4.35716 0.0848701L5.64284 0.0848704L5.64284 7.69237Z"
fill=""
/>
</svg>
)}
</span> */}
</div>
<div className="text-green-700 text-sm">{quote}</div>
</div>
);
};

export default CardDataStats;
Loading

0 comments on commit 98b44cf

Please sign in to comment.