33 |
34 | {children && typeof children[0] !== "function" && children[0]}
35 | {children &&
36 | typeof children[0] === "function" &&
37 | (children[0] as any)({
38 | openModal,
39 | })}
40 |
41 | {openModal && (
42 |
43 | {children && typeof children[1] !== "function" && children[1]}
44 | {children &&
45 | typeof children[1] === "function" &&
46 | (children[1] as any)({
47 | toggleModal,
48 | })}
49 |
50 | )}
51 |
52 | )
53 | }
54 |
--------------------------------------------------------------------------------
/server/controller/BotController.ts:
--------------------------------------------------------------------------------
1 | import { Controller, Post, Body, Get } from "@nestjs/common"
2 | import BotModel from "../model/BotModel"
3 | import launch, { stop } from "../bot/WeatherBot"
4 |
5 | @Controller()
6 | class BotController {
7 | // eslint-disable-next-line no-useless-constructor, no-empty-function
8 | constructor() {}
9 |
10 | @Post("/api/bot/update")
11 | public async updateBotKey(@Body() body: { key: string }) {
12 | const { key } = body
13 |
14 | try {
15 | const bot = await BotModel.findOneAndUpdate({ key }).lean()
16 |
17 | return bot as any
18 | } catch (err: any) {
19 | throw new Error(err)
20 | }
21 | }
22 |
23 | @Post("/api/bot/relanuch")
24 | public async relaunch(@Body() body: { newKey: string; oldKey: string; newHandle: string }) {
25 | const { newKey, oldKey, newHandle } = body
26 | try {
27 | stop(oldKey)
28 |
29 | const updatedBot = await BotModel.findOneAndUpdate(
30 | { key: oldKey },
31 | { key: newKey, handle: newHandle },
32 | ).lean()
33 |
34 | if (!updatedBot) {
35 | const newBot = new BotModel({
36 | key: newKey,
37 | handle: newHandle,
38 | })
39 |
40 | await newBot.save()
41 | }
42 |
43 | launch(newKey)
44 | } catch (err: any) {
45 | console.log(err)
46 | throw new Error(err)
47 | }
48 | }
49 |
50 | @Get("/api/bot/getKey")
51 | public async getKey() {
52 | try {
53 | const bots = await BotModel.find({}).lean()
54 |
55 | if (bots.length) return bots[0]
56 |
57 | return { key: "" }
58 | } catch (err: any) {
59 | throw new Error(err)
60 | }
61 | }
62 | }
63 |
64 | export default BotController
65 |
--------------------------------------------------------------------------------
/styles/globals.css:
--------------------------------------------------------------------------------
1 | @tailwind base;
2 | @tailwind components;
3 | @tailwind utilities;
4 |
5 | @font-face {
6 | font-family: "Poppins";
7 | src: url("/fonts/Poppins/Poppins-Regular.ttf") format("truetype");
8 | }
9 | @font-face {
10 | font-family: "Poppins Light";
11 | src: url("/fonts/Poppins/Poppins-Light.ttf") format("truetype");
12 | }
13 | @font-face {
14 | font-family: "Poppins Medium";
15 | src: url("/fonts/Poppins/Poppins-Medium.ttf") format("truetype");
16 | }
17 | @font-face {
18 | font-family: "Poppins SemiBold";
19 | src: url("/fonts/Poppins/Poppins-SemiBold.ttf") format("truetype");
20 | }
21 | @font-face {
22 | font-family: "Poppins Bold";
23 | src: url("/fonts/Poppins/Poppins-Bold.ttf") format("truetype");
24 | }
25 |
26 | @layer utilities {
27 | .no-scrollbar::-webkit-scrollbar {
28 | display: none;
29 | }
30 |
31 | .no-scrollbar {
32 | -ms-overflow-style: none;
33 | scrollbar-width: none;
34 | }
35 | }
36 | html,
37 | body {
38 | background-color: white;
39 | padding: 0;
40 | margin: 0;
41 | font-family:
42 | -apple-system,
43 | BlinkMacSystemFont,
44 | Segoe UI,
45 | Roboto,
46 | Oxygen,
47 | Ubuntu,
48 | Cantarell,
49 | Fira Sans,
50 | Droid Sans,
51 | Helvetica Neue,
52 | sans-serif;
53 | }
54 |
55 | p {
56 | margin: 0;
57 | padding: 0;
58 | }
59 | body::-webkit-scrollbar {
60 | display: none;
61 | }
62 |
63 | ::-webkit-scrollbar {
64 | width: 13px;
65 | }
66 |
67 | ::-webkit-scrollbar-track {
68 | background: black;
69 | border-radius: 10px;
70 | border: 1px solid white;
71 | }
72 |
73 | ::-webkit-scrollbar-thumb {
74 | border-radius: 10px;
75 | border: 3px solid rgba(0, 0, 0, 0);
76 | background-clip: padding-box;
77 | background-color: white;
78 | }
79 |
--------------------------------------------------------------------------------
/components/MobileMenu/MenuList.tsx:
--------------------------------------------------------------------------------
1 | import React from "react"
2 | import dynamic from "next/dynamic"
3 | import Media from "../../shared/Media"
4 | import Popover from "../../shared/Popover"
5 | import Switch from "../../shared/Switch"
6 | import { useTheme } from "../../providers/ThemeProvider"
7 |
8 | const GoogleLoginButton = dynamic(() => import("../GoogleLoginButton"), {
9 | ssr: false,
10 | })
11 |
12 | const MenuList = () => {
13 | const { onChangeThemeConfig, themeMode } = useTheme()
14 |
15 | const onToggle = () => {
16 | onChangeThemeConfig()
17 | }
18 |
19 | return (
20 |
56 | )
57 | }
58 |
59 | export default MenuList
60 |
--------------------------------------------------------------------------------
/components/Pages/AdminPage/Table/Table.tsx:
--------------------------------------------------------------------------------
1 | import React from "react"
2 | import SkeletonTableBody from "../SkeletonTableBody"
3 | import TableRow from "../TableRow"
4 | import TableHead from "../TableHead"
5 | import { TelegramUser } from "../types"
6 | import SearchInput from "../SearchInput"
7 | import Pagination from "../Pagination"
8 | import { useAdminProvider } from "../../../../providers/AdminProvider"
9 |
10 | const Table = () => {
11 | const { paginatedUser } = useAdminProvider()
12 |
13 | return (
14 | <>
15 |