diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..6b92b83 Binary files /dev/null and b/.DS_Store differ diff --git a/searching-front/app/core/components/ContextProviders/ContextProviders.tsx b/searching-front/app/core/components/ContextProviders/ContextProviders.tsx new file mode 100644 index 0000000..1a57666 --- /dev/null +++ b/searching-front/app/core/components/ContextProviders/ContextProviders.tsx @@ -0,0 +1,33 @@ +import { + ServerSidePropsContext, + ContextParamsServer, +} from "app/core/contextProviders/serverSidePropsProvider" +import { ReactNode, useState } from "react" +import jsCookies from "js-cookie" + +interface Props { + children: ReactNode + contextParamsServer: ContextParamsServer +} + +type Theme = "light" | "dark" +const THEME_COOKIE_NAME = "theme" + +const ContextProviders = ({ children, contextParamsServer: { cookies } }: Props) => { + const [theme, setThemeState] = useState((cookies[THEME_COOKIE_NAME] as Theme) || 'dark') + const setTheme = (theme: Theme) => { + jsCookies.set(THEME_COOKIE_NAME, theme) + setThemeState(theme) + } + + const context = { + theme, + setTheme, + } + + return ( + {children} + ) +} + +export default ContextProviders diff --git a/searching-front/app/core/components/ContextProviders/index.tsx b/searching-front/app/core/components/ContextProviders/index.tsx new file mode 100644 index 0000000..46158b3 --- /dev/null +++ b/searching-front/app/core/components/ContextProviders/index.tsx @@ -0,0 +1 @@ +export {default} from './ContextProviders' \ No newline at end of file diff --git a/searching-front/app/core/components/Footer/Footer.tsx b/searching-front/app/core/components/Footer/Footer.tsx index 9db4f50..6303e2b 100644 --- a/searching-front/app/core/components/Footer/Footer.tsx +++ b/searching-front/app/core/components/Footer/Footer.tsx @@ -34,9 +34,8 @@ const Footer = () => { return (
- - - + +
) diff --git a/searching-front/app/core/components/Footer/styles.module.css b/searching-front/app/core/components/Footer/styles.module.css index 2df9fa4..5c0d18e 100644 --- a/searching-front/app/core/components/Footer/styles.module.css +++ b/searching-front/app/core/components/Footer/styles.module.css @@ -2,7 +2,8 @@ margin-top: 30px; box-sizing: border-box; display: flex; - justify-content: center; + border-top: 1px solid var(--border_color_main); + padding: var(--layout-padding); } .tgIcon { @@ -14,15 +15,20 @@ .contactsWrapper { flex: 1; display: flex; - justify-content: space-between; align-items: center; color: var(--text_secondary); max-width: 600px; } .footerLinkRoot { + font-size: 15px; + font-weight: 700; text-decoration: none; - color: var(--text_secondary); - display: flex; - align-items: center; -} \ No newline at end of file + + background: var(--footer_link_color); + -webkit-background-clip: text; + -webkit-text-fill-color: transparent; + color: #0B2349; + display: table; + margin-right: 40px; +} diff --git a/searching-front/app/core/components/Header/Header.tsx b/searching-front/app/core/components/Header/Header.tsx index 4c68a72..42ffea8 100644 --- a/searching-front/app/core/components/Header/Header.tsx +++ b/searching-front/app/core/components/Header/Header.tsx @@ -1,4 +1,5 @@ import { Routes } from "@blitzjs/next" +import { cn } from "app/core/helpers/common" import TonLogo from "app/core/icons/TonLogo" import { useRouter } from "next/router" import SearchForm from "../SearchForm" @@ -14,12 +15,13 @@ const Header = () => { } return ( -
+
TON SEARCHING
{shouldShowSearchForm && } {/* */} +
) } diff --git a/searching-front/app/core/components/Header/styles.module.css b/searching-front/app/core/components/Header/styles.module.css index 4487929..a97bed1 100644 --- a/searching-front/app/core/components/Header/styles.module.css +++ b/searching-front/app/core/components/Header/styles.module.css @@ -1,14 +1,17 @@ .root { box-sizing: border-box; display: flex; + align-items: center; + min-height: 94px; + padding: var(--layout-padding); + justify-content: space-between; } -@media only screen and (max-width: 900px) { - .root { - flex-direction: column; - } +.root.withBorder { + border-bottom: 1px solid var(--border_color_main); } + .logoWrapper { display: flex; align-items: center; @@ -24,12 +27,32 @@ margin-right: 20px; } -@media only screen and (max-width: 900px) { +.rightFiller{ + width: 230px; +} + +@media only screen and (max-width: 1100px) { + .logoWrapper > span { + display: none; + } + .rightFiller{ + width: 32px; + } +} + +@media only screen and (max-width: 1000px) { + .logoWrapper > span { + display: inline; + } .root { flex-direction: column; - padding: 0; + /* padding: 0; */ + min-height: none; } .logoWrapper { - margin-bottom: 10px; + margin-bottom: 20px; + } + .rightFiller{ + width: 0; } } diff --git a/searching-front/app/core/components/Link/Link.tsx b/searching-front/app/core/components/Link/Link.tsx new file mode 100644 index 0000000..64ee734 --- /dev/null +++ b/searching-front/app/core/components/Link/Link.tsx @@ -0,0 +1,38 @@ +import { cn } from "app/core/helpers/common" +import { ReactNode } from "react" +import { AnimatePresence, HTMLMotionProps, motion } from "framer-motion" +import s from "./styles.module.css" + +import NextLink from "next/link" +import { Routes } from "@blitzjs/next" + +interface Props { + children: ReactNode + theme: "primary" | "clear" + className?: string + onClick?: () => void + href: string | ReturnType + wide?: boolean +} + +const Link = ({ + children, + theme, + className, + onClick, + href, + wide, + ...linkProps +}: Props & React.ComponentProps) => { + return ( + + ) +} + +export default Link diff --git a/searching-front/app/core/components/Link/index.ts b/searching-front/app/core/components/Link/index.ts new file mode 100644 index 0000000..50ec0c0 --- /dev/null +++ b/searching-front/app/core/components/Link/index.ts @@ -0,0 +1 @@ +export { default } from "./Link" diff --git a/searching-front/app/core/components/Link/styles.module.css b/searching-front/app/core/components/Link/styles.module.css new file mode 100644 index 0000000..1b1b213 --- /dev/null +++ b/searching-front/app/core/components/Link/styles.module.css @@ -0,0 +1,40 @@ +.root { + text-decoration: none; + display: inline-block; + + /* size */ + font-size: 18px; + font-weight: 500px; +} +.root a { + text-decoration: none; +} + +.root a.wide::before { + content: ""; + position: absolute; + width: 100%; + height: 100%; + top: 0; + left: 0; +} + +.root:active { + transform: scale(0.95); +} + +.root:global(.theme-primary) a { + color: var(--button_primary); +} + +.root:global(.theme-primary) a:hover { + color: var(--button_primary_hover); +} + +.root:global(.theme-primary) a:active { + color: var(--button_primary_pressed); +} + +.root:global(.theme-clear) a { + color: inherit; +} diff --git a/searching-front/app/core/components/SearchForm/styles.module.css b/searching-front/app/core/components/SearchForm/styles.module.css index c46e50d..9e0a180 100644 --- a/searching-front/app/core/components/SearchForm/styles.module.css +++ b/searching-front/app/core/components/SearchForm/styles.module.css @@ -1,5 +1,6 @@ .root { - width: 55vw; + width: 100%; + max-width: 600px; font-size: 18px; position: relative; z-index: 101; diff --git a/searching-front/app/core/components/ThemeSwitcher/ThemeSwitcher.tsx b/searching-front/app/core/components/ThemeSwitcher/ThemeSwitcher.tsx index 5ac80fd..e726406 100644 --- a/searching-front/app/core/components/ThemeSwitcher/ThemeSwitcher.tsx +++ b/searching-front/app/core/components/ThemeSwitcher/ThemeSwitcher.tsx @@ -1,29 +1,27 @@ +import { cn } from "app/core/helpers/common" +import { useCurrentTheme } from "app/core/hooks/useCurrentTheme" import s from "./styles.module.css" const ThemeSwitcher = () => { + const { theme, setTheme } = useCurrentTheme() + + const toggleTheme = () => { + if (theme == "light") { + setTheme("dark") + } else { + setTheme("light") + } + } + let emoji + if (theme == "light") { + emoji = "🌞" + } else { + emoji = "🌛" + } return (
-
- - +
+
{emoji}
) diff --git a/searching-front/app/core/components/ThemeSwitcher/styles.module.css b/searching-front/app/core/components/ThemeSwitcher/styles.module.css index 088fa40..a4e501c 100644 --- a/searching-front/app/core/components/ThemeSwitcher/styles.module.css +++ b/searching-front/app/core/components/ThemeSwitcher/styles.module.css @@ -1,311 +1,31 @@ -.wrapper { - /* position: absolute; - top: 50%; - left: 50%; - transform: translate(-50%, -50%); */ +.root{ + flex: 1; + display: flex; + justify-content: flex-end; } -.hideCheckbox { - opacity: 0; - height: 0; - width: 0; -} - -.toggle { - position: relative; - cursor: pointer; - display: inline-block; - width: 200px; - height: 100px; - background: #211042; - border-radius: 50px; - transition: 500ms; - overflow: hidden; -} - -.toggleButton { - position: absolute; - display: inline-block; - top: 7px; - left: 6px; - width: 86px; - height: 86px; - border-radius: 50%; - background: #faeaf1; - overflow: hidden; - box-shadow: 0 0 35px 4px rgba(255, 255, 255); - transition: all 500ms ease-out; -} - -.crater { - position: absolute; - display: inline-block; - background: #faeaf1; - border-radius: 50%; - transition: 500ms; -} - -.crater1 { - background: #fffff9; - width: 86px; - height: 86px; - left: 10px; - bottom: 10px; -} - -.crater2 { - width: 20px; - height: 20px; - top: -7px; - left: 44px; -} - -.crater3 { - width: 16px; - height: 16px; - top: 20px; - right: -4px; -} - -.crater4 { - width: 10px; - height: 10px; - top: 24px; - left: 30px; -} - -.crater5 { - width: 15px; - height: 15px; - top: 40px; - left: 48px; -} - -.crater6 { - width: 10px; - height: 10px; - top: 48px; - left: 20px; -} - -.crater7 { - width: 12px; - height: 12px; - bottom: 5px; - left: 35px; -} - -.star { - position: absolute; - display: inline-block; - border-radius: 50%; - background: #fff; - box-shadow: 1px 0 2px 2px rgba(255, 255, 255); -} - -.star1 { - width: 6px; - height: 6px; - right: 90px; - bottom: 40px; -} - -.star2 { - width: 8px; - height: 8px; - right: 70px; - top: 10px; -} - -.star3 { - width: 5px; - height: 5px; - right: 60px; - bottom: 15px; -} - -.star4 { - width: 3px; - height: 3px; - right: 40px; - bottom: 50px; -} - -.star5 { - width: 4px; - height: 4px; - right: 10px; - bottom: 35px; -} - -.star6, -.star7, -.star8 { - width: 10px; - height: 2px; - border-radius: 2px; - transform: rotate(-45deg); - box-shadow: 5px 0px 4px 1px #fff; - animation-name: travel; - animation-duration: 1.5s; - animation-timing-function: ease-out; - animation-iteration-count: infinite; -} - -.star6 { - right: 30px; - bottom: 30px; - animation-delay: -2s; -} - -.star7 { - right: 50px; - bottom: 60px; -} - -.star8 { - right: 90px; - top: 10px; - animation-delay: -4s; -} - -@keyframes travel { - 0% { - transform: rotate(-45deg) translateX(70px); - } - - 50% { - transform: rotate(-45deg) translateX(-20px); - box-shadow: 5px 0px 6px 1px #fff; - } - - 100% { - transform: rotate(-45deg) translateX(-30px); - width: 2px; - height: 2px; - opacity: 0; - box-shadow: none; - } -} - -.hideCheckbox:checked + .toggle { - background: #24d7f7; -} - -.hideCheckbox:checked + .toggle .toggleButton { - background: #f7ffff; - transform: translateX(102px); - box-shadow: 0 0 35px 5px rgba(255, 255, 255); -} - -.hideCheckbox:checked + .toggle .toggleButton .crater { - transform: rotate(-45deg) translateX(70px); -} - -.hideCheckbox:checked + .toggle .star { - animation: move 2s infinite; - transform: none; - box-shadow: none; -} - -.hideCheckbox:checked + .toggle .star1 { - width: 40px; - height: 10px; +.wrapper{ + width: 35px; + background: var(--background_secondary); border-radius: 10px; - background: #fff; - left: 20px; - top: 25px; - box-shadow: none; -} - -.hideCheckbox:checked + .toggle .star2 { - width: 12px; - height: 12px; - background: #fff; - left: 26px; - top: 23px; - box-shadow: -1px 0 2px 0 rgba(0, 0, 0, 0.1); -} - -.hideCheckbox:checked + .toggle .star3 { - width: 16px; - height: 16px; - background: #fff; - left: 35px; - top: 19px; - box-shadow: -1px 0 2px 0 rgba(0, 0, 0, 0.1); -} - -.hideCheckbox:checked + .toggle .star4 { - width: 14px; - height: 14px; - background: #fff; - left: 46px; - top: 21px; - box-shadow: -1px 0 2px 0 rgba(0, 0, 0, 0.1); -} - -.hideCheckbox:checked + .toggle .star5 { - width: 60px; - height: 15px; - border-radius: 15px; - background: #fff; - left: 30px; - bottom: 20px; - box-shadow: none; + height: 20px; + display: flex; + align-items: center; + padding: 2px; + cursor: pointer; } -.hideCheckbox:checked + .toggle .star6 { +.content{ width: 18px; height: 18px; - background: #fff; - border-radius: 50%; - left: 38px; - bottom: 20px; - box-shadow: -1px 0 2px 0 rgba(0, 0, 0, 0.1); -} - -.hideCheckbox:checked + .toggle .star7 { - width: 24px; - height: 24px; - background: #fff; border-radius: 50%; - left: 52px; - bottom: 20px; - box-shadow: -1px 0 2px 0 rgba(0, 0, 0, 0.1); -} - -.hideCheckbox:checked + .toggle .star8 { - width: 21px; - height: 21px; - background: #fff; - border-radius: 50%; - left: 70px; - top: 59px; - box-shadow: -1px 0 2px 0 rgba(0, 0, 0, 0.1); -} - -@keyframes move { - 0% { - transform: none; - } - - 25% { - transform: translateX(2px); - } - - 100% { - transform: translateX(-2px); - } -} - -/* p { + background: var(--background_main); + font-size: 15px; text-align: center; - letter-spacing: 15px; - background: #34495e; - color: #fff; + transition: transform .1s linear; + pointer-events: none; } -p.morning { - background: #e67e22; -} */ +.content.light { + transform: translateX(16px); +} \ No newline at end of file diff --git a/searching-front/app/core/components/TonBrilliant/TonBrillian.tsx b/searching-front/app/core/components/TonBrilliant/TonBrillian.tsx index c48474d..8d1c5a1 100644 --- a/searching-front/app/core/components/TonBrilliant/TonBrillian.tsx +++ b/searching-front/app/core/components/TonBrilliant/TonBrillian.tsx @@ -9,8 +9,8 @@ const TonBrilliant = () => {
) } diff --git a/searching-front/app/core/pages/State/styles.module.css b/searching-front/app/core/pages/State/styles.module.css index 4c59fcd..398f521 100644 --- a/searching-front/app/core/pages/State/styles.module.css +++ b/searching-front/app/core/pages/State/styles.module.css @@ -1,26 +1,106 @@ .root { - /* margin-right: var(--logoWrapperWidth); */ + width: 100vw; + max-width: 600px; + margin: 0 auto; } .actualStateWrapper { + width: 100%; + padding: 20px 24px; font-size: 20px; display: flex; - justify-content: center; - align-items: center; + flex-direction: column; + background: rgba(26, 148, 255, 0.06); + border-radius: var(--border_radius_base); + margin-bottom: 60px; + box-sizing: border-box; } .availableCount { - font-size: 100px; - margin-right: 10px; - color: var(--button_primary); - font-weight: bold; + font-weight: 700; + font-size: 32px; + line-height: 40px; + margin-right: 8px; } .allCount { - margin: 0px 10px; - font-size: 30px; - color: var(--text_secondary); - font-weight: bold; + font-size: 24px; + line-height: 30px; + color: #ffffff; + opacity: 0.4; } .areNowAvailable { + margin-top: 6px; + font-weight: 700; + font-size: 16px; + line-height: 20px; +} + +.counterFooter { + display: flex; + justify-content: space-between; + align-items: flex-end; +} +.counterDate { + font-weight: 400; + font-size: 12px; + line-height: 15px; + + color: #ffffff; + opacity: 0.32; +} + +.newestTitle { + text-align: center; + font-weight: 900; + font-size: 32px; + line-height: 40px; + margin-bottom: 32px; +} +.newestTitleTon { + color: var(--button_primary); +} + +.newestListWrapper { + display: flex; + flex-direction: column; +} +.newestListItem { + padding: 24px 34px; + border-radius: var(--border_radius_base); + border: 1px solid var(--border_color_main); + text-transform: capitalize; + font-weight: 700; + font-size: 16px; + line-height: 20px; + cursor: pointer; + position: relative; +} + +.siteButton.siteButton { + width: 52px; + height: 41px; + font-size: 20px; + line-height: 25px; + border-radius: 16px; + transition: opacity 0.2s ease-in-out; + padding: 0; + background-color: var(--background_secondary); + margin-left: 8px; + +} + +.newestListItem:hover .siteButton.siteButton { + background-color: var(--button_primary); +} + +.button { + position: absolute; + top: 2px; + right: 22px; + background-color: var(--background_secondary); +} + +.newestListItem:not(:last-child) { + margin-bottom: 20px; } .doughnutAvailable { width: 200px; diff --git a/searching-front/app/core/variables.css b/searching-front/app/core/variables.css index adda1be..38903f6 100644 --- a/searching-front/app/core/variables.css +++ b/searching-front/app/core/variables.css @@ -10,6 +10,8 @@ body { --toncoin_header: #353538; --toncoin_gradient: linear-gradient(297.97deg, #232328 9.93%, #343437 76.88%); --StripeMenuWhite: #fff; + --layout-padding: 20px; + --border_radius_base: 24px; } body { diff --git a/searching-front/app/stateSites/queries/getLastWeekNewSites.ts b/searching-front/app/stateSites/queries/getLastWeekNewSites.ts new file mode 100644 index 0000000..2695b2f --- /dev/null +++ b/searching-front/app/stateSites/queries/getLastWeekNewSites.ts @@ -0,0 +1,16 @@ +import { subDays } from "date-fns" +import db from "db" + +export default async function getLastWeekNewSites() { + const weekAgo = subDays(new Date(), 7) + + const lastWeekNewSites = await db.nftDomain.findMany({ + orderBy: { firstAvailableDate: "desc" }, + take: 10, + where: { available: true, AND: { firstAvailableDate: { gt: weekAgo } } }, + }) + console.log(lastWeekNewSites) + return { + lastWeekNewSites, + } +} diff --git a/searching-front/pages/auth/forgot-password.tsx b/searching-front/pages/auth/forgot-password.tsx deleted file mode 100644 index bb5ba63..0000000 --- a/searching-front/pages/auth/forgot-password.tsx +++ /dev/null @@ -1,46 +0,0 @@ -import Layout from "app/core/layouts/Layout" -import { LabeledTextField } from "app/core/components/LabeledTextField" -import { Form, FORM_ERROR } from "app/core/components/Form" -import { ForgotPassword } from "app/auth/validations" -import forgotPassword from "app/auth/mutations/forgotPassword" -import { useMutation } from "@blitzjs/rpc" -import { BlitzPage } from "@blitzjs/next" - -const ForgotPasswordPage: BlitzPage = () => { - const [forgotPasswordMutation, { isSuccess }] = useMutation(forgotPassword) - - return ( - -

Forgot your password?

- - {isSuccess ? ( -
-

Request Submitted

-

- If your email is in our system, you will receive instructions to reset your password - shortly. -

-
- ) : ( -
{ - try { - await forgotPasswordMutation(values) - } catch (error: any) { - return { - [FORM_ERROR]: "Sorry, we had an unexpected error. Please try again.", - } - } - }} - > - - - )} -
- ) -} - -export default ForgotPasswordPage diff --git a/searching-front/pages/auth/login.tsx b/searching-front/pages/auth/login.tsx deleted file mode 100644 index 9d9a388..0000000 --- a/searching-front/pages/auth/login.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import { BlitzPage } from "@blitzjs/next" -import Layout from "app/core/layouts/Layout" -import { LoginForm } from "app/auth/components/LoginForm" -import { useRouter } from "next/router" - -const LoginPage: BlitzPage = () => { - const router = useRouter() - - return ( - - { - const next = router.query.next ? decodeURIComponent(router.query.next as string) : "/" - return router.push(next) - }} - /> - - ) -} - -export default LoginPage diff --git a/searching-front/pages/auth/reset-password.tsx b/searching-front/pages/auth/reset-password.tsx deleted file mode 100644 index 2df1c5e..0000000 --- a/searching-front/pages/auth/reset-password.tsx +++ /dev/null @@ -1,66 +0,0 @@ -import Layout from "app/core/layouts/Layout" -import { LabeledTextField } from "app/core/components/LabeledTextField" -import { Form, FORM_ERROR } from "app/core/components/Form" -import { ResetPassword } from "app/auth/validations" -import resetPassword from "app/auth/mutations/resetPassword" -import { BlitzPage, Routes } from "@blitzjs/next" -import { useRouter } from "next/router" -import { useMutation } from "@blitzjs/rpc" -import Link from "next/link" - -const ResetPasswordPage: BlitzPage = () => { - const router = useRouter() - const [resetPasswordMutation, { isSuccess }] = useMutation(resetPassword) - - return ( -
-

Set a New Password

- - {isSuccess ? ( -
-

Password Reset Successfully

-

- Go to the homepage -

-
- ) : ( -
{ - try { - await resetPasswordMutation(values) - } catch (error: any) { - if (error.name === "ResetPasswordError") { - return { - [FORM_ERROR]: error.message, - } - } else { - return { - [FORM_ERROR]: "Sorry, we had an unexpected error. Please try again.", - } - } - } - }} - > - - - - )} -
- ) -} - -ResetPasswordPage.redirectAuthenticatedTo = "/" -ResetPasswordPage.getLayout = (page) => {page} - -export default ResetPasswordPage diff --git a/searching-front/pages/auth/signup.tsx b/searching-front/pages/auth/signup.tsx deleted file mode 100644 index 68fe2a7..0000000 --- a/searching-front/pages/auth/signup.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { useRouter } from "next/router" -import Layout from "app/core/layouts/Layout" -import { SignupForm } from "app/auth/components/SignupForm" -import { BlitzPage, Routes } from "@blitzjs/next" - -const SignupPage: BlitzPage = () => { - const router = useRouter() - - return ( - - router.push(Routes.Home())} /> - - ) -} - -export default SignupPage diff --git a/searching-front/pages/index.tsx b/searching-front/pages/index.tsx index 6b37a1a..5471591 100644 --- a/searching-front/pages/index.tsx +++ b/searching-front/pages/index.tsx @@ -26,8 +26,16 @@ import { ServerSidePropsContext, } from "app/core/contextProviders/serverSidePropsProvider" import { gSSP } from "app/blitz-server" +import ContextProviders from "app/core/components/ContextProviders" +import getLastWeekNewSites from "app/stateSites/queries/getLastWeekNewSites" +import { NftDomain } from "@prisma/client" -const Home: BlitzPage = (props) => { +interface Props { + lastWeekNewSites: NftDomain[] + cookies: Record +} + +const Home: BlitzPage = (props) => { return ( { // reset the state of your app so the error doesn't happen again }} > - + -
+
- + ) } -export const getServerSideProps = gSSP(serverSideProps) +export const getServerSideProps = gSSP( + serverSideProps(async () => { + return { + ...(await getLastWeekNewSites()), + } + }) +) export default Home diff --git a/searching-front/pages/s.tsx b/searching-front/pages/s.tsx index c83c5c7..79953e2 100644 --- a/searching-front/pages/s.tsx +++ b/searching-front/pages/s.tsx @@ -1,11 +1,6 @@ import { Suspense } from "react" -import Image from "next/image" -import Link from "next/link" import Layout from "app/core/layouts/Layout" -import { useCurrentUser } from "app/core/hooks/useCurrentUser" -import logout from "app/auth/mutations/logout" -import logo from "public/logo.png" -import { useMutation } from "@blitzjs/rpc" + import { Routes, BlitzPage } from "@blitzjs/next" import Search from "app/core/pages/Search" @@ -15,6 +10,7 @@ import { serverSideProps, ServerSidePropsContext, } from "app/core/contextProviders/serverSidePropsProvider" +import ContextProviders from "app/core/components/ContextProviders" function ErrorFallback({ error, resetErrorBoundary }) { return ( @@ -35,17 +31,17 @@ const SearchPage: BlitzPage = (props) => { // reset the state of your app so the error doesn't happen again }} > - + - + ) } -export const getServerSideProps = gSSP(serverSideProps) +export const getServerSideProps = gSSP(serverSideProps()) export default SearchPage diff --git a/searching-front/pages/state.tsx b/searching-front/pages/state.tsx index 55bf402..c2ea0f3 100644 --- a/searching-front/pages/state.tsx +++ b/searching-front/pages/state.tsx @@ -5,15 +5,18 @@ import getActualSitesState from "app/stateSites/queries/getActualSitesState" import getHistoryOfSitesState from "app/stateSites/queries/getHistoryOfSitesState" import { BlitzPage } from "@blitzjs/next" import State from "app/core/pages/State" -import { gSP } from "app/blitz-server" - -import { ErrorBoundary } from "@blitzjs/next" - +import { gSSP } from "app/blitz-server" import { + serverSideProps, ServerSidePropsContext, } from "app/core/contextProviders/serverSidePropsProvider" + +import { ErrorBoundary } from "@blitzjs/next" + import { StatePageProps } from "app/core/pages/State/State" import { StaticPageProps } from "app/core/commonTypes" +import ContextProviders from "app/core/components/ContextProviders" +import getLastWeekNewSites from "app/stateSites/queries/getLastWeekNewSites" function ErrorFallback({ error, resetErrorBoundary }) { return ( @@ -25,7 +28,8 @@ function ErrorFallback({ error, resetErrorBoundary }) { ) } -const StatePage: BlitzPage = (props) => { +const StatePage: BlitzPage = (props) => { + return ( = (props) => { // reset the state of your app so the error doesn't happen again }} > - + - + ) } -export const getServerSideProps = async ({ params, ctx }): StaticPageProps => { - const actualState = await getActualSitesState(); - const historyOfState = await getHistoryOfSitesState(); - return { - props: { +export const getServerSideProps = gSSP( + serverSideProps(async (): Promise => { + const actualState = await getActualSitesState() + const historyOfState = await getHistoryOfSitesState() + return { actualState, - historyOfState - }, - } -} + historyOfState, + ...(await getLastWeekNewSites()), + } + }) +) export default StatePage diff --git a/searching-front/public/favicon copy.ico b/searching-front/public/favicon copy.ico deleted file mode 100644 index c7bd1c0..0000000 Binary files a/searching-front/public/favicon copy.ico and /dev/null differ diff --git a/searching-front/public/favicon.ico b/searching-front/public/favicon.ico deleted file mode 100644 index c7bd1c0..0000000 Binary files a/searching-front/public/favicon.ico and /dev/null differ diff --git a/searching-front/public/logo copy.png b/searching-front/public/logo copy.png deleted file mode 100644 index 6a98261..0000000 Binary files a/searching-front/public/logo copy.png and /dev/null differ diff --git a/searching-front/public/logo.png b/searching-front/public/logo.png deleted file mode 100644 index 6a98261..0000000 Binary files a/searching-front/public/logo.png and /dev/null differ diff --git a/searching-front/services/main.ts b/searching-front/services/main.ts index a887bbb..b66b1a3 100644 --- a/searching-front/services/main.ts +++ b/searching-front/services/main.ts @@ -6,15 +6,15 @@ import parser from "./parser" import influx from "./influx" const run = async()=>{ - console.log('Start domain watcher') - console.time('watcher') - await domainWatcher(); - console.timeEnd('watcher') - influx() - console.log('Start parser'); - console.time('watcher'); + // console.log('Start domain watcher') + // console.time('watcher') + // await domainWatcher(); + // console.timeEnd('watcher') + // influx() + // console.log('Start parser'); + // console.time('watcher'); await parser(); - console.timeEnd('watcher'); + // console.timeEnd('watcher'); } diff --git a/searching-front/services/modules/parser/index.ts b/searching-front/services/modules/parser/index.ts index dc1101b..076ebea 100644 --- a/searching-front/services/modules/parser/index.ts +++ b/searching-front/services/modules/parser/index.ts @@ -31,6 +31,7 @@ class Parser { const { data, headers } = await axios.get(url,{ proxy: getTonProxy(), }) + const contentType = headers["content-type"].toLocaleLowerCase() if (!contentType.startsWith('text/html')) { @@ -69,7 +70,7 @@ class Parser { subPages, } } catch (e) { - console.log("Parse error ", url) + console.log("Parse error ",e, url) return SHOULD_NOT_PARSE } } diff --git a/searching-front/services/parser.ts b/searching-front/services/parser.ts index 3095cca..ab35a6e 100644 --- a/searching-front/services/parser.ts +++ b/searching-front/services/parser.ts @@ -11,10 +11,12 @@ const findFirstNotIndexed = (subpages: SubPages = {}) => { } const indexWebsite = async (domain: string, path: string, subpages: SubPages = {},count=0) => { + console.log(subpages) const subpagesLength = Object.keys(subpages).length; if (!subpages[path]) { const url = domain + path; const parseInfo = await Parser.parseUrl(url) + console.log(parseInfo) subpages[path] = true let pages = {} if (parseInfo !== SHOULD_NOT_PARSE && subpagesLength < 50) { @@ -40,6 +42,9 @@ const indexWebsite = async (domain: string, path: string, subpages: SubPages = { const main = async () => { + await indexWebsite('http://planets.ton', "/") + console.log('finish') + return await Elastic.initElastic() const domains = await db.nftDomain.findMany({where:{available: true}}) console.log('Find domains', domains)