diff --git a/src/components/Scenarios/Scenarios.tsx b/src/components/Scenarios/Scenarios.tsx index 70a536ec9..2ae9f4195 100644 --- a/src/components/Scenarios/Scenarios.tsx +++ b/src/components/Scenarios/Scenarios.tsx @@ -34,6 +34,14 @@ export function Scenarios() { +
  • + + +

    Website

    + To redesign your old site +
    + +
  • diff --git a/src/pages/api/scrape/scrape-web.ts b/src/pages/api/scrape/scrape-web.ts new file mode 100644 index 000000000..b0631bc2e --- /dev/null +++ b/src/pages/api/scrape/scrape-web.ts @@ -0,0 +1,36 @@ +import type { NextApiRequest, NextApiResponse } from 'next'; +import { isValidUrl } from '../../../utils/validators/isValidUrl'; + +export interface ScrapeWebResponse { + // TODO: [🌋] ErrorableResponse + + /** + * Information about the Instagram user + */ + webInfo: any /* <- !!! */; +} + +export default async function scrapeInstagramUserHandler( + request: NextApiRequest, + response: NextApiResponse, +) { + const url = request.query.url; + + if (!isValidUrl(url)) { + return response.status(400).json({ message: 'GET param url is not valid URL' } as any /* <-[🌋] */); + } + + const response = await fetch(url as string); + + const webInfo = await response.text(); + + // console.info('👤', { instagramUser }); + + return response.status(200).json({ webInfo } satisfies ScrapeWebResponse); +} + +/** + * TODO: !!! [🧠] How to extract the article from the web? + * TODO: !!! Use puppeteer to scrape the web + * TODO: [🕍] Cache the scraping + */ diff --git a/src/pages/new/from-image.tsx b/src/pages/new/from-image.tsx index 91ad5fb1d..44a35b7d4 100644 --- a/src/pages/new/from-image.tsx +++ b/src/pages/new/from-image.tsx @@ -43,6 +43,7 @@ export default function NewWallpaperFromImagePage() { /** * TODO: Split between /new/from-image and /new/just-from-image * TODO: Allow to use Camera (maybe in new route /new/from-camera) + * TODO: [👐] Unite design of all /new/* pages * TODO: [🌾] Unite design of all /new/* pages * TODO: [🥩] Make /new/just-from-image * TODO: [🏍] Standardize process of getting input data for new wallpaper diff --git a/src/pages/new/from-prompt.tsx b/src/pages/new/from-prompt.tsx index 15d1be4eb..ee7c182e7 100644 --- a/src/pages/new/from-prompt.tsx +++ b/src/pages/new/from-prompt.tsx @@ -1,12 +1,9 @@ import Link from 'next/link'; -import { useRouter } from 'next/router'; import { StaticAppHead } from '../../components/AppHead/StaticAppHead'; import { Center } from '../../components/SimpleLayout/Center'; import styles from '../../styles/static.module.css' /* <- TODO: [🤶] Get rid of page css and only use components (as ) */; export default function NewWallpaperFromPromptPage() { - const router = useRouter(); - return ( <> @@ -39,5 +36,6 @@ export default function NewWallpaperFromPromptPage() { } /** + * TODO: [👐] Unite design of all /new/* pages * TODO: [🏍] Standardize process of getting input data for new wallpaper */ diff --git a/src/pages/new/from-url.tsx b/src/pages/new/from-url.tsx new file mode 100644 index 000000000..0436a7da5 --- /dev/null +++ b/src/pages/new/from-url.tsx @@ -0,0 +1,55 @@ +import { useRef } from 'react'; +import { StaticAppHead } from '../../components/AppHead/StaticAppHead'; +import { Center } from '../../components/Center/Center'; +import styles from '../../styles/static.module.css' /* <- TODO: [🤶] Get rid of page css and only use components (as ) */; +import { isValidUrl } from '../../utils/validators/isValidUrl'; +import type { ScrapeWebResponse } from '../api/scrape/scrape-web'; + +export default function NewWallpaperFromPromptPage() { + const urlInputRef = useRef(null); + + return ( + <> + + +
    +
    +
    +

    AI Web Maker

    + Write URL to make new web from: +
    + + +
    +
    + + {/* TODO: Make here some footer + + */} +
    + + ); +} + +/** + * TODO: !!! Implement + * TODO: [👐] Unite design of all /new/* pages + */