Skip to content

Commit

Permalink
added page for maintenance
Browse files Browse the repository at this point in the history
  • Loading branch information
ElyasMehraein committed Apr 29, 2024
1 parent b8391df commit 7bf1545
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 51 deletions.
44 changes: 0 additions & 44 deletions app/old-page.js

This file was deleted.

48 changes: 41 additions & 7 deletions app/page.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,44 @@
import { Typography } from '@mui/material'
import React from 'react'
import MyIndex from '@/components/templates/index/MyIndex';
import { verifyToken } from "@/controllers/auth";
import connectToDB from '@/configs/db';
import UserModel from '@/models/User';
import { cookies } from "next/headers";
import BillModel from '@/models/Bill';

export default function page() {
return (
<Typography sx={{ p: 5, height: "100vh", display: "flex", justifyContent: "center", alignContent: "center" }} className='inMiddle'>
همون طور که میدونید تازه سایت راه اندازی شده و در مرحله تست هستیم حالا یه تعداد از باگ های سایت مشخص شده که حلش دو سه روز طول می کشه توی این مدت مجبوریم صبر کنیم😅
</Typography>
)
export default async function page() {
const token = cookies().get("token")?.value;
const tokenPayLoad = verifyToken(token);

if (!tokenPayLoad) {
return <MyIndex />
}
connectToDB()
const user = await JSON.parse(JSON.stringify(await UserModel.findOne(
{ _id: tokenPayLoad.id },
).populate("businesses")))

const bills = await JSON.parse(JSON.stringify(await BillModel.find({
to: user?._id, isAccept: false
}).populate("from")))

let distinctGuilds = []
await BillModel.find({ isAccept: true })
.then(docs => {
if (docs.length > 0) {
const guilds = docs.map(doc => doc.guild);
distinctGuilds = [...new Set(guilds)];

} else {
console.log('No guilds to show.');
}
})
.catch(err => {
console.error(err);
});
return (
<MyIndex {...{ user, bills, token, distinctGuilds }} />
)
}


10 changes: 10 additions & 0 deletions app/pageForMaintenance.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Typography } from '@mui/material'
import React from 'react'

export default function page() {
return (
<Typography sx={{ p: 5, height: "100vh", display: "flex", justifyContent: "center", alignContent: "center" }} className='inMiddle'>
همون طور که میدونید تازه سایت راه اندازی شده و در مرحله تست هستیم حالا یه تعداد از باگ های سایت مشخص شده که حلش دو سه روز طول می کشه توی این مدت مجبوریم صبر کنیم😅
</Typography>
)
}

0 comments on commit 7bf1545

Please sign in to comment.